Choicescript code error help!


#1

I keep getting an error on line 8 and I need help please! No matter what I do it keeps telling me I need a goto or a finish, but I DO have a goto and it doesn’t even work. This is frustrating!

Out in the hall, you ponder where to go next.

*label hallway

*choice
  #Enter Commander Sorbel's quarters
    You enter the commander's quarters, and find them relaxing. "Would you like to join me?"
    #"No thanks."
    *goto hallway
  #Enter Almaran's quarters
    You go into Almaran's quarters and find him in his armor, checking his blades. He looks up at you and smiles. "What?"
    #"Nothing."
    *goto hallway
#Go to the hangar.
  *goto hangar_choice

*page_break

*label hangar_choice
*choice
  #Get in a ship and fly to Earth.
    *goto_scene yfn3-1

I need help with a scene please, it's frustrating me!
#2

What you have on line 8 is #“No thanks.” Is this meant to be part of another choice? You can’t have a # thing floating without a *choice or *fake_choice command above it.

If I’m understanding correctly, the MC replies “No thanks” to Commander Sorbel, so I would code it like this:

*choice
 #Enter Commander Sorbel's quarters
  You enter the commander's quarters, and find them relaxing. "Would you like to join me?"
  
  "No thanks."
  *goto hallway

Because what’s happening is that it’s not recognising the floating # you have so doesn’t understand that *goto hallway command is part of the first choice.

Edit: if your intention is to let the player have a second set of choices with the “No thanks” part, you could do something like:

*choice
 #Enter Commander Sorbel's quarters
  You enter the commander's quarters, and find them relaxing. "Would you like to join me?"
  
  *choice
   #"No thanks."
    *goto hallway
   #"Of course."
     *goto join_sorbel

and so on. Additionally, I don’t think your #Go to the hangar choice is indented the same as the others.


#3

I wonder if the indentation is messing you up. What I means is “*goto hallway” needs to be indented further than #“No thanks.” I can’t tell if your file is literally like what shows in the post or not. (Also, “#Go to the hangar.” need to be indented.

Also, if you are trying to do choices imbedded inside other choices, there has to be another “*choice” on the second level. What I mean is that if you have a choice after “Would you like to join me?”, you need to say “*choice” there.

Anyhow, if I were you, I would try to write a simple single level choice first, get that working, then add the second level…I find that by writing a bit first, getting that working, then making it more complex, it’s easier to fix the errors. Good luck!


#4

Hi, I just got this today and started making a CYOA game, and I’ve gotten the hang of most of the basics, I guess, but I’m stuck now at a part that’s frustrating me because I just cannot make it work!

It keeps telling me this, no matter what I do! “yfn2-3 line 8: It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block.”

Out in the hall, you ponder where to go next.

*label hallway

*choice
  #Enter Commander Sorbel's quarters
    You enter the commander's quarters, and find them relaxing. "Would you like to join me?"
    #"No thanks."
    *goto hallway
  #Enter Almaran's quarters
    You go into Almaran's quarters and find him in his armor, checking his blades. He looks up at you and smiles. "What?"
    #"Nothing."
    *goto hallway
#Go to the hangar.
  *goto hangar_choice

*page_break

*label hangar_choice
*choice
  #Get in a ship and fly to Earth.
    *goto_scene yfn3-1

Please can someone help me figure out what’s wrong, of it’s just broken? I don’t get why it’s telling me to put a goto or a finish command when I clearly have one! And why won’t THOSE work, and jump back up to the hallway like it’s supposed to? That’s how the tutorial said they work, right?


#5
[quote="vessynessy20, post:1, topic:35244"]
Out in the hall, you ponder where to go next.

*label hallway

*choice
  #Enter Commander Sorbel's quarters
    You enter the commander's quarters, and find them relaxing. "Would you like to join me?"
    *goto SOMEWHERE
  #"No thanks."
    *goto hallway
  #Enter Almaran's quarters
    You go into Almaran's quarters and find him in his armor, checking his blades. He looks up at you and smiles. "What?"
    *goto SOMEWHERE
  #"Nothing."
    *goto hallway
  #Go to the hangar.
    *goto hangar_choice

[/quote]

Some funny spacing and 2 missing *gotos, I think. :slight_smile:


#6

With those spaces, you might have been trying for some nested choices, like this?

[quote="Lucid, post:2, topic:35244"]
*label hallway

*choice
  #Enter Commander Sorbel's quarters
    You enter the commander's quarters, and find them relaxing. "Would you like to join me?"
    *choice
        #"No thanks."
            *goto hallway
        #”Sure.”
            *goto SOMEWHERE
  #Enter Almaran's quarters
    You go into Almaran's quarters and find him in his armor, checking his blades. He looks up at you and smiles. "What?"
    *choice
         #"Nothing."
            *goto hallway
         #Somehing else
            *goto SOMEWHERE
  #Go to the hangar.
    *goto hangar_choice
[/quote]

#7

Thanks! I got it figured out yeah, I needed to add a second *choice inside the first *choice. :slight_smile: