playMaker

Author Topic: Compare multiple ints less than/equal/greater than  (Read 2310 times)

IsolatedPurity

  • Playmaker Newbie
  • *
  • Posts: 23
Compare multiple ints less than/equal/greater than
« on: December 23, 2019, 02:01:48 PM »
Is there a way to compare multiple ints and choose the lowest one without using an array? Kind of the like the Int Compare action but with more than two.

...

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
Re: Compare multiple ints less than/equal/greater than
« Reply #1 on: December 23, 2019, 04:50:49 PM »
Well, you could probably do it without arrays in code. I'm curious, why wouldn't you use an array?

daniellogin

  • Full Member
  • ***
  • Posts: 215
Re: Compare multiple ints less than/equal/greater than
« Reply #2 on: December 23, 2019, 10:46:28 PM »
Well, the easiest way to do it is to just stack em up.

Eg;

* Int compare = 5
- equal = event 1
- greater = event 1
- less = ...

* Int compare = 0
- equal = event 2
- greater = event 2
- less = ...

And so on

With the above example; Event 1 is int 5 or more. Event 2 is 0 to 4. This will only work when the int compares are sequenced correctly. If the second int compare went first, it would send the event for everything, but by going last, all the higher options have happened (or not) before reaching it, so only 0 to 4 remains to be checked.