hello! so i’ve been trying to learn choicescript these past few days, and wanted to try my hand at making different branches. however, when i try to choose an option, the resulting text becomes like this, for every choice:
Summary
this is embarrassing but what exactly am i doing wrong here?
I’m not sure what you’re trying to do here? You cannot use “gangel” to check the previous choice, because you’ve just used that variable to store the name. So if you want to later on be able to know which angel the player got, you should check by name.
Therefore, none of your conditionals are actually being entered (gangel is never any of the values you look for, at this point) so I guess that what’s happening is that the flow resumes at the first label and then just goes down from there.
Here’s what I would try:
*choice
#a man
*set gangel "michael"
*goto gangel_chosen
#a woman
*set gangel "gabriel"
*goto gangel_chosen
#you're not sure...
*set gangel "uriel"
*goto gangel_chosen
*label gangel_chosen
Congratulations, you have your own guardian angel now!
*if (gangel = "michael")
*goto guardian_chosen1
*if (gangel = "gabriel")
*goto guardian_chosen2
*if (gangel = "uriel")
*goto guardian_chosen3
*label guardian_chosen1
abcd
*goto resume
*label guardian_chosen2
efg
*goto resume
*label guardian_chosen3
hijk
*goto resume
*label resume
This is where everyone gets the same text again.
Note that you need to have *goto inside the labels, else if you send the player to the first label they will get the second and third as well. Also note that this only makes sense if you’re going to have some sort of text that remains the same regardless of choice inside *label gangel_chosen; otherwise, you can just put the *goto commands for each angel inside the choice itself, which is much simpler.
You can also write whatever goes inside *label guardian_chosen1, *label guardian_chosen2, and *label guardian_chosen3 inside the if, rather than have the goto. This is what I would do if I were writing this scene, myself, but it’s a matter of preference.
Edit: Also forgot to say that you can have that structure as if…elseif…else, rather than if…if…if…. It’s not very important, but we programmers are just picky like that.