Getting a "not a number: blah blah" error when running the randomtest

So I keep getting a “not a number” error when running randomtest:

*****Seed 2
7 *choice 91#2 (line 94) #Turn the key counter-clockwise
47 *choice 77#1 (line 78) #Head in through the Great/Grand Gate
78 *choice 26#1 (line 27) #Check out the open area
112 *choice 24#3 (line 29) #You’d rather continue onward
102 *choice 22#3 (line 27) #Or maybe you could hide in one of the buildings
118 *choice 28#2 (line 31) #Search somewhere else
124 *choice 45#2 (line 48) #Take the right fork
18 *choice 34#2 (line 37) #Continue Hey, you’re almost there. Take a chance with those last few steps
73 *choice 22#3 (line 27) #One coin is HEADS, the other is TAILS
25 *choice 28#2 (line 31) #Pull the lever on the west side of the chamber
135 *choice 26#2 (line 29) #You’d rather go south instead
RANDOMTEST FAILED: Error: line 29: Not a number: blah blah

The code in question:

*choice
#Take the north passage
*goto_scene 65
#You’d rather go south instead //ERROR IS HERE
*goto_scene 81

It’s the most basic *choice code you can write, completely identical to hundreds of other choices in my game, so it’s driving me nuts to get this error here.

Has anyone else ever seen this?

I should also note that the scene name is identical in all cases, and listed in my startup list of scenes.

Additionally, it works 100% fine when doing a normal play-through in Firefox. It’s only within randomtest that I get the error.

“blah blah” indicates there’s some “input_text” thing, since that’s what randomtest generates when it gets to a choice that makes it input text.

Is there someplace where you have the player input a number?

Note that if you want the player to type in a number, you should use *input_number, not *input_text. If you use *input_number, players will only be allowed to type in numbers.

Hmmm. There is a user input in the next scene:

*If (salt = true)
*goto_scene 52
*Else
You’re going to have to fight the slug off! Roll two dice (or just pick a random number from 2 to 12) and enter it below:
*temp roll
*input_text roll
*if (roll < 8) //ERROR CORRESPONDS HERE
*goto_scene 35
*if (roll > 7)
*goto_scene 168

That all looks correct to me, though. And it plays through fine as well within Firefox.

So for testing purposes, I removed the *input_text and set the variable to a number. Everything works now!

I guess this means randomtest doesn’t do well with user-inputted values?

*input_text roll

You should replace that line with

*input_number roll 2 12

Then Randomtest will give you a random number between 2 and 12. Otherwise Randomtest will set roll to blah blah which is not what you want. (Not just that; your players could type “blah blah” themselves, causing their game to break.)

If you want to get fancy, you can do this:

*if choice_randomtest
    *rand roll1 1 6
    *rand roll2 1 6
    *set roll roll1 + roll2

That will bias the results so 7s are more common than 2s or 12s, which may or may not matter to you.

3 Likes

BINGO! That’s the problem. Changed that and now everything is hunky dory. And that code snippet is super useful: far more accurate than just choosing a random number between 2-12.

Thanks so much for the help!