Wow, CS can do this! calculating math difference


#1

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?


#2

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


#3

Does it really need the curly braces?


#4

I think

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

Works too


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

#6

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


#7

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 :"


#8

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


#9

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


#10

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.


#11

Duhhhr I didn’t even read the flavour text closely


#12

The most elusive of rats hide in plain sight.

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


#13

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


#14

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!