Hello, everyone!
I’m new to ChoiceScript and have a fairly simple question:
Is it possible to use if/elseif/if with more than three options, and, if so, how does that work?
Thank you!
Hello, everyone!
I’m new to ChoiceScript and have a fairly simple question:
Is it possible to use if/elseif/if with more than three options, and, if so, how does that work?
Thank you!
Do you mean like
*if (((strength=1) and (dexterity=1)) and (stamina=1))
Stuff
Oh, sorry. Let me explain better. I mean more like:
*if blah
this
*elseif blee
that
*elseif bloo
the other thing
*elseif blech
this last thing
(Also, how do you write code so the forum doesn’t auto-format it?)
Yeah you can do as many of those are you like. There’s no limit. I generally don’t use elseif though, but that’s just me. It might help if you use the actual example of what you’re trying to do.
What I generally do, if I’m stuck is plug the code into https://dl.dropboxusercontent.com/u/7840892/CJW/choicescript/tools/online-cs-tester/mygame/input.html and keep fiddling with it until it does what I want it to.
To write code do < pre> at the start and < /pre> at the end with no space.
Thank you so much! That test link helped me diagnose the problem which actually had nothing at all to do with elseif. I keep learning as I go!
I’m so glad to hear it. The online tester helps me so much as well. I use it for troubleshooting until something works.
http://www.choiceofgames.com/forum/discussion/1213/tool-online-choicescript-tester is the thread. I think CJW fixed the side by side version which is even more useful.
@FairyGodfeather
There’s a Choicescript tester? o_e
Totally going to use that for about…everything.
@Mystogan Yeah, CJW made it. It’s amazing. Please do post on the thread and tell him how great it is.
One thing to remember if you’re using *elseif and *else is that each option needs to end in a *goto command. So:
*if blah
this
*goto wah
*elseif blee
that
*goto wee
*elseif bloo
the other thing
*goto woo
*else blech
this last thing
*goto wah
with wah, wee, and woo referring to *labels elsewhere in the game.