Randomtest weirdness cannot extract another token

Well, since playtesting of Fallen Hero is almost at an end, I was going to run a few randomtests to see if anything that people have missed popped up.

Apart from some code that I have to hide (names stuff), one weird thing that pops up all the time as an error is this:

RANDOMTEST FAILED: Error: chapter01 line 1939: Invalid expression, couldn’t extract another token:

The cone in question is:

  *if (puppet_gender = "woman") #…Latina
    You're not sure what ${phis} origins are, and the fact that ${phe} looks like a Latina doesn't narrow it down much in these parts.

This happens everywhere I am having *if statements in my choice code (I have a LOT). This has never been an issue before, quicktest runs fine and I’ve had a lot of people testing the game and no errors have occurred.

What kind of weird wording do randomtest want for *if statements in choices?

EDIT;

A better, longer same of code that gives the same error on noth the named and the complicated variables:


*fake_choice
  #This isn't good. The reporter has heard too much.
    This isn't good. You can't help the nervous twitch on your face. The reporter has heard too much — will you have to do something about this later?

  *if (named) #It's fine — ${name} is a common name. No reason for anything to come of this.
    It's fine — ${name} is a common name, and there is no reason for anything to come of this. After tonight, there's going to be a lot more interesting news to focus on.
    *set arrogance %+ 5

  *if (complicated) #But who is Ortega interested in? That's what you want to know.
    Is she talking about ${name} or ${puppet_name}? When did your life get this complicated? You only have yourself to blame.

  #So I'm having that much of an effect on Ortega? That is good to know.
    So you are having that much of an effect on Ortega? It's good to know that ${he}'s not just playing pretend.

"Are you sure that's not just guilt talking?" Herald has walked over to Lady Argent now, looking down at her. He's half a head taller than her, even though he's not floating right now.

Try putting the choice under the *if

*if (read)
    #I read the message. 
5 Likes

It solves it, but…

Oh god, do I need to do that for every choice in the game? *sighs-

It follows the syntax described, and it plays fine. Why can’t the randomtest get it to work? I know you have no answer, I am just complaining into the air because I’ve got really complicated choice structures which now have to be retooled from scratch. Just for that bloody test.

4 Likes

Yeah for some reason it doesn’t like *if on the choice line but it doesn’t mind *selectable_if

1 Like

Generally speaking, this happens when you’re accidentally “falling in” to a # option, like this:

*create leadership 50
*create strength 50

*choice
  *if (leadership = 50) #A
    A!
    *ending
  *if (strength = 50) #B
    B!
  *if (leadership != 50) #…C
    C?!
    *ending

There is a real bug here: if you choose #B, there should be an *ending, but instead, it just falls into the #C line. ChoiceScript doesn’t realize that this is an #option line, but instead thinks you just randomly wrote #…C on an otherwise ordinary *if line. “Can’t extract another token” means “I couldn’t understand the rest of this line.”

Moving the #…C line to the next line doesn’t actually fix the bug, but it does make error messages clearer when they fail.

From my own RT experience, I think it’s every fake_choice. Which is no comfort when you’ve used fake_choice to avoid having to use *gotos, which I guess most folks do nowadays…

1 Like

That’s why… *create implicit_control_flow true, guys
ლ(ಠ益ಠლ)

BTW, I like your title, @Havenstone .

1 Like

Thank you so much!

Now that I understand how randomtest worked, it was a breeze clearing up the issues. Thank you for taking the time to explain it, that removed all the frustration of fixing things <3

This is the first thing I put in any CS story. I just couldn’t get used to the idea of having to put “*goto label” all over the place. It just felt so awkward and clunky. As long as you’re using an editor that helps out with automatic indenting, I think using this makes things a LOT easier to write. Does for me anyway :wink: