Need help with name variables


#1

I’m trying to write a choicescript game, but my progress is halted at the point the player types in their name. Whenever I test it using the index.html file, the name (example: input_text name) doesn’t work. It says that “name is not a variable”. Is there a certain name I have to have for the text variable, or are there some other steps I have to take before a user-input variable works?


#2

@Jeffrey_Boering
create a *name ""
commandsomewhere at the top of your startup file.
To have user input into a variable you should first have created that variable.


#3
*create name "Smith"   
*input_text name

Hello, ${name}, how are you?  

Like that, for example. Put the *create line up at the beginning of your startup file (I added Smith just so there’d be a default), then the *input_text wherever you want it in your story. Then whatever name you’ve typed in as your name will appear as a word in the text of your story so long as you put ${} around it, like I did.


#4

Ok that’s helpful also how do I create genders?


#5

Usually what I do is

*create character1ismale True

And then have a list of variables like possessivenoun1, firstpersonnoun1, nonspecificnoun1, etc to take care of He, She, his and so on changing with gender. If character is male, possessivenoun1 = “his” If female, possessivenoun1 = “her”

Set the variables based on character’s gender, and call the variables whenever you need a his, man, she, etc referenced.


#6