First Error Message


#1

This time, I’m struggling with errors regarding my stats. I am using CSIDE on Windows.

I clicked the arrow to run the Project. Then I clicked the “Show Stats” button and then I selected Inventory. My stats screen is giving me the error “non-existent variable.” But I have the variables listed and set in my startup.txt. I’ve tried it a few different ways, and I’m still getting the same message.

This is what it is currently:

Stat Screen ~

*label screen
*choice
------ #Inventory
-------------*stat_chart
------------------- text Ingredients

Startup.txt ~

*create Ingredients
*temp Ingredients 0

I’ve tried it this way:

Startup.txt ~

*create Ingredients
*set Ingredients 0

and

*create Ingredients 0

(There are more variables under Ingredients, and I assume they would show the same error.)

And still it’s showing “non-existent variable” on my stats for Ingredients. I can’t see what I’m missing, so any help would be greatly appreciated!!

EDIT: The dashes are not in my coding. They indicate indentation.


#2

Just to get the obvious out of the way, are you being wholly consistent as to the capitalization of “Ingredients” throughout?

Also, “create Ingredients” won’t do anything–if you want it to be numerical, then

is fine.

But if you want it to be a string, you have to say something like *create Ingredients “mandrake” or *create Ingredients “none” or even *create Ingredients “”

Finally, remember that you have to *create everything before you start *setting stuff.


#3

You need to specify a starting value for the variable Ingredients.


#4

@Gower

I used *create Ingredients 0 and it said error. I want the variable to be Ingredients. Ingredients is the variable.

@EclecticEccentric So . . . I can’t start the variable at zero? I wanted it to start at zero and go up and down throughout the game as ingredients are found/used. I want the variable Ingredients to be numerical.

I’ve also tried

*create Ingredients 5

and that showed non-existent variable as well.


#5

Can you copy your code exactly and wrap it in [code][/code] tags? For both scenes.


#6

You can start the variable at 0:

*create Ingredients 0

Where in the file did you put this, or which .txt file did you put it in?


#7

@EclecticEccentric @CJW

The *create Ingredients 0 is in the startup.txt. At the top below the title and author name:

*title 
*author 
*finish

*create Ingredients 0

And then the stat chart code is like this:

*label screen
*choice
	#Inventory
		*stat_chart
			text Ingredients

#8

That *finish needs to come after you’ve declared the variable.


#9

OH MY GOSH

I was so focused on everything else I completely missed that!! I think that would make sense to have *finish where it belongs XD

Thank you so much ~


#10

It’s always good to post all your code whenever you can (though this obviously gets difficult with full games). Errors are very often caused by code unrelated to where the error is actually occurring. I’m glad this one easy to solve for you. Enjoy! :slight_smile: