Wow, CS can do this! calculating math difference

I was going to post a question, but I had a good old go at making something up, and it turns out Choice can calculate the difference between two numerical stats, and then use that difference in tests!

I’m rather excited. For reference, it’s:
*if ({stat1} - {stat2}) >= 50

Don’t know if it would be of use to anyone - but I couldn’t find it in semi-recent topics, so maybe it hasn’t come up!

Any other cool maths-related tricks I might not know about?

7 Likes

I think baroque used this for its skillchecks, and aye, it’s a nifty little thing

Does it really need the curly braces?

I think

*if ((var1 - var2) >50)) 

Works too

2 Likes
*if (stat1 - stat2) >= 50
   Your stats, ${stat1 - stat2}, should be less or equal to fifty.
5 Likes

Nice! Considering I have a tendency towards complications, keeping it simple is good!

I’m actually surprised that nobody has pointed out the obvious mistake in my example code, considering the number of likes.

Well, I’ll let it roll :"

I just love errors, they’re all part of the process :wink:

Should it be *if ((stat1 - stat2) >= 50) instead?

It’s fine, just like how a simple *if stat < 5 works.

Though to be fair, that’s not what I meant with obvious mistake. If that’s what you’re trying to point out


> is the symbol of more than, not less.

Duhhhr I didn’t even read the flavour text closely

2 Likes

The most elusive of rats hide in plain sight.

Yes, I made it up myself. Sounds cool, though.

Counterpoint: They say the spiders you can see are a mere tenth of the spiders you can’t.

That’s very neat. But CS can’t do this

*if ((var1 - var2 - var3) < 50)

Instead it requires this

*if (((var1 - var2) - var3) < 50)

Ugh! An expression is not two variables and an operator!

1 Like