Help getting the highest value of more than two variables

Hi,

Im new to RPGMaker and I wanted to add a quiz to my game with each answer adding points to one out of 7 variables. At the end of the quiz, depending on which value you have the highest score with, you get one outcome or another. I currently added the control variables to add points to the quiz, but when it comes to getting the highest value I have no clue on how to do it. I know that you have to make a new variable that equals the highest value variable and then add conditional branches to get the different outcomes, however I dont know how to do it.
Run this one Time to find out which of the 3 Variables got the highest Value and the Id of that Variable.

set varX to 0
set varY to 0

if var1 is more than varX
set varX to var1 and set varY to 1 (Id of Variable)
end
if var2 is more than varX
set varX to var2 and set varY to 2
end
if var3 is more than varX
set varX to var3 and set varY to 3
end

varX now contains the highest Value at that Point in the Game
varY now contains the Event ID as Number.

If two Variables or more share the highest Value, than the one checked first is chosen as highest.

Original thread: https://forums.rpgmakerweb.com/threads/help-getting-the-highest-value-of-more-than-two-variables.152423/