Two lines, HP =<20% then /keypress

Fridgecritter

Premium Member
Joined
May 14, 2011
Messages
49
Reaction score
6
Points
8
I have a macro I run now, on an emu server, and the server has a heal item. I was wondering if someone could teach me the syntax for adding a couple lines of code to my macro that checks to see if I am under 20 percent health, and if so, does a keypress. Thanks in advance.
 
  • Like
Reactions: EQDAB
I found another macro with a checkHP in it, but I'm not sure the format to string the two actions together. This is what I was thinking, but it doesn't work.


Sub CheckMyHPs
/if (${Me.PctHPs}<20{/keypress 6}) {
 
  • Like
Reactions: EQDAB
OK, I found a simpler macro that has a check health and a cast function, but it has different checks for levels of HP in it. If someone could help simplify this so it checks for 20 percent health, then does a keypress it would be awesome.


Code:
#turbo 40

Sub Main

  /declare HotSpellDuration string outer 21s
  /declare HotSpellTimer1 timer outer
  
  /declare MobID[150] int outer
  /declare j int outer
  /declare myMob int outer
  /declare MinimumHealth int outer 50
  /declare NumMobs int outer 1
  /declare MobAdded int outer 0
  /declare MobRadius int outer 50
  /declare PcId1 int outer 0
  /echo PL mac starting up. Setting PC ID's
  /varset PcId1 ${Spawn[pc "Insert_Your_Toon_Here"].ID}
 
  :loop
    /delay 1s
    /call CheckHealth
   /if (${NearestSpawn[1,NPC zradius 20].Distance}>${MobRadius}) /goto :loop
   /for myMob 1 to ${SpawnCount[NPC radius ${MobRadius} zradius 20]}
          /target id ${NearestSpawn[${myMob},NPC zradius 20 radius ${MobRadius}].ID}
          /delay 1s ${Target.ID}==${NearestSpawn[${myMob},NPC zradius 20 radius ${MobRadius}].ID}
          /if (${Target.PctHPs}<${MinimumHealth} ) {
              /cast 1         
          }
     }
     /call CheckHealth
  /next myMob
  /doevents
  /goto :loop
/return

 Sub CheckHealth
    /target targetable id ${PcId1}
    /delay 1s ${Target.ID}==${PcId1}
    /call HealTarget   
/return

Sub HealTarget
    
    /if (${Target.PctHPs} > 95) /return
    /if (${Target.PctHPs} <40) {
        /echo Casting patch heal on ${Target.ID}
        /cast 2
        /return
    }
    /if (${Target.PctHPs} < 70) {   
        /echo Casting big heal on ${Target.ID}
        /cast 3
        /return
    }
    /if (${Target.PctHPs} <95) {
        /if (${Target.ID}==${PcId1} && !${HotSpellTimer1} ) {
            /echo Casting HoT on ${PcId1}
            /cast 4
            /varset HotSpellTimer1 21s           
        }
        /return
    }
/return
 
  • Like
Reactions: EQDAB
I found another macro with a checkHP in it, but I'm not sure the format to string the two actions together. This is what I was thinking, but it doesn't work.


Sub CheckMyHPs
/if (${Me.PctHPs}<20{/keypress 6}) {

Code:
Sub CheckMyHPs
  /if (${Me.PctHPs}<20) {
    /nomodkey /keypress 6
  }
  /return
 
  • Like
Reactions: EQDAB
For that 2nd one, try it by just changing the sub HealTarget to do your keypress, like:

Code:
Sub HealTarget
    /if (${Target.PctHPs} <20) {
        /echo Casting heal on ${Target.Name}
        /nomodkey /keypress 6
    }
/return
 
The heal item I have requires me to target myself first. How would I accomplish that? The /keypress TAB isn't working. Thanks for your help btw.
 
  • Like
Reactions: EQDAB
The heal item I have requires me to target myself first. How would I accomplish that? The /keypress TAB isn't working. Thanks for your help btw.
I am really new to this stuff so I don't really know but have you tried /keyless f1 ?
 
  • Like
Reactions: EQDAB