Illegal to fall out of a choice statement

Hey there, I know there’s been multiple threads on this topic, but I have tried (I think) all of the solutions those suggested. I’ve been stuck on this for about two hours and it’s really grating.

*choice

    #This is my choice

        *if (harpshirtch2 = "On")
            *if (((mcbuild = "MT") or (mcbuild = "TT")) or ((mcbuild = "AT")))
                Text
                *page_break
                Text
                Goto Scene
            *if (((mcbuild = "MS") or (mcbuild = "TS")) or ((mcbuild = "AS")))
                Text
                *page_break
                Text
                Goto scene
            Text
            *page_break
            Text
            Goto scene
        *if (harpshirtch2 = "Off")
            *if (((mcbuild = "MT") or (mcbuild = "TT")) or ((mcbuild = "AT")))
                Text
                *page_break
                Text
                Goto Scene
            *if (((mcbuild = "MS") or (mcbuild = "TS")) or ((mcbuild = "AS")))
                Text
                *page_break
                Text
                Goto scene
            Text
            *page_break
            Text
            Goto scene

I have tried the following:

  • Adding a *finish at the very end where the indents for *if (harpshirtch2 = "blah")
  • Adding a *if ((harpshirtch2 != "On") or (harpshirtch2 != "Off")) at the end with a *finish underneath
  • Changing the *if (harpshirtch2 = "Off") to *if (harpshirtch2 != "On")
  • Checked to make sure all of the spacing on the *if lines were correct, and they were.

For some reason none of this has fixed it even though the choice directly above this one has the exact same line of code and is not flagged. Any help would be very much appreciated!

EDIT: Out of curiosity I deleted that line of code, and it happened with the next choice after that as well, leading me to believe it’s something with the line of code before that, which like I said, has the same structure.

*if statements and *choice are two different commands. The error code is essentially telling you there is no choice to be made there. Instead of doing what you have done above try removing the *choice and having the *if statements by themselves

*if(shareddream=true)
*gosub dreamscene1
*if(shareddream=false)
*gosub dreamscene2

Sorry, the *if statements are part of a choice being made. I apologize I probably didn’t make that clear. I’ll edit it to read better

alright let me look at my games code to see if I can spot what is wrong

Did you try writing the *if statements into the choice itself?

*fake_choice
#Carry on looking for the tree
‘It does not matter what bascolion are doing this far south. All that matters right now is finding a north star tree and getting its sap.’ With that thought in mind I quietly sneak away from the bascolion not wanting to accidentaly start a war if I stumbled upon one of their nests. I end up searching for an additional six hours before finding a north star tree and scooping up some of the sap running down its bark with a glass test tube that I keep on me incase I come across something my people have never encountered and need to get a sample of it for study. It also serves as a good way to transport certain liquids when I have run out of containers to put them in, or special kinds of liquids in this case.

When I first started out I encountered the same problem when using the *page_break line in choices that might be it. Otherwise I am just as stumped as you are

I have not as that would be a lot of choices. But I might just restructure the *if statements this way to see if it works:

*choice

    #This is my choice

        *if (harpshirtch2 = "Off") and (((mcbuild = "MS") or (mcbuild = "TS")) or ((mcbuild = "AS")))
            Text
            *page_break
            Text
            *goto scene

        *if (harpshirtch2 = "Off") and (((mcbuild = "MT") or (mcbuild = "TT")) or ((mcbuild = "AT")))
            Text
            *page_break
            Text
            *goto scene

        *if (harpshirtch2 = "On") and (((mcbuild = "MS") or (mcbuild = "TS")) or ((mcbuild = "AS")))
            Text
            *page_break
            Text
            *goto scene

        *if (harpshirtch2 = "On") and (((mcbuild = "MT") or (mcbuild = "TT")) or ((mcbuild = "AT")))
            Text
            *page_break
            Text
            *goto scene

        *if (harpshirtch2 = "Off")
            Text
            *page_break
            Text
            *goto scene

    Text
    *page_break
    Text
    *goto scene

I’ll keep this updated on if that works.

1 Like

it might be that or the *page_break that is doing it other than that i am stumped.

*If statements are for variables that our already set if you want to set a variable then you should be useing the *set (variablename) command

For every *if and/or *elseif, there has to be a corresponding *else. One of the things I do, sometimes, is make them all go to the same place, so they can function like a *fake_choice with more complexity.

For instance, if I want an animal to say something only if the PC can speak to animals:

Text.
*if pc_animalspeak = true
The dogs says quit picking up his poo–it defeats the purpose.
*goto post_poo
*else
*goto post_poo
*label post_poo

EDIT: Anyway, make all conditions *elseif after the first, then the last one *else, and you should be good to go.

OH yeah I completely forgot about the *elseif statements.

*if (height=1)
stand on my the tips of my toes
*elseif (height=2)
stand on my toes
*elseif (height=3)
lean in
*elseif (height=4)
lean down
*else
crouch

^
I
like that

For some reason restructuring it worked, even though it should read it as the exact same thing. I didn’t try the *elseif/*else solution though, so for science sake you could try that with the original structure to see if it fixes it and then we can possibly have two solutions!

I know that the else if statements work since i have been using them in my story.

Can you have multiple *elseif for one particular point?? I never knew that!!

As in:

*if (playertype = 1)
You’re a wizard, Harry.
*goto scene1
*elseif (playertype = 2)
You’re an elf, Harry
*goto scene1
*elseif (playertype = 3)
You’re a superhero, Harry.
*goto scene1
*else
*goto scene2

I thought you were limited to one elseif when I read the COG code demos…

1 Like

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.