Can't find my mistake in quicktest


#1

Hey

I have had this mistake showing up for some time now when I use quicktest and I can’t seem to find out why it gives the mistake. I believe the option works fine when I play

Error: chapter_2_choice_of_flags line 1077: It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block.

Line 1077 is the #Wait till it’s a bit closer option

The coding there is a follows. (I have cut the text so there is a better overview)

  *choice 
    #Take the shot, you trust your fighting skills.
      *if (fighting >= 3) 
        It takes a fraction of a second 

        You barely believe you 
        *set fighting +1 
        *set deer +2
        *goto boar
      *if (fighting < 3) 
        It takes a fraction of a second as you

        Which is a good thing, 
        *set deer +1
        *goto boar
    #Wait till it's a bit closer. 
      *if ((fighting >= 2) and (wit >= 1)) 
        The stag keeps getting closer. 

        The two servants make their way 
        *set deer +2
        *goto boar 
      *else
        The stag is carefully 
        *set deer + 1
        *goto boar 

    #You know you aren't going to win, just enjoy to sight and leave it alone. 
      There is no way you are going to beat Priscato try. 
      And so the buck 
      *goto boar

#2

Try plugging that section of the code into the IDE and running it through that. (Remember to copy over your relevant creates for variables as well.) That’s what I usually do for trouble-shooting.

At a glance the code looks fine to me too.


#3

I’m not getting this error when I used your code. Do you have the latest version of CS? Also, does the error come up when you play the game?

If anything, you can change that choice set to a *fake_choice since they seem to all go to the same place. That’ll get rid of the error,


#4

You don’t need a choice, so simplifying may fix it:

*fake_choice 
    #Take the shot, you trust your fighting skills.
      *if (fighting >= 3) 
        It takes a fraction of a second 

        You barely believe you 
        *set fighting +1 
        *set deer +2
      *if (fighting < 3) 
        It takes a fraction of a second as you

        Which is a good thing, 
        *set deer +1
    #Wait till it's a bit closer. 
      *if ((fighting >= 2) and (wit >= 1)) 
        The stag keeps getting closer. 

        The two servants make their way 
      *if ((fighting < 2) or (wit < 1)) 
        *set deer +2
        The stag is carefully 
        *set deer + 1
    #You know you aren't going to win, just enjoy to sight and leave it alone. 
      There is no way you are going to beat Priscato try. 
      And so the buck

#5

Thanks for the quick reactions. Unfortunately I just found out I don’t have time to look at it till tomorrow =(

I don’t think I ever had an error when I tried to play it. Nor did anyone else report an error when they played the demo. (but so far people give me the opportunity to find and fix the mistakes on my own instead of telling me that they found a mistake :smile: .)

But will let you know what I find.

Also, I haven’t figure out what the difference is between a fake choice and a real choice. So all my choices are codes as choices.


#6

Pretty sure that, currently at least, the only difference is that *fake_choices don’t need a goto at the end, they just fall down to the next line (but you can’t imbed other choices into a *fake_choice.


#7

If every choice in a set leads to the same place the next page, you can use fake choices. So, in the code you’re using, they all lead to the label ‘boar’. Instead of using *label and *goto, use *fake_choice.

Here’s the wiki page, might help you understand it a bit. http://choicescriptdev.wikia.com/wiki/Fake_choice


#8

Hmm. That might work. Just switch that *choice for a *fake_choice and see if that fixes things. You don’t even need to change any of the rest of your code.

@Repearoa I think you can embed choices into other choices using fake_choice. I’d need to double check though.


#9

well, fake_choice seems to have worked. Although I am still not completely certain why a normal choice should give the error =) But thanks for all the quick and usefull comments.


#10

@FairyGodfeather I should have been clearer about that. You can (it technically works) but there are bugs in falling out of the #choice, at least last time I checked. I forget what the exact details are (I have it in my notes somewhere), but I think the problem is that you can only fall out of one *fake_choice, so putting either kind of *choice in a *fake_choice makes it essentially act as a normal *choice.

@mrwolf2 I remember what the problem is now. I don’t know why I didn’t see it the first time, I just was working on this. You’re using quicktest (no wait, that’s not the problem, but it’s why you’re having the problem). Quicktest cheats, and checks all your code, even if it’s impossible for it to be reached in a real game. Essentially quicktest checks both sides of that first *if, than both sides of that second *if. It doesn’t care that it’s impossible to have fighting both greater than and less than 3 at the same time, because it doesn’t bother to remember that you have to have fighting >=3 to get to the second *if. Normally to fix it, you’d put a *bug under the *ifs like this:

*if fighting >=3
  XXX
  *goto wherever
*if fighting < 3
  XXX
  *goto wherever
*bug Your fighting is both less than, and greater than 3

#11

I’ve had that problem before too. It happens a lot when using *if statements within a *choice. It really hates it so I prefer to use *fake_choice with the *goto if I need it to jump to a different label. If you want it to work with quicktest I think all the code needs to change to
*choice
*if (fighting >= 3) #Take the shot.
Text for this
*set stats
*goto label

*if (fighting < 3) #Risk taking the shot.
Text for this
*set stats
*goto label

^— writing code that way is annoying so I’d only recommend that way if you absolutely need it to use a *choice there.


#12

Yes, it looks at each conditional at a time. Replacing with an *else works, or just drop out of the if. Using a comment can keep the same flow as you originally had written.

*choice 
    #Take the shot, you trust your fighting skills.
      *if (fighting >= 3) 
        It takes a fraction of a second 
        You barely believe you 
        *set fighting +1 
        *set deer +2
        *goto boar
      *Comment (fighting<3) is only one left
      It takes a fraction of a second as you
      Which is a good thing, 
      *set deer +1
      *goto boar
    #Wait till it's a bit closer. 
      *if ((fighting >= 2) and (wit = 1)) 
        The stag keeps getting closer. 
        The two servants make their way 
        *set deer +2
        *goto boar 
      *else
        The stag is carefully 
        *set deer + 1
        *goto boar