Excuse the sloppy code:
Code:
Func Rotate($x,$y)
While 1
update() ;to keep coords and rotation updated. Also has close function. You need a sort of update function
Local $targetXY[2] = [$x,$y] ;i have a gettargetxy function so i swapped it out to make it work for other people.
If Not Around($pXPos, $targetXY[0], 0.8) Or Not Around($pYPos, $targetXY[1], 0.8) Then ;Checks to see if current position is close to target pos.
$angle = _ATan2($targetXY[1] - $pYPos, $targetXY[0] - $pXPos) ;Some trigonomitry
Local $tempAngle = $angle - $pRotation ;to see the difference between the 2 angles. Used for later to check which way to turn
If $tempAngle < 0 Then ;makes sure its not less than zero
$tempAngle = $tempAngle + (2 * $pi);if it is, do a full circle example -1 = 259 degrees
EndIf
If $tempAngle < $pi Then ;if less than 180 degrees turn counter clockwise
While Not Around($pRotation, $angle, 0.08);checks to see if current rotation is close to target rotation
ControlSend("World of Warcraft", "", "", "{a down}");sends key to wow (wow can be minimized)
update()
WEnd
ControlSend("World of Warcraft", "", "", "{a up}")
Return
EndIf
If $tempAngle > $pi Then ;if more than 180 degrees turn clockwise
While Not Around($pRotation, $angle, 0.08)
ControlSend("World of Warcraft", "", "", "{d down}")
update()
WEnd
ControlSend("World of Warcraft", "", "", "{d up}")
Return
EndIf
EndIf
WEnd
EndFunc ;==>Rotate
That should rotate your character to the target xy... after that you can send w key to move forward.
Its probably best if you figure out how this function works then create your own so u learn something.