Need Choice Script help (invalid expression)


#1

I’m pretty bad with this stuff so I likely am missing something obvious.
I get this error when I’m testing my game:
line 25: Invalid expression at char 2, expected NUMBER, STRING, VAR or PARENTHETICAL, was: EQUALITY [=]
At line 25 I have this *set VisionArena = true
In mygame.js I have ,VisionArena: false.
I usually use firefox because I like it much better, but I also tried IE. No help there.
Help? I’m awful at coding. Do I need to *set it? I was under the impressino I didn’t.


#2

Try *set VisionArena “true”

For some reason you can’t use equalities when using the *set command, although you can use equalities when using the *if command.


#3

If your variable is numeric:

*set energy 20

For string (or maybe alphanumeric) variable:

*set name "John"

For logical:

*set visionArena true

#4

Just tried it, doesn’t work. I also tried replacing it with numbers and got this message line 25: Non-existent variable ‘visionarena’.


#5

I would check the capitilization of the variable. They have to be the same. If you set the variable as VisionArena in mygame.js, then you have to keep calling it VisionArena, not visionarena.


#6

You can’t have any capitol letters when declaring stats in the mygame.js

Use ,visionarena: false with proper indentation. This also means that when you *set you will have to use visionarena, without the capitilization.


#7

Indentation doesn’t actually matter in java script files, but yeah it’s good practice to keep it nice and legible. It does sound like the new issue is caused by either a spelling mistake or inconsistent capitalization.


#8

The best way to avoid those errors would be to name the variable “visionarena” or “vision_arena” instead of “visionArena”; do not use capital numbers as that will most likely give you errors if you try to modify that set variable. You can use underscores ( _ ) but try not to use capital/uppercase letters for variables.


#9

Ah. I’ve got it working. I added *set visionarena false to the beginning of the text file.
I thought having it set the default as false would do it, guess not.

D’oh.