• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Comparing 6 varibles?????

Status
Not open for further replies.
Level 5
Joined
Jul 31, 2004
Messages
108
I have 6 varibles that need to be compared and I need the ones with the highest value to do somethings, how do I just find the 2 with the highest value or compared the 6 and find the highest and second highest???
 
Level 3
Joined
Dec 12, 2003
Messages
30
//Pass 1 get the highest...
set high = a
if(b > high)
high = b
if(c > high)
high = c
if(d > high)
high = d
if(e > high)
high = e
if(f > high)
high = f

//Pass 2 check to see if there are 2 equal high values
count=0;
if(a == high)count++
if(b == high)count++
if(c == high)count++
if(d == high)count++
if(e == high)count++
if(f == high)count++
if(count > 1) high2 = high
else
if(a != high) high2 = a
if(b != high and b > high2) high2 = b
if(c != high and c > high2) high2 = c
if(d != high and d > high2) high2 = d
if(e != high and e > high2) high2 = e
if(f != high and f > high2) high2 = f
 
Level 7
Joined
Jul 30, 2004
Messages
451
in an array its pretty easy...

Code:
first = num[0];
second = num[0];

for (int i = 1; i <= max; i++)
{
    if num[i] > first
    {
        second = first;
        first = num[i];
    }
    elseif num[i] > second
    {
        second = num[i];
    }
}

just translate that into a trigger and ur set
 
Status
Not open for further replies.
Top