I can't find the error?

Hello! I’m fairly new to choicescript and decided to make a test game. When I tried running it through quicktest i get this error:
Error: ghost line 72: It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block.
This should be the line it refers to:

#Problem line
–some text
----*set var1 +5
----*page_break
----*if (var1>9)
------*goto end1
----*elseif (var1<10)
------*goto badend

I tried tacking on a “*finish” or a “*goto_scene ending” but it didn’t seem to work. Is there something really obvious I’ve missed? Thanks in advance!

@lenkaiscool I don’t suppose you could paste the actual *choice in question?
Be sure to wrap it in < pre> < /pre> tags, minus the spaces.

Edit. At a guess though, I’d say the issue is that you’re trying to insert a page break in the middle of a *choice.

Do’h! Sorry! :frowning: It was just very long… Here it is:


*choice
  #choice 1
    some text
      *set var2 +5
    *page_break
    *if (var2>9)
      *goto end2
    *elseif (var2<10)
      *goto badend
  #This is the problem line!
    Some text
    *set var1 +5
    *page_break
    *if (var1>9)
      *goto end1
    *elseif (var1<10)
      *goto badend
  #choice 3
    some text again
    *set var3 +5
    *page_break
    *if (var3=15)
      *goto reallybadend
    *elseif (var3>=10)
      *goto end3
    *elseif (var3<10)
      *goto badend

I don’t know why it does the
thing, it doesn’t look like that when I type it :frowning:

The page breaks have worked in other choices though, and taking them out did nothing :confused:

edit:
The same error shows up even if I only do this:


*choice
  #choice 1 works perfectly fine for some reason, even though it's coded just like the other choices...
  #choice 2
    Some text
    *finish

Try putting the *goto command on a new line.

Is the *goto badend on the same line as *else if? If so that is the problem. If its not try replacing the second *else if with just *else

@fantom @nocturnal_stillness
Thank you both for being patient and answering me! The *goto command is on a new line, I don’t know why it shows up like that when I copy it to the forums :confused:

Try replacing the 2nd *elseif with just *else and see if that works.

For example


*choice
    #choice one
        *if var >15
            *goto win
        *elseif var >10
            *goto draw
        *else
            *goto lose

@nocturnal_stillness
Yeah, I tried that too, but it didn’t seem to work either. There’s something wrong with the last two choices, but I can’t tell what. I don’t have time to work on this anymore today though. Thank you both so much for taking a look and offering your input! :slight_smile:

This runs in Firefox and also passes quicktest, as far as I can tell:

*create var1 10
*create var2 1
*create var3 0

This is a choice.

*choice
  #choice 1
    some text
    *set var2 + 5
    *page_break
    *if (var2 > 9)
      *goto end2
    *else
      *goto badend
  #This is the problem line!
    Some text
    *set var1 + 5
    *page_break
    *if (var1 > 9)
      *goto end1
    *else
      *goto badend
  #choice 3
    some text again
    *set var3 + 5
    *page_break
    *if (var3 = 15)
      *goto reallybadend
    *elseif (var3 >= 10)
      *goto end3
    *else
      *goto badend
      
*label end1
This is the first ending.
*goto ending

*label end2
This is the second ending.
*goto ending

*label end3
This is the third ending.
*goto ending
    
*label badend
This is a bad end.
*goto ending

*label reallybadend
This is a really bad end.
*goto ending

*label ending
*finish

It’s actually your first choice in the original code that quicktest seems to be failing at (I think because of this?), so fixing all the choices to end with *else as @Nocturnal_Stillness suggested does the trick.

Ah, thank you so much! Everything goes smoothly through quicktest now. Teaches me not to code at 3am I guess.
(Since the issue has been resolved, a mod can feel free to close the discussion)