Credits to Mckorr for the object avoidance. It remains the same, but the logic to call it differs.
Please post improvements.
Code: Select all
#turbo 100
Sub Main
/zapvars
/declare distanceTimer timer
/call moveToLoc 2410 7074
/call moveToLoc 2697 7295
/endmacro
Code: Select all
Sub moveToLoc
/echo Moving to @Param1, @Param0.
/declare running local
/declare distanceNow local
/declare distanceBefore local
/declare distanceModifier local
/varset running 0
/varset distanceTimer 15
/varset distanceBefore $distance(@Param1,@Param0)
/varset distanceModifier 1
:moveToLocation
/face fast loc @Param1,@Param0
/if n $distance(@Param1,@Param0)<2 {
/sendkey up up
/return
}
/if n @distanceTimer==0 {
/if $char(sneaking)==TRUE {
/varset distanceModifier 2
} else {
/varset distanceModifier 1
}
/varset distanceNow $distance(@Param1,@Param0)
/if n $calc(@distanceBefore-@distanceNow)<$calc(10/@distanceModifier) {
/call strafePastObstacle
}
/varset distanceBefore $distance(@Param1,@Param0)
/varset distanceTimer 15
}
/if n @running==0 {
/press up
/if n $distance(@Param1,@Param0)>30 {
/varset running 1
/sendkey down up
}
} else {
/if n $distance(@Param1,@Param0)<31 {
/varset running 0
/sendkey up up
}
}
/goto :moveToLocation
/return
sub strafePastObstacle
/sendkey up up
/sendkey down down
/delay 2
/sendkey up down
/sendkey down ctrl
/if n $rand(99)>50 {
/sendkey down right
} else {
/sendkey down left
}
/delay 3
/sendkey up right
/sendkey up left
/sendkey up ctrl
/sendkey down up
/return