Non-Existent Variable Error


#1

Greetings,

I started working on my stats screen.
Here is my choicescript_stats.txt details:

You can show your mood in this page.

*stat_chart
__percent Adaptability
__percent Cunning
__percent Ferocity
__text Adaptability
__text Cunning
__text Ferocity

Here is my “mygame.js” details:

// Specify the default starting stats here

stats = {
____Adaptability: 0
____,Cunning: 0
____,Ferocity: 0
};

// Specify the stats to use in debug mode

debugStats = {
____Adaptability: 0
____,Cunning: 0
____,Ferocity: 0
};

// or just use defaults
// debugStats = stats

So, when I save these f olders like this, and then try to open the index file and test the results, I receive a “line 4: Non-existent variable ‘adaptability’” error.
How can I solve this?
Thanks to all =)


#2

Any solutions?


#3

I’m sorry but I can’t find anything wrong with it. You’re going to have to wait for someone better at this than I am.


#4

Ok mam, thank you again =)


#5

Might sound a little silly but have you spelt it right in both mygame and the stat screen?


#6

You are very right.
I could have spelt it wrong but, i copied and pasted it here.
Wrong spelling means wrong coding i guess.
And i think there is no wrong spelling; and thats the point i gone mad =)


#7

Could you upload the game somewhere? It’d help me vastly if I could take a proper look at all the files


#8

You should label all variables with lower case letters - try ‘adaptability’ instead of ‘Adaptability’, and so on. That should solve it.

*Note - you don’t need to use lower case for the variables in you stat chart. Using capital letters here simply capitalises the text that is displayed. This is the only time you should use upper case instead of lower case for a variable.


#9

@andymwhy: thanks a lot. you solved my problem =)))

Let me ask another question: How can I create a “hidden stat”.
What I want to do is, create a hidden stat that operates but operates hidden.
Now I learned how to create a default stat, but I still don’t know how to hide it.
Thanks to all again.


#10

Declare the variable in the mygame.js, like every other stat, then simply do not place the stat in the choicescript_stats.txt page. It will still function like every other stat, but the player will not be able to see it.


#11

Thanks a lot Aritour.
I will try and then give you a feedback.
Thanks again.


#12

Well it works, thank you by the way.
But I’m having trouble with set stat commands.
It gives me a line error, but increases the stat.
Here’s my code:

*choice
__#Choice 1
____*set uyum +1
____blah blah blah
____*choice
______#Choice 2
________blah blah
________*finish

I want to set the stat “uyum” to 1.
But it gives an error.


#13

What’s the error message?


#14

Here is another example:

*choice
__#Choice 1
____*set uyum +1
____blah blah blah
____*choice
______#Choice 2
________blah blah
________*set acımasızlık +1
________blah blah blah
________*finish

So, " *set uyum +1" works perfect. (Uyum means adaptation)
But below the Choice 2, " *set acımasızlık +1" isnt working (acımasızlık means ferocity)
Here is the error: Invalid expression, couldn’t extract another token: ık +1


#15

Aww, my problem solved.
It seems, mygame.js isn’t working with “ı, ö, ü” words.
So I changed the names of stats.
Thanks again, ScarletGeisha =)))
If I encounter with another problem, I will ask it to you =))


#16

Oh, so it only work with English alphabets.


#17

Yes, I mean I guess it is =))


#18

You should be able to use various commands to still get it to display the characters in the right spots, even if the coding itself is limited to the standard English alphabet.


#19

I’m having the same original problem as Mert…


stats = {
    OnLine: 0
};

is the code I have in mygame.js file.

When I use the *set command in my file:


*choice
	#Most like me
		*set OnLine +2

I get the same error: Non-existent variable “online”.

Now when I define the variable within my scene, I get that error when I hit the “Show Stats” button. And yes, the same variable is in the “choicescripts_stats.txt” file.

I am currently running all this locally through Firefox 13. The sample files work just fine when I run them locally, so why don’t mine? Is it the name of the variable? What else do I need to look at?

Thanks in advance…


#20

@Govmiller, see @andymwhy’s post above. All lower case needed in mygame.js file and scene files, with exception only for stat screen.