Instructions are in the comments at the top.
And thanks to jacensolo, as I borrowed from his farm macro.
Code: Select all
|Written by Dregs
|------------------------------------------------------------------------------------------------------
|Usage:
|Run the macro and then make a hotkey that says /echo Slay Target
|Target what you want to kill, and hit the "Slay Target" hotkey.
|To cancel an attack, for healing, or running, or whatever,
|simply type (or make a hotkey and press it that says) /echo Cancel
|You can download my countexp.inc file for exp calculations,
|or just delete the parts #include Countexp.inc and /call CreateCountExpVariables
|The macro will rune fine without it.
|-------------------------------------------------------------------------------------------------------
#include Countexp.inc
#event CallAttack "[MQ2] Slay Target"
#event CallCancelAttack "[MQ2] Cancel"
#event CallCancelAttack "You have been slain#*#"
#event CallCancelAttack "You have been knocked unconscious!"
#event CallCancelAttack "You are bleeding to death!"
#event CallCancelAttack "Returning to Bind Location#*#"
#event CallCancelAttack "LOADING,#*#"
Sub Main
/declare AttackSwitch int outer 0
/call CreateCountExpVariables
/echo SlayTarget macro begun
:MainLoop
/doevents
/call AttackOff
/goto :MainLoop
/return
Sub Attack
/echo Attacking a level ${Target.Level} ${Target}.
/if (${Me.State.Equal[sit]}) {
/sit off
/delay 5
}
/if (${Target.ID} && ${AttackSwitch}==1) /face nolook
/delay 5
:combatloop
/doevents
/if (${Target.ID} && ${AttackSwitch}==1) /face fast nolook
/if (${Target.Distance}>10 && ${AttackSwitch}==1) {
/face fast nolook
/keypress forward hold
:moveloop
/doevents
/if (${Target.ID} && ${AttackSwitch}==1) /face fast nolook
/delay 1
/if (${Target.Distance}<6) /nomodkey /keypress forward
/if (${Target.Distance}>10 && ${AttackSwitch}==1) /goto :moveloop
/keypress forward
}
/doevents
/if (${Target.Distance}<15 && !${Me.Combat} && ${AttackSwitch}==1) /keypress q
/if (${Target.ID} && ${AttackSwitch}==1) /goto :combatloop
/return
Sub Event_CallAttack
/if (${Target.ID} && ${Target.Type.Equal[NPC]} && ${Target.Type.NotEqual[corpse]}) {
/varset AttackSwitch 1
/call Attack
}
/return
Sub AttackOff
/if (${Me.Combat}) /varset AttackSwitch 1
/if (!${AttackSwitch}==0 && ${Me.State.Equal[Stand]}) {
/if (!${Target.ID} || ${Target.Type.Equal[corpse]}) {
/attack off
/varset AttackSwitch 1
}
}
/return
Sub Event_CallCancelAttack
/call CancelAttack
/return
Sub CancelAttack
/if (${AttackSwitch}==1) {
/echo Canceling the attack
/attack off
/varset AttackSwitch 0
/if (!${Me.Speed}==0) /nomodkey /keypress forward
}
/return
