Finding the max of many values?

I have an event in my game that I’d like to trigger when any one of half a dozen factions’ strength reaches 100%. Does ChoiceScript have a Math.MAX() function? If not, I can probably use a bunch of if statements - is there a way to do something like:

if faction1 > 99 || faction2 > 99 || faction3 > 99 …

etc. ?

No, but CSLIB does!

Which you’re free to copy out and reuse, if you don’t want to utilise the whole library.

3 Likes

Looks good, thank you!

Can you share an example using max? I installed the files but I can’t find one using max in the examples folder. Thanks so much!

*gosub_scene cslib_number max 1 700 99 5 4 2
${cslib_ret} === 700
4 Likes