Check HP Sub

Krugerr

Maxxor Haxxor
Joined
Jan 18, 2008
Messages
957
Reaction score
1
Points
18
Location
England
Ok, im cant for the life of me remember the snippet, or find it.


what im looking for, calls a sub, then the sub checks HP%, sits and meds until its at % and then resumes, cant get mine to work
 
Last edited by a moderator:
I think this would work.


Code:
sub hpcheck
:loop
/if (${Me.PctHps}<30) {
  /sit
 /delay 20s
 /goto :loop
}

/if (${Me.PctHps}>95) {
  /echo All healed up lets rock!
  /stand
 /return
}

/goto :loop
 
Hm, thats identicle to what i had, but it works, so i musta had some stupid error *growl*


Thanks !!
 
I think this would work.


Code:
sub hpcheck
:loop
/if (${Me.PctHps}<30) {
  /sit
 /delay 20s
 /goto :loop
}

/if (${Me.PctHps}>95) {
  /echo All healed up lets rock!
  /stand
 /return
}

/goto :loop

Your code would spam "/echo All healed up lets rock!", and that 20 second delay is unnecessary

Code:
sub hpCheck
/if (${Me.PctHps}<30) {
/call sitHeal
}
/return

sub sitHeal
:wait
/if (${Me.State.NotEqual[SIT]}) /sit
/if (${Me.PctHps}>95) {
/delay 7s
/echo All healed up lets rock!
/if (${Me.State.NotEqual[STAND]}) /stand
/return
}
/goto :wait
/return
 
Your code would spam "/echo All healed up lets rock!", and that 20 second delay is unnecessary

Code:
sub hpCheck
/if (${Me.PctHps}<30) {
/call sitHeal
}
/return

sub sitHeal
:wait
/if (${Me.State.NotEqual[SIT]}) /sit
/if (${Me.PctHps}>95) {
/delay 7s
/echo All healed up lets rock!
/if (${Me.State.NotEqual[STAND]}) /stand
/return
}
/goto :wait
/return


I can't figure out why you would have a 7 second delay after verifying that the hps are over 95%... Also why have two sub routines for one function?

Here is a slightly more complex sub that can be used in wider variety of situations.

Code:
Sub hpCheck(int sitHPs, int standHPs)
   /if (!${Defined[sitHPs]}) /declare sitHPs int local 30
   /if (!${Defined[standHPs]}) /declare standHPs int local 95
   /if (${standHPs} <= ${sitHPs}) /varset standHPs 95

   :sitLoop
      /if (${Me.PctHPs} < ${sitHPs}) {
         /if (!${Me.Sitting}) /sit on
         /delay 1s
         /doevents
      } else /if (${Me.PctHPs} > ${standHPs}) {
         /echo All healed up.  Let's rock!
         /stand
         /return
      }
   /goto :sitLoop
/return

This way you could use the same sub in any situation without having hard coded variables (except for the defaults if the values are omitted in the /call), makes it easier to reuse in different situations.

Also including the return as an else if will save processor time since it should not even be evaluated if the first /if validates.

But of course this is just my suggestion, I like to write commonly used subroutines to be as versatile as possible =P
 
Your code would spam "/echo All healed up lets rock!", and that 20 second delay is unnecessary

Code:
sub hpCheck
/if (${Me.PctHps}<30) {
/call sitHeal
}
/return

sub sitHeal
:wait
/if (${Me.State.NotEqual[SIT]}) /sit
/if (${Me.PctHps}>95) {
/delay 7s
/echo All healed up lets rock!
/if (${Me.State.NotEqual[STAND]}) /stand
/return
}
/goto :wait
/return


I can't figure out why you would have a 7 second delay after verifying that the hps are over 95%... Also why have two sub routines for one function?

Here is a slightly more complex sub that can be used in wider variety of situations.

Code:
Sub hpCheck(int sitHPs, int standHPs)
   /if (!${Defined[sitHPs]}) /declare sitHPs int local 30
   /if (!${Defined[standHPs]}) /declare standHPs int local 95
   /if (${standHPs} <= ${sitHPs}) /varset standHPs 95

   :sitLoop
      /if (${Me.PctHPs} < ${sitHPs}) {
         /if (!${Me.Sitting}) /sit on
         /delay 1s
         /doevents
      } else /if (${Me.PctHPs} > ${standHPs}) {
         /echo All healed up.  Let's rock!
         /stand
         /return
      }
   /goto :sitLoop
/return

This way you could use the same sub in any situation without having hard coded variables (except for the defaults if the values are omitted in the /call), makes it easier to reuse in different situations.

Also including the return as an else if will save processor time since it should not even be evaluated if the first /if validates.

But of course this is just my suggestion, I like to write commonly used subroutines to be as versatile as possible =P

i am trying to add a check into this for combat. but so far i am not able to add one into it. here is what i have done. i want it to continue combat if i am not in cooldown state.

Code:
Sub EndCheck(int sitEndurance, int standEndurance)

   /if (!${Defined[sitEndurance]}) /declare sitEndurance int local 70
   /if (!${Defined[standEndurance]}) /declare standEndurance int local 95
   /if (${standEndurance} <= ${sitEndurance}) /varset standEndurance 95


   :sitLoopend
      /if (${Me.PctEndurance} < ${sitEndurance} && ${Me.CombatState.Equal[COOLDOWN]}) {
         /if (!${Me.Sitting}) /sit on
         /delay 1s
         /doevents
      } else /if (${Me.PctEndurance} > ${standEndurance}) {
         /echo All Enduranced up.  Let's rock!
         /stand
         /return
      }
   /goto :sitLoopend
/return

I took your hp one also but made this one off of that.
 
You can not get to cool down if you are in combat.

Explain more of what you actually want to do.
 
Right now what it is doing is that when i have 2 or more mobs in camp it will kill the first one just fine but if endurance is below 70% it will stop and sit to med with the next mob still in camp. what i want it to do is i want all mobs dead befor it sits and meds up. or should i just add a mob check in there to do that.
 
i was able to fig it out i had my call endcheck in the wroung place in the mac it is working great now.