So I just started using ChoiceScript today and I’ve already given myself a massive headache. How do I create choice options within choice options. I tend to alright for the first one when I’m just building on top of the example code but after that the whole thing comes crashing down and I find myself in a sea of error messages.
It’s just a matter of getting the indentation correct. That said, for exactly this reason, I’d personally avoid nesting more than two choices deep. Just use *goto with *label to jump to the next choice(s).
I have literally never nested choices. I just use gotos and send it to different labels for the next choice. But no one accused me of being a code wizard.
@Latraytray i feel like the indentation in your example is off. Shouldn’t the orginal, non-nested #options be at the same indentation of the first #option in the *choice?
@hustlertwo is smart. Be like Hustlertwo
(Seriously though I nest choices all the time, and have also forgotten how many times I’ve had to go looking for an error or misdirect because I’ve ended up nesting a dozen different choices at different levels. Using a goto keeps things simpler.)
If you do want to nest, I personally recommend using tabs over spaces. They’re bigger and easier to see where you’ve made a mistake instead of looking for the place where you put 2 instead of 3 spaces. (But that’s up to you.)
A way to avoid nesting is to use *gosubs. If the nesting gets too big you can just use a *gosub and put nested stuff there and simply come back to where you were.
I use this a lot recently and keep them all stored at the bottom of the file. This is very useful for dialogue which has a lot of nesting due to responses to specific options taken by the player and usually long blocks of text. Makes it more organized and less of an eyesore especially when the indentation gets messy.