Code: Select all
sub MoveToMob(Distancetomob)
/if (${Target.Distance}<${Distancetomob}) {
/face fast
/return
}
:Movementloop
/if (${Me.Speed}==0) {
/keypress up hold
}
/varcalc ObstCount ${ObstCount}+1
/if (${Bool[${Target}]}==0) {
/keypress up
/return
}
/face fast
/if (${Target.Distance}<${Distancetomob}) {
/face fast
/keypress up
/return
}
/if (${ObstCount}>=3) {
/delay 5
/call CheckObst
/goto :Movementloop
}
/if (${Target.Distance}>${Distancetomob}) /goto :MovementLoop
/return
Sub CheckObst
/if (${Math.Calc[${Math.Calc[${Math.Calc[${Math.Calc[${Me.Y}-${MyYLoc}]}^2]}+${Math.Calc[${Math.Calc[${MyXLoc}-${Me.X}]}^2]}]}^.5]}<2) /call Hitobst 5
/varset MyXLoc ${Me.X}
/varset MyYLoc ${Me.Y}
/return
Sub Hitobst(Delayofturn)
/keypress up
/keypress down hold
/if (${Math.Rand[100]}>50) {
/Delay 1s
/keypress down
/keypress Right hold
/Delay ${Delayofturn}
/keypress Right
/keypress up hold
/Delay 1s
/keypress up
} else {
/Delay 1s
/keypress down
/keypress left hold
/Delay ${Delayofturn}
/keypress left
/keypress up hold
/Delay 1s
/keypress up
}
:speedstop
/if (${Me.Speed}!=0) /goto :speedstop
/return
Oh yes, the error it puts out is: Calculate encountered a bad - formation, then spews out
Code: Select all
/if (${Math.Calc[${Math.Calc[${Math.Calc[${Math.Calc[${Me.Y}-${MyYLoc}]}^2]}+${Math.Calc[${Math.Calc[${MyXLoc}-${Me.X}]}^2]}]}^.5]}<2) /call Hitobst 5


