getbehind.inc - puts you behind and facing target

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

GoatFoot
a lesser mummy
a lesser mummy
Posts: 68
Joined: Fri Jan 17, 2003 1:48 am

getbehind.inc - puts you behind and facing target

Post by GoatFoot » Tue Jan 21, 2003 5:59 pm

y'all critique away. posted out of code blocks because of the "<>" issue.

---Begin---

sub getBehind
/if $char(state)!=STAND /stand
:gB_BeginLoop
/delay 0

/if $target()!=TRUE /goto :gB_EndLoop
/face nopredict
/varset bearing $calc($target(heading)-$char(heading))
/varadd bearing $if(n,$bearing<0,360,0)

/if n $tdist>15 /goto :gB_AdjDist
/if n $bearing>45 /if n $bearing<315 /goto :gB_Circle
/goto :gB_EndLoop

:gB_AdjDist
/if n $tdist>20 {
/face nopredict
/call AutoRun 1
}
if n $tdist<15 /if n $char(speed)>.50 {
/sendkey down ctrl
/press r
/sendkey up ctrl
}
if n $tdist<15 {
/call AutoRun 0
/face nopredict
}
/if n $tdist<14 /press down
/goto :gB_BeginLoop

:gB_Circle
/if n $bearing>91 /if n $bearing<270 {
/varset newheading $calc($char(heading)-$if(n,$bearing<180,45,-45))
/varsub newheading $if(n,$newheading>360,360,0)
/varadd newheading $if(n,$newheading<0,360,0)
/face heading $newheading
/sendkey down up
/delay 5
/sendkey up up
/goto :gB_BeginLoop
}
/sendkey down ctrl
/sendkey down $if(n,$bearing>180,left,right)
/sendkey up
/sendkey up $if(n,$bearing>180,left,right)
/sendkey up ctrl
/goto :gB_BeginLoop
:gB_EndLoop
/if n ($tdist<12 || $tdist>15) /goto :gB_AdjDist
/return


sub getCritterName
/varset l0 2
:loop_find_critter_name
/varadd l0 1
/if $arg($l0,"$p0")!=YOU /goto :loop_find_critter_name
| test for normal hit
/if "$p0"~~"points of damage"/varsub l0 2
/for l1 1 to $l0
/varset a(1,$l1) $arg($l1,"$p0")
/next l1
/return "$a(1,1) $a(1,2) $a(1,3) $a(1,4) $a(1,5)"

| Modified AutoRun to allow
| moving backwards.
| /call AutoRun <1|-1|0>
| 1 : move forwards
| 0 : all stop
| -1 : move Backwards

sub AutoRun
/if $char(speed)<.40 {
/sendkey down ctrl
/press r
/sendkey up ctrl
}
/if $p0==$l0 /return
/varset l0 $p0
/if n $p0>0 /sendkey down up
/if n $p0<0 /sendkey down down
/if $p0==0 {
/sendkey up up
/sendkey up down
}
/return


---End---

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Tue Jan 21, 2003 6:12 pm

Salutations,
this can be done simpler
[I mispelled code purposefully rizzy...]
[c0de]
| /call behind
| gets behind mob already targeted mob and faces them

sub behind
/sendkey down up
:gotopointloop
/if $combat==FALSE /call sitdown
/if $target()==FALSE /call sitdown
/face fast loc $calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10)
/doevents
/if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))>5 /goto :gotopointloop
/sendkey up up
/face
/return
[/code]

GoatFoot
a lesser mummy
a lesser mummy
Posts: 68
Joined: Fri Jan 17, 2003 1:48 am

Post by GoatFoot » Tue Jan 21, 2003 7:10 pm

I like this MUCH better.