| AFMELEE.mac initial version v04.01.08
| 04.01.09 added leashing
| 04.26.09 added param based arguments
| 05.12.09 added many checks for zone
#turbo 5
#Event ComeTo "#*#come to me#*#"
#Event Hidem "#*#Hide Em#*#"
#Event Zoned "LOADING, PLEASE WAIT...
Sub Main
|------------READ THIS SECTION AND EDIT IF NEEDED-----------|
|-- Set spell casting order here
/assist off
/declare mainassist string outer ${Param0}
/declare autoassist int outer 1
/declare autoassisthealth int outer ${Param1}
/declare autoleash bool outer ${Param2}
/declare stakeX int outer ${Me.X}
/declare stakeY int outer ${Me.Y}
/declare leashlength int outer 50
/declare leashholder string outer Nobody
/declare leashflex int outer 25
/declare StartZone int outer ${Zone.ID}
|------------END EDITING------------------------------------|
/declare boolInCombat bool inner FALSE
/if (!${Defined[Param0]}) {
/echo Proper usage: /macro assist TankName assisthealth autoleash
/end
}
/echo Assisting: ${mainassist}, at ${autoassisthealth}, and leashing: ${autoleash}
|------------BEGIN ROUTINES------------------------------------|
/echo AFMelee Active
:mainloop
/if (${GameState.Equal[CHARSELECT]}) /end
/if (${Zone.ShortName.Equal[GuildLobby]}) {
/sit
/delay 10m
/camp desktop
}
/if (${Zone.ID} != ${StartZone}) {
/sit
/delay 10m
/camp desktop
}
/call CheckEvents
|-----------------------------
|-- check to see if I should attack
/delay 1
/assist ${mainassist}
/delay 1
|-----------------------------
|-- check to see if I am in combat, if I am, then set it as such, so I don't go and reassist.
/if (${Melee.Status.NotEqual[WAITING]}) {
/varset boolInCombat FALSE
} else {
/varset boolInCombat TRUE
}
|-----------------------------
|-- if not in combat, and I should be assisting, and killing, do so;
|-- the boolInCombat flag keeps from from banging autoattack over and over.
/if ((${autoassist}==1) && (${Target.Type.Equal[NPC]}) && (${Target.PctHPs}<= ${autoassisthealth}) && (${boolInCombat} == FALSE) && ${${mainassist}.Distance}<50) {
/varset boolInCombat TRUE
/attack on
}
|-----------------------------
|-- should I leash?
/if ((${autoleash} == TRUE) && ${leashholder.Equal[Nobody]} && (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}>${leashlength})) {
/goto :LeashStart
}
/goto :mainloop
|-----------------------------
|-- leashing, ganked from RH
:LeashStart
/if (${leashholder.Equal[Nobody]} && (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}>${Math.Calc[${leashlength}*${leashflex}/100]})) {
/echo Moving closer to the Stake... ${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]} ft. away
/face ${If[${Me.Underwater},,nolook]} loc ${stakeY},${stakeX}
/keypress forward hold
/delay 1s ${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}<${Math.Calc[${leashlength}*${leashflex}/100]}
/keypress forward
/if (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}<${Math.Calc[${leashlength}*${leashflex}/100]}) {
/echo Arrived near enough to the Stake.
/face fast ${If[${Me.Underwater},,nolook]} away loc ${stakeY},${stakeX}
/keypress esc
/goto :mainloop
}
/if (${Zone.ID} != ${StartZone}) {
/sit
/delay 10m
/camp desktop
}
/goto :LeashStart
/return
Sub CheckEvents
/delay 1
/doevents
/return
|--------------------------------------------------------------------------------
|SUB: WARP to ASSIST
|--------------------------------------------------------------------------------
Sub Event_ComeTo
/echo Following Main Assist
/target ${mainassist}
/delay 10
/target ${mainassist}
/delay 1
/warp t
/delay 1
/declare stakeX int outer ${Me.X}
/declare stakeY int outer ${Me.Y}
/return
Sub Event_Hidem
/echo Hiding corpses
/hidecorpse npc
/return
|--------------------------------------------------------------------------------
|SUB: Zoned
|--------------------------------------------------------------------------------
Sub Event_Zoned
/echo Zoned
/444