How do I compare multiple variables?

First of all, I'm new here, so I'm sorry if I'm in the wrong section of the forum!

I'm currently making my very first game and I wanted to do multiple endings. I thought about setting variables that increase with specific dialogue choices so that the highest variable will determine which ending the player will get. How can I do this with more than two variables? How can I make RMMV determine which variable is the highest?
There is a way that dose not require js, only what you have in rpgmaker, I belive the following will help you in your case, you want max of all values right? Then make 2 more variables, one called VarMax and one called EndingID, place the first value from your first variable that you want to compare in it and in the EndingID place the id of that variable in it. Once that is done you will need a number of ifs(conditionals) that sound like the following if VarB>VarMax then VarMax=VarB, EndingID=ID of VarB(you can see the id next to the name of the var) End; If VarC>VarMax then VarMax=VarC, EndingID= ID of VarC and so on and so forth, watch out for equals(it will work but it will always pick the last one). And ther you have it in EndingID you have the number of the ending that you want your player to have.
upload_2019-11-6_18-23-57.png


Var Max = Checker of which of these variable have greater value
Var A = Determine Ending 1
Var B = Determine Ending 2
Var C = Determine Ending 3
Var D = Determine Ending 4
Ending = Variable which decide the ending

The order of the condition decide the priority in case the maximum variable have equal value. If the maximum value is both Var B and Var C, then the ending determind by Var B will be choosen since its condition appear first.
Thank you so much, both of you!

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-compare-multiple-variables.114960/