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
MyMiasma
Wanderer


Joined: 26 Oct 2012
Posts: 56

PostPosted: Fri Jan 25, 2013 8:11 am   

help with.. percentiles?
 
So recently I had posted a note on Zmud forum asking for help
with my healing. You showed me the the following:
---------------------------------------------------
#TR {HP: (%d)/(%d) SP: (%d)/(%d)} {
hpPerc=%eval((%float(%1)/%2)*100)
spPerc=%eval((%float(%3)/%4)*100)
#SAY {HP is at @hpPerc of max}
#SAY {SP is at @spPerc of max}
}
---------------------------------------------------
(here's what it looks like):
** HP: 185/214 SP: 169/214
HP is at 86.4485981308411 of max
SP is at 78.9719626168224 of max
** HP: 185/214 SP: 172/214
HP is at 86.4485981308411 of max
SP is at 80.3738317757009 of max
---------------------------------------------------
I am not a computer programming and I have no background
in any coding language so these scripts I make are mostly makeshift.

I bought Cmud now, so I'm not sure if that changes the trigger, but
I'm not entirely sure where to go from there, I've been browsing
help but I can't seem to puzzle out a good way of doing what I want.
It looks like #switch might work.


So what I want is an alias(or a series of aliases or something)
to do something like this:

-check if @hpPerc and @spPerc are within 20% of eachother.

- if no: runhealcommand for either HP or SP healing(whichever is lower),
check health.
(repeat until they are within 20%,)
- if yes: runhealcommand for healing both, checkhealth
(until they are both 95%+)

I'm sure you get the idea..
I guess I am fishing for an example here :)
and maybe a link dedicated to percentiles on Cmud

I'm not lazy! I'm just a dilettante when it comes to this stuff..

Your help is greatly appreciated!
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4796
Location: Pensacola, FL, USA

PostPosted: Fri Jan 25, 2013 8:47 am   
 
well i would make a seperate healing alias that the prompt trigger calls
It was a prompt right? If not, just add the command to check current values to the end of the alias

Code:
#ALIAS healCheck {
#LOCAL $difference $higher
#IF (@spPerc>@hpPerc) {
  $difference=(@spPerc-@hpPerc)
  $higher=sp
  } {
  $difference=(@hpPerc-@spPerc)
  $higher=hp
  }
#IF ($difference<20) {heal both} {#SWITCH ($higher) (hp) {heal hp} (sp) {heal sp}}
}


Then add the following line to the original trigger

#IF (@spPerc<95 OR @hpPerc<95) {healCheck}
_________________
Discord server
Reply with quote
MyMiasma
Wanderer


Joined: 26 Oct 2012
Posts: 56

PostPosted: Fri Jan 25, 2013 10:16 am   
 
Wow, that's exactly what I wanted.. you rock! thanks
_________________
It is better to die on your feet than to live on your knees.
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