Help with Randomtest error message - Can't fairAdd to non-percentile value

This error message is confounding me. I’ve spent an hour trying to figure out what’s wrong.

So I have all my supporting characters with variables showing the relationship with the MC. They all start at 25.

In startup:

*create stunner 25

Then later in the game I have a choice that affects the MC’s relationship with him, resulting in the following code on line 256.

*set stunner %-30

When I run Randomtest, I get this message

line 256: Can’t fairAdd to non-percentile value: 0

Does anyone have any idea what’s wrong? The stunner variable should be exactly the same as alllll the other characters but he’s the only one that gives me this message and it’s preventing me from running a full Randomtest

somewhere you may have set stunner to less than 1. Most likely you have a space between the % and the minus.

@JimD, thanks for the tip. I’ll check that out right now.

Well I found one mistake where I had typed *set stunner -30% in an earlier scene but the tests still give me the same error on line 256. I’m double and triple checking the other *set stunner commands. Again, I appreciate the help. Hopefully there’s one more goof hiding somewhere.

I am not a big fan of percentages but I know it should be

*set stunner %- 30

(no space between % and -)

It’s possible you’ve set stunner to a value in quotes (i.e. a text string) instead of a numerical value somewhere …

@gkkiller, Thanks! that’s what I’m checking for after work today. I’ve been shift f ing everything to do with stunner and I -have- to find the problem because its jamming up randomtest until it’s fixed.

is there a way to make the game auto correct values pass up 100% to 99%?

for example i have a value that is 104 or more, can i make a script so the game auto correct it to 99, so it never pass the limit.

Look up the use of Fairmath - here is the Wiki-link:


(20 chars…)

Is it possible to get the error message for the wrong line? It says the problem is in line 680, but there’s nothing wrong with it:

RANDOMTEST FAILED: Error: line 680: Can’t fairAdd to non-percentile value: -2

#Something casual.
You wear jeans and a basic t-shirt.
*set charm %- 10
*set perception %+ 10

I see nothing wrong.

It’s most likely referencing that line because the value went above 100 or below 0 somewhere beforehand, and using fairmath during those instances will result in error. Try checking to make sure you didn’t set the variables outside the 0-100 range and didn’t use any fixed additions/subtractions that could have made the value less than 0 or greater than 100.

Edit: From my knowledge, the automated tests only reference the line where the error occurs, I.e. the spot where the variable is being fairmath’d outside the percentile range, and doesn’t tell you the specific point in which the value actually falls outside that range.


Wild guess: one of your stats reach -2.


Thank you guys!

Reviving this to ask, with sincere horror:

Does fairmath only work with the %+ separated from the number by a space?

I ask because I recently received the same error as in the OP, and reading through this thread has me realizing that the fairmath ChoiceScript wiki page actually has fairmath as:

*set beauty %+ 5

…Whereas I’ve been using

*set beauty %+5

And I never caught on because I’ve never had any errors until now, the game has been running just fine that way and has indeed been changing the variables! However, I am awful at math and didn’t bother checking if the fairmath calculations were actually right… Does it actually work without the space, or have I actually not been using fairmath this whole time lmao? :upside_down_face: :upside_down_face: :upside_down_face:

No, spacing before and after punctuation is optional. It doesn’t affect functionality. (I always space, to help make the code more legible.)


Phew, thanks so much for clarifying! I thought I was going to have to search and replace everything for a while! :sweat_smile:

1 Like

Reviving this again to say: my readers keep getting persistent Can’t FairAdd errors whenever their values go over 100. A lot of this has turned out to be save plug-in stuff (storing and saving variables that end up adding to over 100), but some errors aren’t resolved by clearing the web cache and starting over fresh.

However, I was under the impression that using fairmath meant it was literally impossible to go over 99, so I’m baffled for why my stats keep going over 100, resulting in the error. (The choices that produce the error also use fairmath.)

Does anyone have any ideas what could be causing this? Is it possible that mixing types of stat changes (sometimes +1 strength, other times +%5 strength) could cause this?


1 Like

:cold_sweat: I have a lot of search and replace to do…

1 Like