Code is telling me nonexistent variable, but the variable works in other places?

  *hide_reuse #"I was hoping to get to know you, actually." 
    *set AaronHobby 1
    *if (Hobby = Games)
    *if (Hobby = Exercise)
    *if (Hobby = VideoGames)
    *if (Hobby = Reading)
    *if (Hobby = Baking) 
    *goto AaronChapel

Code, removed the text it concerned.

The one not working is Exercise. I don’t know why but my quicktest is telling me that it doesn’t exist.

are you trying to compare two variables or a variable to a string? (is Exercise a variable, or a value - “Exercise”)

Hobby is the variable. I’m just using whatever Hobby is set to, to display variable text. For some reason my quicktest says “non-existent variable - exercise” but I don’t think that exercise is even a variable in this code…

That’s why you get the error, because it’s not. When you want to compare the contents of a variable with a text, you have to wrap it in “”.

*if (Hobby = "Exercise")

Weird. I must have done some voodoo then because quicktest wasn’t pinging on others without “” that are way further up. But yeah that fixed it.

1 Like

Also thank you. Apologies for my rudeness. I am multitasking.

1 Like

That means that Games is a variable somewhere in your code and it might cause a bug in the future. All of the values you are comparing in this use case should have “” around them, since you are checking the value and not the contents of another variable.

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