In my macro I want to give a bot a command to cast on a mob. If the mob is out of range the bot should get into casting range and cast the spell.
Ok this is how I have sloved it and it works but my problem is that when the bot gets in range he stops and starts casting he is always interrupted. I guess this is movement lag but not sure.
Please give me some tips how I could make it so that he isn't interrupted all the time.
Thanks,
a_large_rat01
Code: Select all
Sub SnareSub
/if n $spell("Ensnare",mana)>$char(mana,cur) {
/tell $Master Sorry to low on mana to '$p2', Mana: $char(mana,pct), HP: $char(hp,pct)
/return
}
/stand
/assist $Master
/delay 6
/if n $spell("Ensnare",range)<$target(distance) {
/tell $Master %T Out of range
/call GoTargetNEW $spell("Ensnare",range)
}
/tell $Master Ensnaring %T
:ReSnare
/call cast "Ensnare"
/if n $return==4 {
/tell $Master %T Out of range
/call GoTargetNEW $spell("Ensnare",range)
/doevents
/goto :ReSnare
}
/tell $Master %T is ensnared, Mana: $char(mana,pct), HP: $char(hp,pct)
/target $Master
/return
Sub GoTargetNEW
| $p0 is minimum distance needed to cast
/if n $p0>0 {
/varset v91 $p0
} else {
/varset v91 15
}
/stand
/face nopredict
/varset v90 $target(id)
/varset t0 5m
/tell $Master OMW to %T
:CloserAFN
/doevents
/if "$target(id)"!="$v90" /goto :EndAFN
/if n $target(distance)>$calc($v91-2) /call AutoRun 1
/if n $target(distance)<$calc($v91) /goto :EndAFN
/face nopredict
/doevents
/if n $t0==0 /press esc
/goto :CloserAFN
:EndAFN
/call AutoRun 0
/tell $Master stopped
/doevents
| /sit
/return
Sub AutoRun
/if $p0==$v80 /return
/varset v80 $p0
/if $p0==1 /sendkey down up
/if $p0==0 /sendkey up up
/return 
