Bug Found with Randomtest

While running Randomtest (something I just discovered I could do!) it tagged an instance of a bug on line where I get the error message:

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

My code looks like this:

*choice
    #Let ${child1} make the decision
        *temp var 0
        *rand var 1 2
        *if var = 1
            "Well, it's up to you, what do you say?"
            
            "Alright, ${Parent}, where is she?" You guide ${child1} over to a table where Speaker Peters is sitting.
            
            "Madam Speaker, a pleasure to see you here!" 

            "${Prefix} President, it is great to speak with you. I assume this is your ${child1name}?"

            *page_break

            "It certainly is, this is my ${child1name}, ${child1}. ${child1}, this is Speaker of the House Madeline Peters." You give ${child1name} a slight nudge and the two of them shake hands. 

            "${child1} had just graduated from Law School at the top of their class and is on the market now for some jobs in D.C." You smile to Speaker Peters, it being clear what you're implying.

            *page_break

            "You know, ${address}, I have some money left over in the budget to hire another staffer. I'd be happy to look into hiring your ${child1name}, with an interview of course. Would that interest you, ${child1}?"

            "Absolutely, thank you, Madam Speaker."

            "Well, I'll leave the two of you to talk further, I hope you enjoy the rest of your night."
            *set child1career "politics"
            *set relationshipFamily %+15
            *goto inauguralball
        *if var = 2
            "Well, it's up to you, what do you say?"
            
            "I appreciate it, ${Parent}, but I'd rather work for it on my own."
            
            "Working for things on your own? I thought I raised you better than that!" you say, jokingly. The two of you laugh and continue speaking throughout the night, with ${child1} leaving at the end of the first Ball.
            *page_break
            *set relationshipFamily %+15
            *goto inauguralball
    #Introduce ${child1} to the Speaker
        "Why don't I just introduce the two of you?"
        
        "Alright, alright, where is she?" You guide ${child1} over to a table where Speaker Peters is sitting.
        
        "Madam Speaker, a pleasure to see you here!" 
        
        "${Prefix} President, it is great to speak with you. I assume this is your ${child1name}?"
        
        *page_break
        
        "It certainly is, this is my ${child1name}, ${child1}. ${child1}, this is Speaker of the House Madeline Peters." The two of them shake hands and begin talking about the campaign. ${child1} talks about their recent graduation from Law School and you wander elsewhere to let the two of them talk.
        *set relationshipFamily %+5
        *goto inauguralball
    #Introduce ${child1} to the Speaker, and get ${child1pronoun} a job
        "Come on, ${child1}, it can't hurt.?"
        
        Before ${child1sgpronoun} has a chance to respond, you're already at the table where Speaker Peters is sitting.
        
        "Madam Speaker, a pleasure to see you here!" 
        
        "${Prefix} President, it is great to speak with you. I assume this is your ${child1name}?"
        
        *page_break
        
        "It certainly is, this is my ${child1name}, ${child1}. ${child1}, this is Speaker of the House Madeline Peters." You give ${child1name} a slight nudge and the two of them shake hands. 
        
        "${child1} had just graduated from Law School at the top of their class and is on the market now for some jobs in D.C." You smile to Speaker Peters, it being clear what you're implying.
        
        *page_break
        
        "You know, ${address}, I have some money left over in the budget to hire another staffer. I'd be happy to look into hiring your ${child1name}, with an interview of course. Would that interest you, ${child1}?"
        
        "Absolutely, thank you, Madam Speaker." $!{child1sgpronoun} quickly glares at you from across the table.
        
        "Well, I'll leave the two of you to talk further, I hope you enjoy the rest of your night."
        *set relationshipFamily %-15
        *if Party = "Democratic"
            *set DemApproval %-10
        *if Party = "Republican"
            *set RepApproval %-10
        *set child1career "politics"
        *page_break
        *goto inauguralball

Oddly enough, this doesn’t seem to be an issue while playing the game through – you’re still able to pick all of those options to my knowledge without any sort of issue but Randomtest still flagged it.

If it helps, line 389 is the one starting with

#Introduce ${child1} to the Speaker

Thanks!

Randomtest doesn’t know that var can be only 1 or 2. Make that an *if/*else pair rather than *if var = 1/ *if var = 2.

5 Likes

Would the issue be fixed if he had originally set *temp var 1? I use many if statements in my code without using the else command and I rarely come across this error.

Here is an example of code that I made that doesn’t produce this error.

*rand number 1 5
*if number = 1
    *set m_level + 1
*if number = 2
    *set m_level + 2
*if number = 3
    *set m_level + 3
*if number = 4
    *set m_level + 4
*if number = 5
    *set m_level + 5
*choice

That’s fine, because it all lands on *choice. If a cascade of *ifs lead to a *choice, no problem. But they can’t lead down to a new option body as in the original example without running the risk of Randomtest freaking out.

1 Like

In answer to the question you are about to ask, landing on a *finish, *ending or *goto is also fine.

Maybe I’m still not understanding it right. I created this to be more accurate and still couldn’t get an error. Or is random test inconsistent with it?

*label test
*choice
    #Choice1.
        *rand number 1 2
        *if number = 1
            Something here.
            *goto 1
        *if number = 2
            Something here.
            *goto 2
    #Choice2.
        *rand number 1 2
        *if number = 1
            Something here.
            *goto 1
        *if number = 2
            Something here.
            *goto 2

*label 1
This works.
*goto 3

*label 2
This also works.
*goto 3

*label 3
It's still working.
*ending

Edit: I see the problem, It only occurs during quicktest, not random test.

1 Like

Quicktest runs all the possible options, randomtest only runs one by iteration, if the iterations you try don’t come by with the error, there’s no error to show. So that’s because you only are getting it on the quicktest, though you can also get it on the random test if you increase the number of iterations to try, and at some point it runs the branch with the error.

Am I right to assume then if you add this, it would fix the error?

*else
    *ending

The correct way according to what I know are

*if
*if
*if
*else


*if
*elseif
*elseif
*else

You need to end with an *else, after the *else you can, *goto *goto_scene (and all the goto variables) *finish or *ending

1 Like