inkle / ink

inkle's open source scripting language for writing interactive narrative.
http://www.inklestudios.com/ink
MIT License
4.07k stars 488 forks source link

Allowing A Player To Name Their Character #915

Open egyptthecreator opened 2 weeks ago

egyptthecreator commented 2 weeks ago

Discussed in https://github.com/inkle/ink/discussions/914

Originally posted by **egyptthecreator** September 14, 2024 I want to allow a player to pick their name for the duration of a playthrough. Is there a way to create a text box that flags the player's input as a variable to recall throughout the story?
michaeloa commented 15 hours ago

premek's answer is the correct one.

The way I'd typically do something like this would be to create an external function (of the "action" variety - i.e., not lookAheadSafe) which then is bound to code that will pop up an edittext dialog. You'll have to stop the story flow, of course.

Once the dialog has been closed, extract the chosen name from the dialog, set the name variable in your Ink story, and then continue processing the story.