Problems with stats

Hello everyone! I’ve some problems with stats. When I click on the “show stats” it writes me “not enough arguments” and it shows me only one line for example “strength”. The others lines aren’t revealed. Can you help me? What do I need to do?

Have you edited the Choicescript Stats document so it doesn’t show just “strength”?

@Dmitry Welcome to the forum. :slight_smile:

The error you have there is saying there’s something wrong with your syntax, but it’s not easy to say what this might be without seeing your actual code. The best thing to do would be to copy your choicescript_stats.txt and post it here, then someone will be able to explain where you’re going wrong.

When pasting your code in the forum, put < pre > before it and < /pre > after it (but without those spaces). That will retain the indentation and make it easier for others to see what your code is supposed to be doing.

Well, here is my stat_chart:


*stat_chart
  text name
  percent vigilance 
  percent strength
  percent leadership

Do I need to write the same in mygame.js folder? Thank you!

@Dmintry If you’re using the latest version of ChoiceScript (and you should be) you don’t have to mess with mygame.js but you do have to *create it at the beginning of your startup.txt

In your file startup.txt at the beginning you need to define all your variables.

You should have the lines:

*create name “unknown”
*create vigilance 50
*create strength 50
*create leadership 50

Changes the values as you see fit.

@andymwhy I did so but it doesn’t work. It still writes me “not enough arguments”.

@Dmitry Do you have anything else in your choicescript_stats.txt file other than that *stat_chart code you’ve shown above? If so, I’d suggest copying the entire contents of that file and paste it here, as there’s no error in the code you’ve shown above so it must be elsewhere.

@Vendetta Currently I’ve only this in the choicescript_stats folder.

@Dmitry Hmm, have you tried using the IDE? I highly recommend it.

https://dl.dropboxusercontent.com/u/7840892/CJW/choicescript/tools/IDE/main.html#

One of the main advantages of the IDE is that when you test-run your game within it, when it finds an error the code window jumps to the exact scene & line number where it occurs, making it much easier to locate & fix the actual problem.

@Vendetta Well, I’ve checked your suggestion. It doesn’t help me. I’ve checked there that I’ve written already and all is well; there aren’t errors.

@Dmitry I don’t suppose you could upload the files to Dropbox and we could take a look that way.

@Dmitry Did I understand that correctly? There are no errors when you run it under the IDE, only when running it in your local browser?

If that’s the case, I believe “not enough arguments” may in fact be a Javascript error, not ChoiceScript itself (which would explain why we can’t see anything wrong with your actual code). Does it actually say “Uncaught TypeError: Not enough arguments” or similar?

@Vendetta Well, today I’ve found out that it writes me “Not enough arguments” when I write in the choicescript_stats.txt “percent” word. When I write for example:


*stat_chart
text name
text strength
text leadership

there isn’t error. When I use “text” word I don’t have this error. Do you think it’s just a javascript error?

@Dmitry No, I think I was barking up the wrong tree on that one, after all. If the error disappears, it’s probably a ChoiceScript one - e.g. it’s not finding the values it needs to set ‘percent’ properly, or something along those lines.

If you prefer, the easiest way would be to send me your current game files as email attachments, and let me take a look to see if I can spot what the problem is:

vendetta (at) mazdrak (dot) com

Belated update on this, for anyone coming up with this thread on future searches.

It seems the “not enough arguments” error was indeed likely a Javascript error in this instance, caused by running the latest version of ChoiceScript in an old version of Firefox.

I guess the moral here is: always use the latest version of everything! At least that way, if it still doesn’t work as expected, the error is in your code. :smiley: