Hmm. I don't get why it is doing that... unless I got some code wrong. It should only heal if it drops under 50% of your maximum, not every time. The only reason it would not is if you used something that boosted you HP to more than double and that later dropped back to less than half of that max....
Also I am confused... Your previous statement was that you could only drink a potion to heal yourself every X seconds. This is an improved version of that, which will act in any case where your health is below the last 'normal' level, but it still acts on a delay. However, once you are completely healed it shouldn't continue to heal you:
<triggers>
<trigger
enabled="y"
match="^H\:(\d+) M\:(\d+) B\:(\d+)\% [.*]"
regexp="y"
send_to="12"
>
<send>if %1 > LastHP then
LastHP = %1
else
if %1 < LastHP then
if abs(datediff("s",ldrinktm,now)) > 2 then
send "heal"
ldrinktm = now
end if
end if
end if</send>
</trigger>
</triggers>
Yes, you can do what you asked though and simplify it to:
<triggers>
<trigger
enabled="y"
match="^H\:(\d+) M\:(\d+) B\:(\d+)\% [.*]"
regexp="y"
send_to="12"
>
<send>if %1 >= LastHP then
LastHP = %1
else
send "heal"
end if</send>
</trigger>
</triggers>
However, if you do that, then it is right back to healing you on 'every' single status prompt, even if you are currently unable to use a potion again, which is what you prevously said you wanted to avoid. It would be a heck of a lot easier if the prompt included something like H:500/2000, where you can see the maximum you are testing against, but...
You could however make an alias that set LastHP, so you can tell it what number to look for, however doing so means you need to remember to tell it what you max HP is every time you start, which the code above was supposed to avoid. |