Basic *choice problems


#1

I’m very very new with choicescript and I decided to do some testing of my own in order to get used to the scripting. However I’ve been struggling to not to get errors on the very first choice. A pop up would show up saying " It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block".

For instance, nothing will show up and everything is fine. After finishing a few other things for example reaching line 18, and then check on the index, a pop up would say that line 12 is having issues. I thought that it would usually say that line 18 would have issues because it is the recent one I’ve added but it doesnt seem to be the case. I’ve rewritten the choices a couple of times thinking that I accidentally hit space anywhere but it still showed the same pop up. The indents are lined up perfectly and I’m pretty sure theres nothing wrong with the way I used the commands since it’s just the very basic stuff.

Here is what I have:

*choice
#You rose an eyebrow in surprise
You didn’t think that anyone would have a luggage that heavy in their suitcase. You wonder what on earth is inside.
#You couldn’t help but chuckle
With the way he looked, you’d think he would know the Airport regulations. As they say, you can’t judge a book by its cover.
#You looked at your own luggage with concern
You hope that you didn’t exceed the weight limight. The thought of being in that man’s shows didn’t seem like a good thing to you.
#You looked somewhere else, loosing interest
Things like this happen all the time. Though you wished it didn’t happen during this long line up.
#You sighed impatiently as you looked at your watch
The guy is holding the line up. He should learn not to waste people’s time by doing something simple such as making sure that his luggage didn’t weigh that much.

I read the wiki of cog, trying to learn how the scripting works and it recommended me to use Notepad++ and that is where I’ve written this stuff on. I also used firefox to show the game itself since it was also recommended. So while I had no errors after typing up the second choice, after I’ve added the fourth choice, that’s where I started having problems. I’ve been trying to rewrite it over and over again thinking it’s just the slip of my fingers but from what I’ve learned with this *choice stuff, what I did seems right to me. Notepad++ shows that the indention is lined up with the choices so I just don’t understand how it’s giving me an error!!

It’s driving me nuts that I can’t even seem to make *choice work properly. Some guidance would help very very much. :disappointed_relieved:


#2

I realized it may have something to do with the *finish command but I’m not sure. Then again I’ve been reading the wiki for three hours before trying to attempt this at 1 am but I’m just frustrated with it.


#3

*choice
  #You rose an eyebrow in surprise
    You didn’t think that anyone would have a luggage that heavy in their suitcase. You wonder what on earth is inside.
    *goto label <variable>
  #You couldn’t help but chuckle
    With the way he looked, you’d think he would know the Airport regulations. As they say, you can’t judge a book by its cover.
    *goto label <variable>
  #You looked at your own luggage with concern
    You hope that you didn’t exceed the weight limight. The thought of being in that man’s shows didn’t seem like a good thing to you.
    *goto label <variable>
  #You looked somewhere else, loosing interest
    Things like this happen all the time. Though you wished it didn’t happen during this long line up.
    *goto label <variable>
  #You sighed impatiently as you looked at your watch
    The guy is holding the line up. He should learn not to waste people’s time by doing something simple such as making sure that his luggage didn’t weigh that much.
    *goto label <variable>

With each choice made you must tell the script where to go. (*goto command in the choice body above) That is either a label or the finish.

If you want to finish the scene just type: *finish where my *goto command is above but without the destination label.


#4

If you use the *choice command you need to finish each section with a *goto

Try using *fake_choice, then the text will continue below the choice.

So use *choice if you want choices that end up in different places.

*fake_choice if you want them to go to the same place.


#5

I suspect this may be a contributing factor. Still, I’ll try to explain the logic of why it’s doing what it’s doing, instead of simply trying to rewrite your code. I can’t guarantee I’ll explain anything more clearly than the wiki did—it’s quite late for me as well.

Normally, ChoiceScript starts reading the code at the top of the file, and works its way down, reading each line of code in order from top to bottom. This behavior is what ChoiceScript error messages call “falling out”. It’s normally okay, but sometimes it isn’t.

Commands such as *goto or *finish change this; they send ChoiceScript to read a specific part of the code, even if that code isn’t in order. You could say these commands “redirect” the code. There are a few others as well.

The *choice command must feature one of these “redirecting” commands indented under every single #option, or else it won’t work. (It doesn’t actually need to be the same command for each #option. You can mix and match.) Without a line of code to explicitly tell ChoiceScript which line of code to read next, it will try to “fall out” to the next line in order… but that’s not allowed under a *choice.

It is allowed under a *fake_choice, however.

The easiest way to adjust your current code is probably to replace *choice with *fake_choice. That doesn’t mean you can’t take the extra time to add *goto commands to each #option, and then take some more time to create *label statements so every *goto is pointing in the right direction. That would let you keep using *choice here. But in this situation, *fake_choice will likely be easier.

I should probably learn to shorten my replies. I think I just used a mess of extra words to repeat what @Eiwynn and @malinryden just said.


#6

Let me answer you with this simple sketch of how *choice command work

Sketch

As you can see, to keep your story move forward after *choice, you’ll need to stick either *finish or *goto command at the end of each #Option.

Or else, you’ll encounter the


#7

I’ll have to really keep that in mind. Seeing how it works helps, thanks!


#8

The diagram helps so much compared to looking at the lines for me so thanks!


#9

Any information helps me even if you have to write a book of these things, I’d still read it. Thanks for the detailed info!