Non-existant variable help!

So I’ve been getting the non-existant variable and I can’t seem to see the problem. I’ve checked the spelling and changing it to lower case but that doesn’t seem to solve problem

So this is the variable part in the start up screen

*create weapon "?"

This is the code from the actual game.

*choice
	#Sword
		*set weapon "sword"
		*goto training
	*selectable_if (fitness >55) #Axe
		*set weapon "axe"
		*goto training
	*selectable_if (smarts >55) #Tome
		*set weapon "tome"
		*goto training
	*selectable_if (confidence >55) #Lance
		*set weapon "lance"
		*goto training
	*selectable_if (artistic > 55) #Bow and Arrow
		*set weapon "bow and arrow"
		*goto training
*label training
You pick up the ${weapon} and go and start practicing against some wooden figures.

If anyone can spot something that’s wrong that I missed that would be great thanks.

Try changing it to

*create weapon ""

And see if the error persists.

It still seems to be there.

What did the error says?

Are you sure the error is referring to ${weapon} and not one of your other variables?

There error is Non-existent variable ‘sword’

It sounds like you’ve got ${sword} somewhere in your code, or else something like *set sword

1 Like

Yep, you used [sword] instead of [weapon].

The error should also give you the line number.

There doesn’t seem to be anything in the code that matches what you are saying.

*choice
	#Sword
		*set weapon "sword"
		*goto training
	*selectable_if (fitness >55) #Axe
		*set weapon "axe"
		*goto training
	*selectable_if (smarts >55) #Tome
		*set weapon "tome"
		*goto training
	*selectable_if (confidence >55) #Lance
		*set weapon "lance"
		*goto training
	*selectable_if (artistic > 55) #Bow and Arrow
		*set weapon "bow and arrow"
		*goto training
*label training
You pick up the ${weapon} and go and start practicing against some wooden figures. After a few minutes you hear someone come up behind you, you turn around to see Ike standing behind you. "You're really good using the ${weapon}." Ike says. "Thanks, and to think it's my first time using it." You answer
*if weapon = sword or weapon = tome or weapon = bow and arrow
"If you would like I could give you some lessons. So you can get better." Ike says. 

I think it should be around where it says “You pick up the ${weapon}” but I don’t see anything wrong. So is there anything that I’m missing.

Heres your problem–your if statements aren’t formatted properly. They should look like this:

*if (((weapon = "sword") or (weapon = "tome")) or (weapon = "bow and arrow"))
  Indent the text you want to appear under this if statement
4 Likes

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the @moderators.