Mathematical Operations Problems

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:

		#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.
		#Give him half
			*set credits %- 50
			"Yer more pathetic than I thought." He turns his ship away then boosts.
		#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:


	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?

Mhnnn… i think it might be the amount?

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

This would work better

*set credits * 0.5
*set credits * 0.9

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.


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

1 Like

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