# Randomtest weirdness cannot extract another token

**URL:** <https://forum.choiceofgames.com/t/randomtest-weirdness-cannot-extract-another-token/32015>\
**Category:** ChoiceScript Help\
**Created:** [November 6, 2017, 8:57pm UTC](https://forum.choiceofgames.com/t/randomtest-weirdness-cannot-extract-another-token/32015 "2017-11-06T20:57:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![malinryden](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/malinryden/32/272913_2.png) [@malinryden](https://forum.choiceofgames.com/u/malinryden)\
**Post date:** [November 6, 2017, 8:57pm UTC](https://forum.choiceofgames.com/t/randomtest-weirdness-cannot-extract-another-token/32015/1 "2017-11-06T20:57:58Z")

</div>

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.

```

---

<div class="post-metadata">

**Author:** ![Nocturnal\_Stillness](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/nocturnal_stillness/32/100414_2.png) [@Nocturnal\_Stillness](https://forum.choiceofgames.com/u/Nocturnal_Stillness)\
**Post date:** [November 6, 2017, 9:36pm UTC](https://forum.choiceofgames.com/t/randomtest-weirdness-cannot-extract-another-token/32015/3 "2017-11-06T21:36:19Z")

</div>

Try putting the choice under the \*if

```
*if (read)
    #I read the message. 

```

---

<div class="post-metadata">

**Author:** ![malinryden](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/malinryden/32/272913_2.png) [@malinryden](https://forum.choiceofgames.com/u/malinryden)\
**Post date:** [November 6, 2017, 9:41pm UTC](https://forum.choiceofgames.com/t/randomtest-weirdness-cannot-extract-another-token/32015/4 "2017-11-06T21:41:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Nocturnal\_Stillness](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/nocturnal_stillness/32/100414_2.png) [@Nocturnal\_Stillness](https://forum.choiceofgames.com/u/Nocturnal_Stillness)\
**Post date:** [November 6, 2017, 9:47pm UTC](https://forum.choiceofgames.com/t/randomtest-weirdness-cannot-extract-another-token/32015/5 "2017-11-06T21:47:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dfabulich](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/dfabulich/32/198373_2.png) [@dfabulich](https://forum.choiceofgames.com/u/dfabulich)\
**Post date:** [November 6, 2017, 10:07pm UTC](https://forum.choiceofgames.com/t/randomtest-weirdness-cannot-extract-another-token/32015/6 "2017-11-06T22:07:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Havenstone](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/havenstone/32/198451_2.png) [@Havenstone](https://forum.choiceofgames.com/u/Havenstone)\
**Post date:** [November 7, 2017, 4:35am UTC](https://forum.choiceofgames.com/t/randomtest-weirdness-cannot-extract-another-token/32015/7 "2017-11-07T04:35:12Z")

</div>

> [@malinryden](#):
>
> Oh god, do I need to do that for every choice in the game? \*sighs-

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…

---

<div class="post-metadata">

**Author:** ![Szaal](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/szaal/32/112202_2.png) [@Szaal](https://forum.choiceofgames.com/u/Szaal)\
**Post date:** [November 7, 2017, 4:55am UTC](https://forum.choiceofgames.com/t/randomtest-weirdness-cannot-extract-another-token/32015/8 "2017-11-07T04:55:13Z")

</div>

> [@Havenstone](#):
>
> which I guess most folks do nowadays…

That’s why… `*create implicit_control_flow true`, [guys](https://forum.choiceofgames.com/t/new-choicescript-features-implicit-control-flow-gosub-parameters/30042)  
ლ(ಠ益ಠლ)

BTW, I like your title, @Havenstone .

---

<div class="post-metadata">

**Author:** ![malinryden](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/malinryden/32/272913_2.png) [@malinryden](https://forum.choiceofgames.com/u/malinryden)\
**Post date:** [November 8, 2017, 6:06pm UTC](https://forum.choiceofgames.com/t/randomtest-weirdness-cannot-extract-another-token/32015/9 "2017-11-08T18:06:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lunawisp](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/lunawisp/32/85423_2.png) [@lunawisp](https://forum.choiceofgames.com/u/lunawisp)\
**Post date:** [May 30, 2018, 10:04am UTC](https://forum.choiceofgames.com/t/randomtest-weirdness-cannot-extract-another-token/32015/10 "2018-05-30T10:04:39Z")

</div>

> [@Szaal](#):
>
> That’s why… `*create implicit_control_flow true` , [guys](https://forum.choiceofgames.com/t/new-choicescript-features-implicit-control-flow-gosub-parameters/30042)

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 😉
