Page 1 of 1

Bad Value in $char(hp,pct) and $char(hp,cur)

Posted: Tue Dec 16, 2003 12:30 am
by Seagreen500
I was trying to auto heal myself when my hp % got below 75.

/if n $char(hp,pct)<75 {
/call nofizzlecast "Greater Healing"
/echo $char(hp,pct)
/echo $char(hp,cur)
}

It was calling the heal all the time it seemed, even when my hps were high. The debug /echo's I added pointed to a problem with $char(hp,xxx) reporting an incorrect value from the client. IE: if I had 99%, it would sometimes /echo as 69, and my cur HP's would /echo as about 69% of there actual value.

Playing with the value after the operator < XX
actual 80 % would trigger at 50
actual 99 % would trigger any value over 69

So as it is, I'm leaving it at 50, it heals always below 50, and sometimes below 80.

Hope this makes sense $$

Posted: Tue Dec 16, 2003 12:41 am
by Raebis
from what i've noticed, if you repeatedly hit /echo $char(hp,pct) like 3 times a second with a health of %80 you'd get somethign like:

Code: Select all

80
60
80
80
60
80
60
To get around this :

i used a counter that everytime a less than kosher hp was reported it increased by one and when it got to 5 it would cast the heal.
at any time if the hp report was above kosher level it would reset the counter to 0... so basically you would have to have 5 unkosher hp reports in a row before the heal would be cast

Code: Select all


/if n $char(hp,pct)<70 {      | if Health Below 70% then:
   /varadd HealthCount 1      | Add 1 to health counter
   /if n @HealthCount>=5 {    | If healthcounter >= 5 then:
      /call nofizzlecast "Greater Healing"      
      /varset HealthCount 0   | Reset the health counter so we don't cast it again rite away
   }
} else {                      | If health is above 70% then
   /varset HealthCount 0      | Reset the health counter
}

Posted: Tue Dec 16, 2003 3:33 am
by Lax
The problem is those parms dont call the current health function, they grab it directly from the struct. As we discovered with the hp regen issues, the max health in the structure fluctuates. I'll see that it gets fixed.

Posted: Tue Dec 16, 2003 4:17 am
by Raebis
Lax wrote:The problem is those parms dont call the current health function, they grab it directly from the struct. As we discovered with the hp regen issues, the max health in the structure fluctuates. I'll see that it gets fixed.
thanks lax, it will make a few of my macs a lot shorter