Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Mozzie
Beginner


Joined: 24 Nov 2006
Posts: 17

PostPosted: Mon Dec 04, 2006 5:38 pm   

Test for lowest resist value
 
I am trying to keep track of my targets various resistances to energies. These can come from race, protection spells or even potions. This part I am fine with, I have a number of triggers that change variables depending on what I have detected.

The part I am having difficulty with is determining which is the lowest variable to I can choose the correct element to attack with. I am using variables called @TFire @TCold @TElec and if they have a negative number they are weak to the element and if it is a positive number they can resist it.

Is there a function I can call to find the lowest variable without doing a nasty series of if then?
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Mon Dec 04, 2006 5:55 pm   
 
Sounds like you want to look into the %min function.

Alternatively you could put the variables in a list, sort in ascending order (using the %sort function) and pick the first on the resulting list.
_________________
Asati di tempari!
Reply with quote
Mozzie
Beginner


Joined: 24 Nov 2006
Posts: 17

PostPosted: Mon Dec 04, 2006 7:05 pm   
 
Both look good at first glance, but as far as I can see they both would return the value, not the name of the variable.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net