Help with coding

Two sets of resources you’ll find helpful for navigating choice script are:
Main documentation for choice script and the master list of various links, guides and so forth.

If you’re new to coding then this is a lot of information to read, internalise and then start using in your game. I would recommend starting very small (don’t even try and code your story idea yet, just think of the sorts of things you want to do and make a simple scene that does one of those things). You identified a great starting place: giving the player the ability to choose their name.

The tutorials in the master list I linked will cover this kind of thing, similarly the documentation will also list the code for presenting an input text box and storing that value as the player’s name. The best approach is to have a clear idea of simple thing you want to achieve and then read through the documentaiton to find the specific code you need to achieve that (in your case, you’re looking for the input text code).

I would expect a good starting place for you is to try and figure out producing things like this:

*create player_name "Unknown"

After looking at the documentation I have figured out how to present an text input box.
I will store the text that the player types into my 'player_name' variable I created just above.

*input_text player_name

Now that the player has chosen a name for themselves, I want to use it to talk to them.
I can print the value of my player_name variable like this:

Hello, ${player_name}

You can just copy and paste the above into a text file and run it as a game to see how it works.
I’d try out little experiments like this whilst you get to grips with how choices, variables and flowing between scenes works.

4 Likes