I’m having trouble with… non-existent variable “name”
The error I’m getting is:… non-existent variable “name”
My code looks like this:
*label character
What is your name?
*input_text name
Nice to meet you, ${name}, what is your gender?
*choice
#male
*set gender "male"
*set pronoun "he"
*if ("gender" = "male")
*set pronoun "him"
Would you be seen as traditionally ${gender}?
*choice
#no, some may see me as female.
*set tg "female"
*set tgpro "she"
*if ("tg" = "female")
*set pronoun "her"
#yes,
*set tg "male"
*set tgpro "he"
*if ("tg" = "male")
*set pronoun "him"
*finish
#female
*set gender "female"
*set pronoun "she"
Would you be seen as traditionally ${gender}?
*choice
#no, some may see me as male.
*set tg "male"
*set tgpro "he"
*if ("tg" = "male")
*set pronoun "him"
#yes
*set tg "female"
*set tgpro "she"
*if ("tg" = "female")
*set pronoun "her"
*finish
I already did the:
*scene_list
startup
name
character
scene1
*create name “unknown”
*create gender “unknown”
*create pronoun “unknown”
*create tg “unknown”
*create tgpro “unkown”
within startup
Also, Im hoping to figure out how to do conditional readable text. Something like: *if (“dead1” = “true”) ${memorytext1} if that makes sense whatso ever. Or would it just be easier to do *goto_scene and create alternative scenes for added text? Definitely not the most tech savvy haha
I’ve read the provided snippet but i didn’t spot any problem that should give you that error
About your second question conditional readable txt do you mean something like this ?
*create dead1 false
*create memorytext1 “I remember something important.”
Would I also need to *create dead1 true then as well? Say… I want to create a mechanic for allowing memories of future events. So when the player reaches a certain point or reads a scene multiple times, It would track it as a hidden stat, and then provide additional text and description in the scene.
So a death would have both a normal game end and restart, but also a false end reset to the beginning with previously hidden choices and scenes/text.
Hopefully that makes sense.
You are confusing me but I think there might be an issue with the indentation in your code make sure that the lines following the *label and *choice commands are indented properly or copy this and tell me if it works
*label character
What is your name?
*input_text name
Nice to meet you, ${name}. What is your gender?
*choice
#male
*set gender "male"
*set pronoun "he"
*if (gender = "male")
*set pronoun "him"
Would you be seen as traditionally ${gender}?
*choice
#no, some may see me as female.
*set tg "female"
*set tgpro "she"
*if (tg = "female")
*set pronoun "her"
#yes
*set tg "male"
*set tgpro "he"
*if (tg = "male")
*set pronoun "him"
*finish
#female
*set gender "female"
*set pronoun "she"
Would you be seen as traditionally ${gender}?
*choice
#no, some may see me as male.
*set tg "male"
*set tgpro "he"
*if (tg = "male")
*set pronoun "him"
#yes
*set tg "female"
*set tgpro "she"
*if (tg = "female")
*set pronoun "her"
*finish
ensure that the indentation is consistent, with each level of indentation represented by four spaces or a tab character. If you still encounter the error after correcting the indentation
There two thinks you have to do
Make sure that the *create command for the “name” variable is placed before the *label character section. Ideally it should be located in the startup txt file or in a scene that is visited before the “character”
Confirm that there are no typos or spelling errors in the variable name. Ensure that the variable name is consistently spelled as “name” in both the *create command and the *input_text command.
If you have verified these aspects and the issue still persists provide a larger portion of your code or the entire “character” section so that I can assist you better in identifying the root cause of the error
So, I figured that part out. The issue was the indention on startup apparently. Though now im running into issues right after lol. I’m unsure of how to show more. I’m not too tech savvy, and ctrl c/ctrl v doesn’t seem to work too well for indentions, much less so for more than one line at a time. I have attempted to send a screen shot, but it tells me I am unable to embed media items.
*label character
What is your name?
*input_text name
Nice to meet you ${name}, what is your gender?
*choice
#Male
*set gender "male"
*set pronoun "he"
*if (gender = "male")
*set pronoun "him"
#Female
*set gender "female"
*set pronoun "she"
*if (gender = "female")
*set pronoun "her"
#Non-binary
*set gender "non-binary"
*set pronoun "they"
*if ("gender" = "non-binary")
*set pronoun "them"
Would others see you as tradit ionally ${gender}?
choice
#Yes
*if ("${gender}" = "male(yes))"
*set sex "male"
*if ("${gender}" = "female(yes))"
*set sex female"
*finish
#No
*if ("${gender}" = "male(yes))"
*set sex "female"
*if (${gender}" = "female(yes))"
*set sex "male"
*finish
*if ("$gender}" = "non-binary(yes))"
*set #choice
*male
*female
*finish
So I typed everything out again, this is what I got at the moment. I’ve moved things around a lot with trial and error. I can’t get anything to work when I start adding conditions, unsure if that is the correct term for it, the orange words. I did, however, get it to work if I did not add anything in the scene after:
Nice to meet you ${name}, what is your gender?
*choice
#male
#female
#non-binary
*finish
Definitely finding this a little confusing so far, because this:
Nice to meet you ${name}, what is your gender?
*choice
#male
#female
#non-binary
*finish
*if (gender = "male(yes))"
*goto_scene hello
*if (gender = "female(yes))"
*goto_scene startup
new error, now it is just saying “line 7 of character: Ivalid indent? expected #option here, not *set.”
I was able to fix the name error, I had indents on my start up for the *create commands, but after removing the auto indents on them, the “name” error was fixed.
Your indents are incorrect. Every choice # should be in line with the other choices.
For example
*choice
#Choice one.
*goto next_scene
#Choice two.
*goto next _scene
I notice you get the indentation right earlier in the post but it was wrong in the last code in the box. Can you double check how it is in your actual code?