# Wow, CS can do this! calculating math difference

**URL:** <https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070>\
**Category:** ChoiceScript Help\
**Created:** [December 7, 2018, 4:09pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070 "2018-12-07T16:09:37Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![FayI](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fayi/32/175781_2.png) [@FayI](https://forum.choiceofgames.com/u/FayI)\
**Post date:** [December 7, 2018, 4:09pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/1 "2018-12-07T16:09:37Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![MeltingPenguins](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/meltingpenguins/32/255855_2.png) [@MeltingPenguins](https://forum.choiceofgames.com/u/MeltingPenguins)\
**Post date:** [December 7, 2018, 4:32pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/2 "2018-12-07T16:32:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hazel](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/hazel/32/77796_2.png) [@Hazel](https://forum.choiceofgames.com/u/Hazel)\
**Post date:** [December 7, 2018, 5:02pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/3 "2018-12-07T17:02:44Z")

</div>

Does it really need the curly braces?

---

<div class="post-metadata">

**Author:** ![MeltingPenguins](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/meltingpenguins/32/255855_2.png) [@MeltingPenguins](https://forum.choiceofgames.com/u/MeltingPenguins)\
**Post date:** [December 7, 2018, 5:17pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/4 "2018-12-07T17:17:12Z")

</div>

I think

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

```

Works too

---

<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:** [December 7, 2018, 5:25pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/5 "2018-12-07T17:25:14Z")

</div>

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

```

---

<div class="post-metadata">

**Author:** ![FayI](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fayi/32/175781_2.png) [@FayI](https://forum.choiceofgames.com/u/FayI)\
**Post date:** [December 7, 2018, 7:55pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/6 "2018-12-07T19:55:46Z")

</div>

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

---

<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:** [December 7, 2018, 8:07pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/7 "2018-12-07T20:07:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![FayI](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fayi/32/175781_2.png) [@FayI](https://forum.choiceofgames.com/u/FayI)\
**Post date:** [December 7, 2018, 8:09pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/8 "2018-12-07T20:09:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![will](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/will/32/132033_2.png) [@will](https://forum.choiceofgames.com/u/will)\
**Post date:** [December 7, 2018, 10:11pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/9 "2018-12-07T22:11:32Z")

</div>

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

---

<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:** [December 7, 2018, 10:17pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/10 "2018-12-07T22:17:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![will](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/will/32/132033_2.png) [@will](https://forum.choiceofgames.com/u/will)\
**Post date:** [December 7, 2018, 10:19pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/11 "2018-12-07T22:19:04Z")

</div>

Duhhhr I didn’t even read the flavour text closely

---

<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:** [December 7, 2018, 10:22pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/12 "2018-12-07T22:22:03Z")

</div>

> _The most elusive of rats hide in plain sight._

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

---

<div class="post-metadata">

**Author:** ![will](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/will/32/132033_2.png) [@will](https://forum.choiceofgames.com/u/will)\
**Post date:** [December 7, 2018, 10:23pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/13 "2018-12-07T22:23:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![zenovarse](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/zenovarse/32/76740_2.png) [@zenovarse](https://forum.choiceofgames.com/u/zenovarse)\
**Post date:** [December 9, 2018, 9:20pm UTC](https://forum.choiceofgames.com/t/wow-cs-can-do-this-calculating-math-difference/47070/14 "2018-12-09T21:20:23Z")

</div>

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!
