|
Rastamutti Beginner
Joined: 27 Jun 2012 Posts: 17
|
Posted: Thu Aug 09, 2012 4:11 am
Variable calculation problem |
I've got a record variable called BodyHits that has 7 different items in it. right leg, left leg, right arm, left arm, gut, chest, head.
Everytime I get hit on a certain limb I increment it by 1.
I'd like to be able to sort through the variable and find the largest two.
How would I go about this? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Thu Aug 09, 2012 7:30 am |
$temp=@bodyhits
$first=%dbkey($temp, %isvalue($temp, %max($temp)))
#DELKEY $temp $first
$second=%dbkey($temp, %isvalue($temp, %max($temp)))
that should define the two largest keys of your @bodyhits variable as $first and $second respectively |
|
_________________ Discord: Shalimarwildcat |
|
|
|
Rastamutti Beginner
Joined: 27 Jun 2012 Posts: 17
|
Posted: Thu Aug 09, 2012 12:34 pm |
Thanks! Easy and quick answer. Was hoping it was that way.
|
|
|
|
|
|
|
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
|
|