Trying to save a Name in Quest. [SOLVED]

Seeker9043
01 Jan 2023, 12:19Hello, been a while. I'm currently trying to figure out a way to save names that are input into the game. Now while I know how to set up the code for the game to react depending on the input I can't seem to find a way to save something the player inputted. Is there a line of code I'm missing or is it something else?
mrangel
01 Jan 2023, 22:58I can't seem to find a way to save something the player inputted
To save a variable, you can put it into an attribute. For example, within a text input or menu section, you could include something like:
player.chosen_name = result
This sets the chosen_name
attribute of the object named player
to the value of the result
variable. In any code later on, you can then use player.chosen_name
like any other variable; or include {player.chosen_name}
in a text string that is going to be printed (object's 'look' response, room description, the string passed to a print statement, etc).
(variable names without a dot in last until the end of the script that uses them. With a dot in, they are attributes, and last as long as the object named before the dot exists)

Seeker9043
02 Jan 2023, 03:51I see, I have to use the set variable code to have it work. Got it now, thank you very much (also the text box for it also works too).