Quicktest refusing to acknowledge a goto

Alright, the search has not provided results, so…

I’m getting a frustrating quicktest error:

This:

*label cafe_banter2
Are you sure? There's still stuff here to see.
*line_break
*choice
   #I'm sure.
      *if ((apartment_check_count1 !=0) or (apartment_check_up_count1 !=0))
         *goto cafe_banter2_1
      *if ((apartment_check_count1 !=0) or (apartment_check_up_count1 =0))
         *goto cafe_banter2_2
   #Well, on second thought...
      *goto investigatecafe_a1

results in quicktest proclaiming:

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

Why?!

Maybe because the quicktest assumed a situation where both *ifs are unpassable?

Tried changing it to this:

*label cafe_banter2
Are you sure? There's still stuff here to see.
*line_break
*choice
   #I'm sure.
      *if ((apartment_check_count1 =0) and (apartment_check_up_count1 !=0))
         *goto cafe_banter2_1
      *if ((apartment_check_count1 !=0) and (apartment_check_up_count1 =0))
         *goto cafe_banter2_2
      *if ((apartment_check_count1 !=0) and (apartment_check_up_count1 !=0))
         *goto cafe_banter2_1
      *if ((apartment_check_count1 =0) and (apartment_check_up_count1 =0))
         *goto cafe_banter2_3
   #Well, on second thought...
      *goto investigatecafe_a1

with the same result.

This is the code it comes from:

   *if (apartment_checked_1 = "false") #I head back to the apartment.
      *if (cafe_checked_1 = "true")
         *goto cafe_banter1
      *if (cafe_checked_1 = "false")
         *goto cafe_banter2

For this section:

Try doing a series of:

*if
*elseif
*(repeat elseif, if necessary, as many times as necessary)
*else
1 Like

Nope, same result
:confused:

I mean…

*choice
*if ((apartment_check_count1 =0) and (apartment_check_up_count1 !=0))
 #I'm sure.
  *goto cafe_banter2_1
*if ((apartment_check_count1 !=0) and (apartment_check_up_count1 =0))
 #I'm sure.
  *goto cafe_banter2_2
*if ((apartment_check_count1 !=0) and (apartment_check_up_count1 !=0))
 #I'm sure.
  *goto cafe_banter2_1
*if ((apartment_check_count1 =0) and (apartment_check_up_count1 =0))
 #I'm sure.
  *goto cafe_banter2_3

Then it complains that i’m using the choice option already… I know I could just rephrase it…

Did you copy and paste a choice under your other choice? :sweat_smile:

Try this?


*label cafe_banter2
Are you sure? There's still stuff here to see.
*choice
   #I'm sure.
      *if ((apartment_check_count1 !=0) or (apartment_check_up_count1 !=0))
         *goto cafe_banter2_1
      *else
         *goto cafe_banter2_2
   #Well, on second thought...
      *goto investigatecafe_a1

The *else tells the autotests there are no other possible conditions…otherwise, due to the way they work, sometimes they have no way of knowing that no other possibilities exist—and then they’ll read an #option with only *if statements under it as a bug.

Hence the *else, which gives anything not under an *if (or *elseif) a place to go.

2 Likes

I went with carlos’. thanks to all.
gods, this was a pain

2 Likes

Using *else makes it a lot less painful. Spelling out every single logical option (like Carlos’ second suggestion, that you went with) is cumbersome with two variables and quickly gets impossible…

1 Like

Yeah
But this was they only thing that worked.

The following doesn’t work?


*choice
   #I'm sure.
      *if ((apartment_check_count1 =0) and (apartment_check_up_count1 !=0))
         *goto cafe_banter2_1
      *elseif ((apartment_check_count1 !=0) and (apartment_check_up_count1 =0))
         *goto cafe_banter2_2
      *elseif ((apartment_check_count1 !=0) and (apartment_check_up_count1 !=0))
         *goto cafe_banter2_1
      *else ((apartment_check_count1 =0) and (apartment_check_up_count1 =0))
         *goto cafe_banter2_3
   #Well, on second thought...
      *goto investigatecafe_a1

What error does the else-elseif-else chain give you?

The same as before. That i am falling out of a choicebody

Is this choice body embedded?

If so, are the labels embedded as well?

If the labels are embedded, then that is the issue, quicktest has issues with embedded labels, so to get it to pass, push the labels to the primary trunk.

Oi, isn’t this will result in an error?
*else doesn’t accept any condition, IIRC.

1 Like

Labels arent embedded here.
It’s really a mess

ok, first off: @Szaal is correct - remove the conditions from the else statement for it to work.

Secondly - I’ll think on this as I work on my story this morning.

I could later on scratch the conditions entirely. Problem 2 i have here is that the option wont dissappear when it should.

Others have mentioned using *elseif, but there’s another possibility I’d suggest: the *bug statement.

It’s possible to write #options with conditionals that will always be satisfied, and still have Quicktest throw an error because it’s not evaluating those conditionals. The *bug statement serves two purposes. It satisfies Quicktest, and if you’re wrong and it is possible to get to the end of the #option test without ever hitting a *goto, Randomtest will display the text from your *bug statement and you’ll know what went wrong.

This will pass Quicktest. (I like to put the relevant variable names and values in the *bug statement so I can start my troubleshooting with “How did those variables end up with weird values?”)

*choice
   #I'm sure.
      *if ((apartment_check_count1 !=0) or (apartment_check_up_count1 !=0))
         *goto cafe_banter2_1
      *if ((apartment_check_count1 !=0) or (apartment_check_up_count1 =0))
         *goto cafe_banter2_2
      *bug Invalid combination of apartment_check_count and apartment_check_up_count1: ${apartment_check_count}, ${apartment_check_up_count1}
   #Well, on second thought...
      *goto investigatecafe_a1