Stat checking multiple vars

There is probably a more elegant way to do this, but I can’t think of it.

My only advice is, if this is a type of check you’re going to do more than once, it might make sense to create a subroutine and a seperate variable tracking the highest stat.

So create, e.g., high_stat = "charm"

and a subroutine along the lines of what you have already:

*label high_stat_check
*if ((((charm  > genuine ) and (charm  > friendly ) and (charm > outgoing ) and (charm  > emotional ))))
   *set high_stat = "charm"
   *return
*elseif (((genuine > charm) and (genuine > friendly ) and (genuine > outgoing ) and (genuine > emotional ))))
   *set high_stat = "genuine"
   *return

and so on (you’ll also have to deal with ties!).

And then when you want to run the test, you can just do, e.g.,

*gosub high_stat_check
*if high_stat = "charm" 
   charming blah 
*elseif high_stat = "genuine"
   genuine blah

etc.

Ed: this thread has a few alternates (like what @sviyagin just posted below :slight_smile: )

2 Likes