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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Mon Jun 16, 2008 5:07 pm   

function to order a set of values from lowest to highest
 
A trigger will call the function in something like this manner:
promptTStat=@orderfunc(4.5,1.3,2.4)

<func name="orderfunc" id="93">
<value>$x=%null
stuff
morestuff
ending up with:
$x={B: $b -- S: $s -- R: $r}
#RETURN {$x} </value>
<arglist>$r,$b,$s</arglist>
</func>


I want the function to return:
B: 1.3 -- S: 2.4 -- R: 4.5


So that the value of 'promptTStat' becomes exactly what the function returns. The function needs to sort the values of the three parameters passed to it in order of lowest to highest. I have a vague idea of lumping the three into a stringlist and using %sort, then extracting the sorted data from the list. I have this feeling I am missing something simpler though.

The order is the important thing. The final variable is going to be subbed into my prompt, and the purpose is for combat, where the exact values of the three numbers are going to escape my attention, but the order of them will still be useful.

Does anyone have any tips for me?
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Mon Jun 16, 2008 5:08 pm   
 
Oh bleh, just as I hit 'submit' I remembered what I was forgetting.

That being %max.



..Sorry
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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