Okay guys. I started teaching myself ChoiceScript ONE DAY AGO so give me a break if it sucks and is super convoluted. I just need help figuring out if/else/elseif and the error message “line 67 of party: It is illegal to fall out of a *choice statement; you must ***goto or *finish before the end of the indented block.”
Line 67 is #Introduce yourself to Bella. under *if (tipsy)
I tried to figure this out on my own and I’m lost. Doesn’t everything have a *goto? Idk if my if and else is messed up but I am jus trying to figure out this stupid line first.
Please be nice to me. I am coding my first practice game just for fun to teach myself how to do this.
*label party1
Blah blah blah example text. What do you do?
*if (tipsy)
#Introduce yourself to Bella.
*set kindness %+5
*goto introduce
*page_break Next
#Grab another drink.
*set intelligence %-20
*set drunk true
*set tipsy false
You grab another beer and chug it. You are now drunk. What do you do?
*choice
#Yell at Bella.
*set kindness %-20
*set lover %-20
*goto yell
#Dance seductively near ${lover_name} to try and get ${lover_pronoun_posessive} attention.
*set lover %+10
*goto dance
#Call an Uber and go home.
*set intelligence %+20
*set lover %-5
You walk out the front door and manage to call an Uber. ${lover_name} walks up to you.
*line_break
*line_break
"Hey, I saw you leave. Are you okay?" ${lover_pronoun_subject_cap} asks.
*line_break
*line_break
You hiccup in response.
*line_break
*line_break
blah blah dialogue blah blah
*page_break Next
*goto_scene blahexample
*else
#Introduce yourself to Bella.
*set kindness %+5
*goto introduce
*page_break Next
#Give up and go home.
*set lover %-5
You walk out the front door. ${lover_name} exits after you and calls your name.
*line_break
*line_break
"${player_name}? Why are you leaving?"
*line_break
*line_break
"I'm not feeling up partying anymore, ${lover_name}. Thank you for inviting me," you respond graciously.
*line_break
*line_break
${lover_name} looks disappointed. "Okay, get home safe. See you tomorrow."
*line_break
*line_break
You head home and fall promptly asleep.
*page_break Next
*goto_scene blahblahexample
Also the page_breaks should got before the gotos and double linebreaks are not necessary. I don’t know if they still mess with screenreaders but they used to
Another thing to consider is that you don’t have to divide this into if/else.
*choice
# Introduce yourself to Bella.
*set kindness to %+5
*goto introduce
*if (tipsy = true) # Grab another drink
etc
*if (tipsy != true) # Give up and go home.
etc
(Note: I know some people have problems doing inline IFs on choice options, but I’ve not so ymmv. I think some people do it on separate lines? idk).
If you introduce yourself differently if you’re tipsy or not, multireplaces are the best.
"Hi, nice to meet you!" you @{(tipsy) say, slurring your words.|say brightly.}
(Probably didn’t need to repeat ‘say’ but I like doing so if the punctuation immediately after the word changes; just helps me see what’s happening).
As for line breaks…
Doing something like this
will lead to this outcome.
Doing something like this will lead to this outcome.
While doing this instead
leads to this outcome.
While doing this instead
leads to this outcome.
This is most important to remember when using gotos and gosubs. They don’t add a line break, so…
Doing something like this
*goto next
*label next
leads to this outcome again.
Doing something like this leads to this outcome again.
So it is important to add a line or page_break after every label line.
You never need *linebreak, *page_break Next is completely identical to *page_break, and the code can’t reach anything underneath a *goto because it’ll get sent to a different part of your document first.
So weird. No, I don’t use implicit control flow. I like knowing exactly where my story is going and not having to worry about it flowing to somewhere I didn’t intend. I have tried using it, but hated having to track my flow through conversations. So much easier just telling the story where to go.
VSCode even flags the lack of parens as an error now.
Regardless, the original point stands – using *if on choice options is more efficient and ensures you don’t have to re-write options across different if/else blocks.
Parentheses would be my first guess, but I wonder if it’s a hardware/software issue? Outdated version of CS/CSIDE/Node, some weird interaction with Windows? Perhaps after a certain file length or project size CS bugs out?
I’ve literally never had an inline *if break on me in the hundreds of times I’ve used them, though I’ve only done small projects.
I don’t doubt it’s a real thing, but I’ve never been able to reproduce it. The code here and here (once put in parentheticals) works fine for me and passes Quicktest and Randomtest.
Nope. When I’ve done inline if, I’ve always used parentheses properly, just like with *selectable_if (which works fine). I didn’t use parentheses in the example above because they weren’t needed in that case, and using the minimum necessary parens is my general habit.
Never figured out why an inline if would periodically crash and other times work fine. But avoiding it is easy enough that I’ve never dug deep into what might be causing the problem. I don’t encounter the problem now because of not using inline if, so can’t offer anything for your potential replication.
The forum threads are evidence that other people have run into the problem, but I don’t remember ever seeing an account of why it might happen, or Dan pushing a fix.
Yeah, it’s just weird. I used to use inline if, and it didn’t always break the autotesters – but it did just often enough that I stopped, and randomly enough that I couldn’t figure out a cause.