Hi! I just got into coding using ChoiceScript, and I’m getting the hang of some of it. But I was wondering…
Say there is a choice where the player can pick a pet and name it. In later scenes, it is possible to refer to which specific pet they chose in the text (not an option)? Like if they chose a cat, then in a paragraph I write about him petting the cat/dog/insert pet here. Is that possible without having to write different scenes for just that one word?
Absolutely! Basically, when you *create a variable at the beginning, and then later *set the value, all you have to do is type ${variablename} and the value of that variable will display.
Thanks so much for the answer! It’s not leading to the next scene, though? For example, this is my choice I had before:
*choice
#Be polite.
*set social +5
#Be suspicious. The Ministry must have found out, and sent their best wizard to deal with you!
*set oblivious -5
#Drop your eyes to the ground and nod silently.
*set social -5
*goto scene1
*label scene1
Which pet would you like?
*choice
#Cat
*set pet "cat"
#Dog
*set pet "dog"
*goto scene2
*label scene2
You pet your ${pet}.
(Or I tried the:)
*choice
#Be polite.
*set social +5
#Be suspicious. The Ministry must have found out, and sent their best wizard to deal with you!
*set oblivious -5
#Drop your eyes to the ground and nod silently.
*set social -5
*goto_scene pet
(And in a txt file I called "pet")
Which pet would you like?
*choice
#Cat
*set pet "cat"
#Dog
*set pet "dog"
*goto_scene paragraph
(In a file called paragraph)
You pet your ${pet}.
(I see that the reply is not adding spaces. I have 2 spaces in front of #, and 4 spaces in front of *)
Oh sorry, I assumed you knew how choice commands work. You need to have a goto or finish in each branch, unless you use the fakechoice command. So
Which pet would you like?
*fake_choice
#Cat
*set pet "cat"
#Dog
*set pet "dog"
*goto scene2
alternatively
*choice
#Cat
*set pet "cat"
*goto scene2
#Dog
*set pet "dog"
*goto scene2
Also
How to format your code so it can be seen on the forum.
Paste code into window.
Highlight all of the code.
Click the preformatted text button. (It looks like </> and is next to the quote one and on the same bar as the other formatting and smilies choice.)
Click reply.