Okay, unlike most of my questions, this one isn't very confusing. I have six variables that should be equal to different numbers after I run the program I made. How can I make a program that will determine which variable is greatest without having to make a giant "if var1 is greater than var2..." script?
Thanks in advance!
Offline
BoltBait wrote:
Do you want to know which variable holds the largest value or which is the largest value?
Isn't it the same thing?
Um, well, what I mean is: if
<(variable1) = [3]>
<(variable2) = [8]>and
<(variable3) = [5]>I want it to be able to tell me that variable2 is the biggest. The variables won't have set values at the start of the program, they are each assigned random values.
Last edited by Zangooser (2012-10-30 17:57:51)
Offline
And if two of the variables have the same value, what would you like to happen?
Offline
ErnieParke wrote:
And if two of the variables have the same value, what would you like to happen?
I'm going to figure out how to make the program pick one of the variables randomly. First I have to get this sorted out.
Offline
Also, is there some way that you would be willing to use a list instead of six variables?
Last edited by ErnieParke (2012-10-30 18:18:48)
Offline
ErnieParke wrote:
Also, is there some way that you would be willing to use a list instead of six variables?
Erm, well.... I already used the variables in several different scripts that are necessary to the program, so omitting them would pretty much be an overhaul of the entire program XP
Offline
Oh, and one last question, what do you want done to the largest variable once you've figured out which one it is?
Offline
ErnieParke wrote:
Oh, and one last question, what do you want done to the largest variable once you've figured out which one it is?
It's just going to broadcast a message and tell the Stage to switch backgrounds. If I needed help with that, heh... I would advise myself to give up scripting forever.
Offline
Well then, make a new variable called (biggest #) and try this:
set [biggest # v] to (variable1) if <(variable2) > (biggest #)> set [biggest # v] to (variable2) end if <(variable3) > (biggest #)> set [biggest # v] to (variable3) end if <(variable4) > (biggest #)> set [biggest # v] to (variable4) end if <(variable5) > (biggest #)> set [biggest # v] to (variable5) end if <(variable6) > (biggest #)> set [biggest # v] to (variable6) end Filler.//Biggest # should now be equal to the biggest variable.I hope that this helps!
Offline
Zangooser wrote:
ErnieParke wrote:
Well then, make a new variable called (biggest #) and try this:
(script omitted)
I hope that this helps!It does! Thank you so much! :D
Your welcome!
Offline