Please rescue me from this quicktest error!

I have been staring at this code for four hours and I can’t find the error. The game successfully passes 10,000 randomtests, but it keeps throwing this same bug when I try to quicktest it. I have tried (as you will see) adding a bunch of unnecessary labels but nothing is helping. Please rescue me from this misery.

Last line in extract is the one that is labelled with the error.


                        \*if ccelyn = "Davies"
                            "In that case, you ought to start by calling me by my first name," ${ce} @{csing says|say}. "It's Celyn, by the way."
                            \*fake_choice
                                #"And you'll call me ${pcfname}?"
                                    \*set ccelyn "Celyn"
                                    \*set cfirst_name_terms true
                                    "Nothing could give me greater pleasure," ${ce} @{csing replies|reply}.
                                    \*goto gaze_to_boot
                                #"Actually, I would prefer to take things more slowly."
                                    "Oh, by all means," ${ce} @{csing replies|reply}.
                                    \*set ccelyn "Davies"
                                    \*set cfirst_name_terms false 
                                    \*goto gaze_to_boot                                
                        \*else
                            \*label gaze_to_boot
                            Then ${ce} @{csing turns|turn} ${cer} gaze to ${cer} boot, onto which a bright orange beetle has just climbed. "Oh, hello," ${ce} @{csing says|say}, allowing the creature to climb onto ${cer} finger and bringing it up to ${cer} eye. "You are very beautiful. ${pcfname}," ${ce} @{csing says|say} without looking up from the beetle, "reach me my sketch book out of my bag, will you? I should like to draw this beast."

                            You pull out the book and place the pencil directly into the hand not currently holding the pencil, and Celyn begins to sketch, ${cer} whole body relaxed in your presence.
                            \*goto post_whatever_with_celyn
        \*if (pc_wants = 4) #"For me, the highest intimacy is friendship. Platonic friendship."
            \*goto platonic_friendship_please_celyn
        #"I like you. A lot. I'd like to build this friendship, if you're willing."
            \*goto platonic_friendship_please_celyn
        \*if (pc_wants = 6) #"Celyn, I want romance but not sex."
            \*goto romance_with_celyn
\*elseif (pc_wants = 3) or (pc_wants = 5)
    There is something in ${ccelyn}'s expression that makes it clear a meeting of minds is not all ${ce} @{csing is|are} hoping for. But ${ce} @{csing is|are} tentative, obviously unwilling to risk your nascent friendship on an unwelcome move.
    \*fake_choice
        #I lean in for a kiss.
            \*gosub snog_celyn

            "Tell me what you want." The words are gently spoken, but they are a command.
            \*if pc_wants = 3
                \*fake_choice
                    #"I want this. You. But Celyn, I'm not interested in the trappings that go along with it."
                        \*gosub foreplay_with_celyn
                        Celyn kisses you again. 
                        \*label somehow_this_time
                        Somehow, this time, ${ce} @{csing sees|seem} to have intuited the kind of touch you like best, and this kiss sets your skin tingling. "Not yet, though," ${ce} @{csing murmurs|murmur}. "Take it slow, OK?" So you kiss, and you lie together in the twilight.
                        \*page_break
                        \*label post_whatever_with_celyn
                        The stars come out, infinitely layered from up here, so far from the lights of the town. Looking over, you see that Celyn is unmistably shivering. $!{ce} @{csing gives|give} a slightly embarrassed shrug when ${ce} @{csing sees|see} you've noticed.

                        "Better set up camp," ${ce} @{csing says|say}. Within a few minutes, Celyn has rigged a makeshift shelter, using a thin blanket pulled from ${cer} pack guyed up over a convenient tree branch. $!{ce} @{csing lines|line} it with soft brush and dried moss. "Got in there just before the dew," ${ce} @{csing says|say}, and climb in. You climb in beside ${cem} and pull @{has_pack your own blanket|${ccelyn}'s second blanket} over the two of you. You lie with your feet in, and your heads out of the shelter, protected from the falling damp and the wind, but still able to look up at the stars.
                        \*if (pc_wants !=4) and (turned_celyn_down = false)
                            Celyn snuggles into you, and you feel ${cem} gradually stop shivering in your arms.
                            \*goto used_to_as_kids
                        \*else
                            Celyn performs a sort of vigorous horizontal dance under the blanket, and soon the little space is warm enough that ${ce} @{csing stops|stop} shivering.
                            \*goto used_to_as_kids
                        \*label used_to_as_kids

                        "Used to do this all the time as kids," ${ce} @{csing says|say}. Pack of sandwiches and an apple from our rens, and off we went. Off into the woods." Celyn pauses, and you @{cbestie feel ${cer} body tense slightly.|sense ${cem} tense up a little beside you.} An overture to a revelation.

                        "No magical justice to guard us, not out there," ${ce} @{csing says|say} carefully.
                        \*fake_choice
                            #"Celyn, are you an inlander?"
                                "Oh yes." There is a note of challenge in ${cer} tone.
                                \*goto without_magic
                            #"It sounds like fun."
                                You place enough weight on the words that it's clear you have taken ${cer} meaning, but do not choose to address it. You @{cbestie sense|feel} ${cem} relax.
                                \*goto without_magic
                            #"That sounds dangerous."
                                Even in the dark, you sense Celyn's lips purse. "People took care of us," ${ce} @{csing says|say} stiffly. "You'll find that caring for your young is not solely the preserve of magical beings."
                                \*goto without_magic
                        \*label without_magic
                        \*fake_choice
                            #"What was it like, growing up without magic?"
                                Celyn @{cbestie shifts position to face you,|wriggles out of your arm and turns to face you,} propping ${cer} head up on one arm.

                                "It was a childhood. I was loved, I had siblings and friends to play with, and an army of ommers to care for me."
                                \*goto wild_boar
                            #"How did your family feel when you went to sea?"
                                Celyn @{cbestie snuggles further down under the blanket.|snuggles closer into you, repositioning your hand so it sits more comfortably on ${cer} back.} "They were sad," ${ce} @{csing says|say} simply. It's rare for an inlander to leave their family, especially to go so far. But I don't think they were surprised. I'd been harping on about magic since I was little."
                                \*goto wild_boar
                            #"Did you come for the sea change?"
                                "Hmm?" Celyn turns ${cer} head to face you. "Oh, no, I didn't need it. Though as it happens I have a sibling in the navy who did. My poor parents. Most inlanders get to keep all their children close; they lost two of them to the call of the sea. He's the youngest. Captain Malik got him a place on the Cyclone just in time to stop the wrong puberty kicking in."
                                \*goto wild_boar
                        \*label wild_boar
                        \*fake_choice
                            #"Is it true inlanders eat wild boar?"
                                Celyn's tone changes instantly. "It's true inlander culture has different ideas about which animals are and aren't licit, yes," ${ce} @{csing says|say} coldly. "Even a large community of humans barely register a thaumic field out of sight of the sea, so inland communities for the most part believed \[i\]all\[/i\] animals were licit until increased contact with the rest of the world showed them otherwise. Dyfad, where I'm from, is mostly inlanders. And since wild boar don't usually live on the beach, everyone, including the coasters, believed they had no magic." There is a frosty pause. "These days it's extremely rare," ${ce} @{csing concedes|concede}. 
                                \*set rcelyn %-rmini
                                \*fake_choice
                                    #I apologise if I've offended ${cem}.
                                        "Celyn," you say gently. "I'm sorry. I meant no offence. I just wanted to understand more about the culture you come from."

                                        A pause, and then ${ccelyn} speaks, more warmly now. "I'm sorry too," ${ce} @{csing says|say}. "I hear so much shit about inlander culture that I can't spot a civil question when it's asked. And the truth is, I hate that there are still people where I grew up that eat it. The evidence that they can't possibly be licit is undeniable."
                                        \*set rcelyn %+rmini
                                        \*goto presently_celyns_voice
                                    #I double down. Eating wild boar is barbaric.
                                        "Any culture that can continue to eat wild boar is guilty of barbarism," you say coldly. 
                                        \*label people_like_that
                                        "If I had my way," you continue, "people like that wouldn't be admitted into polite society at all."

                                        "Indeed?" ${ce} @{csing says|say}, ${cer} voice icy. "And yet I note you are willing to admit an entire profession devoted to the bloody murder of as many human beings as possible." 
                                        
                                        ${ccelyn} pauses for a moment, then seems to make a decision. $!{ce} @{csing stands|stand} up shedding the blanket in one efficient movement. "I shall take my leave now, sir," ${ce} @{csing says|say}.
                                        \*set rcelyn %-rmaxi
                                        \*gosub pissed_celyn_off_badly
                                        \*goto lets_get_cracking
                                    #I clarify that I was asking out of intellectual curiosity.
                                        "Oh, I meant no judgement," you say calmly. "I know very little about inland culture. I just wanted to know if the thing I had heard was true."

                                        ${ccelyn}'s hackles settle a little. "Aye, it's a common question," ${ce} @{csing says|say}, then reels off a quick list. "Do inlanders eat wild boar? If inlanders don't have magical justice, do they just commit crimes all the time? Do inlanders let their children suffer the wrong puberty? Are inlanders, in fact, basically licit?" $!{ce} @{csing pauses|pause}, and ${cer} breathing settles. 
                                        
                                        "Sorry," ${ce} @{csing continues|continue}. "To answer your question: sometimes. Older people who've been eating boar all their lives without magical repercussions sometimes do. Younger people almost never. And, just to save time later: no, they commit crimes the same amount everyone else does, and no, they don't let their children suffer if they can possibly avoid it. That particular rumour comes from the fact that an inland family whose entire wealth is in their farm land can't always afford to up sticks to the coast, or even scrape together enough money for a sea voyage."
                                        \*goto presently_celyns_voice
                            #"I've always found the inlanders I've met to be hospitable people."
                                \*set rcelyn %+rmini
                                ${ccelyn} turns to you in surprise. "I don't know many coasters who've had occasion to find that out,"${ce} @{csing says|say}.
                                \*fake_choice
                                    #"My studies of flora and fauna have taken me all over."
                                    #"I love to meet people from all cultures."
                                    #"Oh, I find it pays to be friendly."
                                "Indeed?" ${ce} @{csing says|say}. "Yes. We can be stand-offish when we feel we are about to be judged, but with our own kind, and those we trust, well... I sometimes think the lack of magical justice makes us feel more strongly that we must make our own. Our lives can be hard, and virtually all inlanders are poor, and it's made us kind. That's why it rankles so much that people say what they do."

                                ${ccelyn} pauses to @{cbestie pull ${cer} half of the blanket up more tightly again|nuzzle ${cer} way deeper into your warmth}.

                                "I lie about it," ${ce} @{csing says|say} at last. "Well, I don't lie per se, but I lie by omission. My accent doesn't give me away because Dyfad's so small we all sound the same, inland or coast. So I... I pass as a coaster. It makes my life easier, but it always feels like a betrayal."
                                \*fake_choice
                                    #"It is a betrayal. How will you ever change things if you hide who you are?"
                                        @{cbestie You hear the blanket rustle as|You feel ${ccelyn}'s hair shift against your skin as} ${ce} @{csing nods|nod}. "I know," ${ce} @{csing says|say}. "But it's hard. Maybe when I make captain."
                                        \*goto presently_celyns_voice
                                    #"No-one could begrudge you making things easier on yourself."
                                        \*label a_little_doubtful
                                        "Maybe," ${ce} @{csing says|say}, a little doubtful. "But it don't sit easy. Especially when I'm doing nothing for all the inlanders who can't help but make themselves known the moment they open their mouths."
                                        \*goto presently_celyns_voice
                                    #"Anyone prejudiced enough to judge you has no right to your personal history."
                                        \*goto a_little_doubtful
                            #"I've never trusted inlanders. They are fundamentally uncivilised."
                                \*goto people_like_that
                        \*label presently_celyns_voice
                        Presently, ${ccelyn}'s voice becomes heavier and slower, and not long after that, ${ce} @{csing drifts|drift} off to sleep @{ccouple in your arms|beside you}. 
                        \*page_break
                        The next morning, you wake just as the first horizontal beams are laying carpets of sunlight over the sparkling earth. ${ccelyn} stretches like a cat and disentangles ${cem}self from @{ccouple your arms|the covers}. 
                        
                        "I'm warm!" ${ce} @{csing says|say} happily. "I always wake up cold. Oh, this is wonderful."

                        Then ${ce} @{csing stands|stand} and @{csing greets|greet} the early morning with a look of unmistakable delight. $!{ce} @{csing takes|take} a deep breath. 

                        "It never fails to surprise me," ${ce} @{csing says|say}. "Every time, I remember waking up outdoors and I think, 'it can't have been as wonderful as I remember. And it is. Every time."
                        
                        You join ${cem} outside. Now that you are no longer wrapped up in the blanket, the air quickly chills you both. $!{ccelyn} in particular is shivering within a few minutes, so you break camp quickly, each wrap a blanket around you, and begin the long walk back to the ship. Today will be exceptionally busy, and it will begin the moment you reach the Meredith.
                        \*page_break You Stop off In Your Cabin
                        \*goto pick_your_morning_activity
                    #"I want this. Just this, no trappings. But not yet."
                        \*gosub foreplay_with_celyn
                        You can tell that the two of you are truly of one mind. You are both happy for this to be friendship, and maybe sex eventually, with no romance. But you
                        \*label what_you_want_right_now
                        sense that Celyn is waiting for you to indicate what you want right now.
                        \*fake_choice
                            #I move in for a kiss. I don't want to have sex today, but I do want to continue this.
                               Celyn responds enthusiastically.
                               \*goto somehow_this_time
                            #I brush ${cer} cheek sensually. 
                                Celyn lets out a barely audible gasp, and leans in to your touch. Then, seeing that this is all you intend for tonight, ${ce} @{csing echoes|echo} your gesture, ${cer} musician's hand lightly grazing your face. Then ${ce} @{csing pulls|pull} back again, and 
                                \*label unexpectedly_sunny
                                gives you an unexpectedly sunny, relaxed smile. "It's always better when you wait," ${ce} @{csing says|say}.
                                \*goto post_whatever_with_celyn
                            #I pull back too. For now, I want to talk.
                                Celyn
                                \*goto unexpectedly_sunny
                    #"I'm sorry. I don't see you in that way."
                        \*goto close_intimacy_with_celyn_thread
            \*else
                \*fake_choice
                    #"I want you, Celyn. The whole shooting match."
                        At your words, Celyn smiles. "That's a coincidence," ${ce} @{csing says|say}. Then ${ce} @{csing moves|move} from sitting to crawling to travel the very short distance between you, never pausing until ${cer} lips are on yours. $!{ce} @{csing keeps|keep} the forward momentum going as ${ce} gently @{csing lowers|lower} you to the ground, hand behind your head to protect it from the rough ground.

                        ${ccelyn}'s kiss is langorous, curious. Time stands still as ${ce} @{csing explores|explore} your lips, your tongue, your skin.
                        \*gosub celyn_trembling
                        \*set ccouple true
                        \*set cclose true
                        \*set cbestie false
                        \*set csexual true
                        \*goto post_whatever_with_celyn
                    #"You. The whole shooting match. But I want to take it slowly."
                        At your words, Celyn smiles. "That's a coincidence," ${ce} @{csing says|say}. But Celyn doesn't approach you. You 
                        \*set ccouple true
                        \*set cclose true
                        \*set cbestie false
                        \*set csexual true
                        \*goto what_you_want_right_now
                    #"I'm sorry Celyn. I don't see you in that way."
                        \*goto close_intimacy_with_celyn_thread
        #I'm not interested in ${ccelyn} in that way.
            \*goto close_intimacy_with_celyn_thread
        #I'm interested - but this is too fast for me.
            "Celyn," you say, "I like you a lot. But I like to take things slowly. Maybe very slowly."

            Celyn leans back, a pleased, relaxed expression on ${cer} face. "Suits me," ${ce} @{csing says|say}. You
            \*set ccouple true
            \*set cclose true
            \*set cbestie false
            \*set csexual true
            \*goto what_you_want_right_now

*elseif (opcelyn = 2) and (pc_wants >2)

What is the error message?

I don’t know what the error is, without the error report message, but I noticed the final few choices don’t seem to be indented in line with the other choices.

Oh no, scratch that, I understand what you were doing now. Those choices fall under the larger choice option.

Most likely, it’s an indentation error. Those are much harder to spot compared with other types of error that quicktest flags. Since your forum formatting goes wonky exactly on the offending line, here’s my suggestion:

Cut that entire line of code, with its leading spaces/tabs, and paste it into a separate file. Backspace to the last line that you’re sure works correctly. Redo the indentation from scratch (Notepad++ and most code editors manage it automatically) and then paste in the line of code, sans leading spaces, onto the new indent. Then try running QT again.

(On an unrelated note: I don’t think I’ve ever seen that particular comment syntax in a CS game. Very cool to learn that this is also possible.)

What is comment syntax?!

Can I ask, what does the error actually say?

(Other programming languages use different characters to denote a comment, such as // or /* but I think you’ve just used an escape character to stop the markdown turning everything italic?)

(That is forum markdown syntax.)

Sorry, yes, the error says:

Error: it is illegal to fall into an *else statement; you must *goto or *finish before the end of the indented block.

I have seen this error many times, and it is because I don’t have implicit_control_flow on, and I have indeed forgotten to include a *goto. But in this case I can’t find an error. That’s why I’ve added so many unnecessary labels to try and fix it.

Try adding a goto at the first indented level right before the elseif that throws an error?

I’ll help check the code again; if you’ve added all *gotos, then chances are the error is a symptom of another issue such as nested choice confusion, a sub routine without a *return, or not using a label in a nested choice.


I don’t see *gotos in this nested choice.


   *fake_choice
        #"My studies of flora and fauna have taken me all over."
        #"I love to meet people from all cultures."
        #"Oh, I find it pays to be friendly."

Is there a line number attached to the error? If so, which line does it align with your previously given code snippet?

Sorry, I posted that original post in a bit of a flap! Here is the snippet again. The very last line of it is the one that keeps getting the error message.

Oh, do nested choices require *gotos? I haven’t been putting them in…
[Edited to add: I tried adding gotos to the choices in that nested choice, but it didn’t help.]

                                    *fake_choice
                                        #"It is a betrayal. How will you ever change things if you hide who you are?"
                                            @{cbestie You hear the blanket rustle as|You feel ${ccelyn}'s hair shift against your skin as} ${ce} @{csing nods|nod}. "I know," ${ce} @{csing says|say}. "But it's hard. Maybe when I make captain."
                                            *goto presently_celyns_voice
                                        #"No-one could begrudge you making things easier on yourself."
                                            *label a_little_doubtful
                                            "Maybe," ${ce} @{csing says|say}, a little doubtful. "But it don't sit easy. Especially when I'm doing nothing for all the inlanders who can't help but make themselves known the moment they open their mouths."
                                            *goto presently_celyns_voice
                                        #"Anyone prejudiced enough to judge you has no right to your personal history."
                                            *goto a_little_doubtful
                                #"I've never trusted inlanders. They are fundamentally uncivilised."
                                    *goto people_like_that
                            *label presently_celyns_voice

                            Presently, ${ccelyn}'s voice becomes heavier and slower, and not long after that, ${ce} @{csing drifts|drift} off to sleep @{ccouple in your arms|beside you}. 
                            *page_break
                            The next morning, you wake just as the first horizontal beams are laying carpets of sunlight over the sparkling earth. ${ccelyn} stretches like a cat and disentangles ${cem}self from @{ccouple your arms|the covers}. 
                            
                            "I'm warm!" ${ce} @{csing says|say} happily. "I always wake up cold. Oh, this is wonderful."

                            Then ${ce} @{csing stands|stand} and @{csing greets|greet} the early morning with a look of unmistakable delight. $!{ce} @{csing takes|take} a deep breath. 

                            "It never fails to surprise me," ${ce} @{csing says|say}. "Every time, I remember waking up outdoors and I think, 'it can't have been as wonderful as I remember. And it is. Every time."
                            
                            You join ${cem} outside. Now that you are no longer wrapped up in the blanket, the air quickly chills you both. $!{ccelyn} in particular is shivering within a few minutes, so you break camp quickly, each wrap a blanket around you, and begin the long walk back to the ship. Today will be exceptionally busy, and it will begin the moment you reach the Meredith.
                            *page_break You Stop off In Your Cabin
                            *goto pick_your_morning_activity
                        #"I want this. Just this, no trappings. But not yet."
                            *gosub foreplay_with_celyn
                            You can tell that the two of you are truly of one mind. You are both happy for this to be friendship, and maybe sex eventually, with no romance. But you
                            *label what_you_want_right_now
                            sense that Celyn is waiting for you to indicate what you want right now.
                            *fake_choice
                                #I move in for a kiss. I don't want to have sex today, but I do want to continue this.
                                   Celyn responds enthusiastically.
                                   *goto somehow_this_time
                                #I brush ${cer} cheek sensually. 
                                    Celyn lets out a barely audible gasp, and leans in to your touch. Then, seeing that this is all you intend for tonight, ${ce} @{csing echoes|echo} your gesture, ${cer} musician's hand lightly grazing your face. Then ${ce} @{csing pulls|pull} back again, and 
                                    *label unexpectedly_sunny
                                    gives you an unexpectedly sunny, relaxed smile. "It's always better when you wait," ${ce} @{csing says|say}.
                                    *goto post_whatever_with_celyn
                                #I pull back too. For now, I want to talk.
                                    Celyn
                                    *goto unexpectedly_sunny
                        #"I'm sorry. I don't see you in that way."
                            *goto close_intimacy_with_celyn_thread
                *else
                    *fake_choice
                        #"I want you, Celyn. The whole shooting match."
                            At your words, Celyn smiles. "That's a coincidence," ${ce} @{csing says|say}. Then ${ce} @{csing moves|move} from sitting to crawling to travel the very short distance between you, never pausing until ${cer} lips are on yours. $!{ce} @{csing keeps|keep} the forward momentum going as ${ce} gently @{csing lowers|lower} you to the ground, hand behind your head to protect it from the rough ground.

                            ${ccelyn}'s kiss is langorous, curious. Time stands still as ${ce} @{csing explores|explore} your lips, your tongue, your skin.
                            *gosub celyn_trembling
                            *set ccouple true
                            *set cclose true
                            *set cbestie false
                            *set csexual true
                            *goto post_whatever_with_celyn
                        #"You. The whole shooting match. But I want to take it slowly."
                            At your words, Celyn smiles. "That's a coincidence," ${ce} @{csing says|say}. But Celyn doesn't approach you. You 
                            *set ccouple true
                            *set cclose true
                            *set cbestie false
                            *set csexual true
                            *goto what_you_want_right_now
                        #"I'm sorry Celyn. I don't see you in that way."
                            *goto close_intimacy_with_celyn_thread
            #I'm not interested in ${ccelyn} in that way.
                *goto close_intimacy_with_celyn_thread
            #I'm interested - but this is too fast for me.
                "Celyn," you say, "I like you a lot. But I like to take things slowly. Maybe very slowly."

                Celyn leans back, a pleased, relaxed expression on ${cer} face. "Suits me," ${ce} @{csing says|say}. You
                *set ccouple true
                *set cclose true
                *set cbestie false
                *set csexual true
                *goto what_you_want_right_now
*elseif (opcelyn = 2) and (pc_wants >2)

Until I can get access to run your code, see this discussion with the exact same issue:

I think your error is a symptom of something else that isn’t the *goto but, I can’t know for certain until I test the code. Although, double checking the solution, it does imply adding *goto at the very end of each if/else/if before proceeding. I think this is what @LiliArch said earlier.

OK, for reasons I do not at all understand, moving the *if statement to a different place seems to have made the error go away. The top of that branch now looks like this, with the bulk of the text lower down, under labels:

*if (opcelyn = 3) and (pc_wants >2)
    *goto celyn_gazing_at_you
*elseif (opcelyn = 2) and (pc_wants >2)
    *goto gauge_cer_interest
*elseif (opcelyn = 1) and (pc_wants >2)
    *goto whatever_your_plans_and_wishes
*else
    *goto no_desire_to_make_friends

You know, now that I see it like this, I feel like I might have had this problem before, where the solution turned out to put all the if/elseif/else statements that relate to each other together, and have them go down to labels lower down. It is also, if I’m honest, a bit easier to see what I’m doing…

I’ve had this error before, and I believe it might be a bug with ChoiceScript itself, but it’s really hard to pin down consistently. I think it occurs when you follow a *goto to a *label which is nested within a conditional and/or nested choice? Probably something to do the *if statement containing the choice itself not being read properly when you enter the text block part-way through? You can get around it by just reformatting like you have (I used *gosubs instead), but it might be good to raise this as a potential CS bug if it hasn’t already been noted. Seems to’ve been around a while, too.