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

**URL:** <https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659>\
**Category:** ChoiceScript Help\
**Created:** [August 17, 2014, 8:55am UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659 "2014-08-17T08:55:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Moser](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/eric_moser/32/259257_2.png) [@Eric\_Moser](https://forum.choiceofgames.com/u/Eric_Moser)\
**Post date:** [August 17, 2014, 8:55am UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/1 "2014-08-17T08:55:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JimD](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/jimd/32/21672_2.png) [@JimD](https://forum.choiceofgames.com/u/JimD)\
**Post date:** [August 17, 2014, 9:20am UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/2 "2014-08-17T09:20:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eric\_Moser](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/eric_moser/32/259257_2.png) [@Eric\_Moser](https://forum.choiceofgames.com/u/Eric_Moser)\
**Post date:** [August 17, 2014, 10:38am UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/3 "2014-08-17T10:38:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eric\_Moser](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/eric_moser/32/259257_2.png) [@Eric\_Moser](https://forum.choiceofgames.com/u/Eric_Moser)\
**Post date:** [August 17, 2014, 12:37pm UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/4 "2014-08-17T12:37:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mayday](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/mayday/32/25529_2.png) [@Mayday](https://forum.choiceofgames.com/u/Mayday)\
**Post date:** [August 17, 2014, 10:52pm UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/5 "2014-08-17T22:52:17Z")

</div>

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

\*set stunner %- 30

(no space between % and -)

---

<div class="post-metadata">

**Author:** ![gkkiller](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/gkkiller/32/18994_2.png) [@gkkiller](https://forum.choiceofgames.com/u/gkkiller)\
**Post date:** [August 18, 2014, 4:52am UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/6 "2014-08-18T04:52:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eric\_Moser](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/eric_moser/32/259257_2.png) [@Eric\_Moser](https://forum.choiceofgames.com/u/Eric_Moser)\
**Post date:** [August 18, 2014, 5:03am UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/7 "2014-08-18T05:03:52Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![anon4518890](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@anon4518890](https://forum.choiceofgames.com/u/anon4518890)\
**Post date:** [December 31, 2016, 5:26pm UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/8 "2016-12-31T17:26:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Eiwynn](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/eiwynn/32/221334_2.png) [@Eiwynn](https://forum.choiceofgames.com/u/Eiwynn)\
**Post date:** [December 31, 2016, 5:31pm UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/9 "2016-12-31T17:31:49Z")

</div>

Look up the use of Fairmath - here is the Wiki-link: [http://choicescriptdev.wikia.com/wiki/Fairmath#Fairmath](http://choicescriptdev.wikia.com/wiki/Fairmath#Fairmath)

---

<div class="post-metadata">

**Author:** ![P\_Tigras](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/p_tigras/32/626_2.png) [@P\_Tigras](https://forum.choiceofgames.com/u/P_Tigras)\
**Post date:** [December 31, 2016, 6:01pm UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/10 "2016-12-31T18:01:20Z")

</div>

> [@anon4518890](#):
>
> 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.

Yup.

(20 chars…)

---

<div class="post-metadata">

**Author:** ![NatsDemilla](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/natsdemilla/32/82087_2.png) [@NatsDemilla](https://forum.choiceofgames.com/u/NatsDemilla)\
**Post date:** [June 29, 2019, 9:00pm UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/11 "2019-06-29T21:00:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![LeoXII](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/leoxii/32/92488_2.png) [@LeoXII](https://forum.choiceofgames.com/u/LeoXII)\
**Post date:** [June 29, 2019, 9:17pm UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/12 "2019-06-29T21:17:52Z")

</div>

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.

---

<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:** [June 29, 2019, 9:54pm UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/13 "2019-06-29T21:54:37Z")

</div>

Wild guess: one of your stats reach -2.

---

<div class="post-metadata">

**Author:** ![NatsDemilla](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/natsdemilla/32/82087_2.png) [@NatsDemilla](https://forum.choiceofgames.com/u/NatsDemilla)\
**Post date:** [July 3, 2019, 6:15pm UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/14 "2019-07-03T18:15:16Z")

</div>

Thank you guys!

---

<div class="post-metadata">

**Author:** ![rinari](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/rinari/32/86277_2.png) [@rinari](https://forum.choiceofgames.com/u/rinari)\
**Post date:** [March 7, 2020, 5:51am UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/15 "2020-03-07T05:51:41Z")

</div>

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? 🙃 🙃 🙃

---

<div class="post-metadata">

**Author:** ![Chris\_Conley](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/chris_conley/32/199055_2.png) [@Chris\_Conley](https://forum.choiceofgames.com/u/Chris_Conley)\
**Post date:** [March 15, 2020, 8:40am UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/16 "2020-03-15T08:40:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rinari](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/rinari/32/86277_2.png) [@rinari](https://forum.choiceofgames.com/u/rinari)\
**Post date:** [March 15, 2020, 8:28pm UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/17 "2020-03-15T20:28:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rinari](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/rinari/32/86277_2.png) [@rinari](https://forum.choiceofgames.com/u/rinari)\
**Post date:** [May 31, 2020, 1:49am UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/18 "2020-05-31T01:49:50Z")

</div>

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?

---

<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:** [May 31, 2020, 2:33am UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/19 "2020-05-31T02:33:10Z")

</div>

> [@rinari](#):
>
> what could be causing this?

Yes

---

<div class="post-metadata">

**Author:** ![rinari](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/rinari/32/86277_2.png) [@rinari](https://forum.choiceofgames.com/u/rinari)\
**Post date:** [May 31, 2020, 2:46am UTC](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659/20 "2020-05-31T02:46:39Z")

</div>

😰 I have a lot of search and replace to do…

[Next page](https://forum.choiceofgames.com/t/help-with-randomtest-error-message-cant-fairadd-to-non-percentile-value/2659.md?page=2)
