# Mathematical Operations Problems

#1

Hello CoG community!

I have some experience already with CS but I haven’t gone in-depth to mathematical operations in the script. But writing my novel I did dabble around with it and cant seem to figure it out (n00b!)

Erros is:
line 185: Can’t fairAdd to non-percentile value: 23000

My code looks like this:

``````	*fake_choice
#Give him all of it
*set credits 0
"Off with ye." Is all he needed to say for you to speed off.

And speed off you did.
*page_break
#Give him half
*set credits %- 50
"Yer more pathetic than I thought." He turns his ship away then boosts.
*page_break
#Give him 10%
*set credits %- 10
"Do ye bloody think I was born yesterday?" His angry voice breaks through the comms.
``````

Now, I know, I know… It says it cant fairmath non percentile values since mine is:

``````
*stat_chart

text callsign Callsign

text credits Credits

text ship Ship
``````

I’m trying to subtract credits by percentage and not actual numbers but since the fairmath seems to only work in percentile value I have to ask: How do I do it?

Greyspace: Search
#2

Mhnnn… i think it might be the amount?

#3

I think fairmath doesn’t work.for anything above 100.
And anyways, fairmath doesn’t work like.how you’re seeing it anyway.

This would work better

```*set credits * 0.5
*set credits * 0.9
```

#4

If you want to give half your credits, you could do something like this:
*set credits - (credits/2)

You should now be able to figure out how to do ten percent, and any other percent.

#5

The error message is because credits in the stat screen is labelled as text credits so you can’t use fairmath but for credits you don’t need fairmath money can go above 100

Fairmath only works for variables that are in the stat screen as percents.

For example

percent oxygen

#6

Yay! This was the answer I’m looking for thank you! And to everyone else as well!