It is illegal to fall out of a *choice statement

I was doing some coding for my game, but I keep running into an error mentioned above. Since I am coding several furnitures for the kitchen, it would be useful to clarify where the room 1 line 20 error is coming from.


*temp room_1 true
*temp FridgeDoor false
*temp PantryDoor true
*temp StoveOven true
*set room_count +1
*label room_1
You travel to the kitchen and observe the food within the fridge as 
it hums constantly. If you squint carefully, you can see the metal 
hinges of the fridge squeak as the liquids slosh in their individual 
containers. You headtilt.
*choice
 *if (FridgeDoor = false)
  #Go through the fridge door

    You phase through the fridge door as cold air streams out in frosty 
waves. You would be sensing the temparature of the fridge drop. You gaze
 around to see if the fridge door is open and grab a carton of cold 
milk. You start gulping the milk down as you hear a splash...
    *finish	
 *elseif (FridgeDoor = true)
  #The door is already open...

    The door is already opened from the inside but you manage to see a 
white puddle of milk from where you drank the whole carton. You smirk 
and continue to wipe your mouth delicately with your sleeve.
    *finish
  #Check if the stove is on.
 *if (StoveOven = true)
  #The stove is not turned on!
    You turn on the stove with a slow wave of your hand. A bright blue flame flickers upon the steel brazier.
    *finish
   *elseif (StoveOven = false)
    #The stove is already turned off.
    The stove is already turned off.
    *finish

The indentation isn’t working, so it’s difficult to tell. I think the problem lies in this part though:

#Check if the stove is on.
 *if (StoveOven = true)
  #The stove is not turned on!
    You turn on the stove with a slow wave of your hand. A bright blue flame flickers upon the steel brazier.
    *finish
   *elseif (StoveOven = false)
    #The stove is already turned off.
    The stove is already turned off.
    *finish

There shouldn’t be # in front of the last two things because they’re the result of a stat, not an option in a choice. And the elseif should be an else.

I removed the two # symbols and then it gave me a new error which says: Error: room_1 line 20: Expected option starting with #

The ones for “the stove is not turned on” and “the stove is already turned off”?

From what I can tell line 20 is the “check if the stove is on” option itself…

Yes, Cecilia. I removed the # symbols from those two choices

Let me fiddle with your post to see if I can turn up the actual indentation, then… :sweat_smile:

1 Like

That’s more like it. It seems that’s not the problem after all. The thing before the final option needs to be an else instead of an elseif, and needs to be lined out with the if statement above it.

(and you might need to replace the if with an elseif)

1 Like

Thank you, that fixed the problem! :smile:

1 Like

Glad to help. And the “indent code” option looks like a <./> (minus the .), for the next time you need assistance.