Hello guys,
For those who are eager to put Autoit into action for use with CABAL, you would be glad with this post.
Lots of people PMed me on how did I manage to rotate my character so that it faces the right direction when botting.
I do that using trigonometry! (oh no)
But don't run away - yet
Complicated as it seems, it is just this function in AutoIt that does the magic.
the return value of that function is the angle between your current position and your target position.
But hey, how would I know my current location?
See my siggy
Ok, but how would I know the target location?
Huh? Just go there and record the coordinates!
Oh sorry, one last question. How would I know how long to press the 'a' for left or 'd' for right to rotate my character?
Good question.
Based on my experiments, one full character rotation is approx 7560 ms. Ok, I will not make you dizzy with computation.
Here is the code:
What it does is hold 'a' for a period of 21ms per degree - (assuming 1 degree is 21 ms hold of the key - then 360 degrees = 7560 ms. )
As an example, if you got 45 as a result of the _Degree function above, then call _rotateLeft(45)
The code for rotation to the right is just as simple
I hope this post is not confusing as it seems. I made it as simple as possible so others could learn.
Leechers will be confused. Learners will benefit from this post. Happy holidays!
UPDATE---Example:
If your current coordinate is (10,22) and you want to bot at location (100,120)
[Only registered and activated users can see links. Click Here To Register...]
Degrees returns 47
we just need to call _rotateLeft(47) to rotate our character
For those who are eager to put Autoit into action for use with CABAL, you would be glad with this post.
Lots of people PMed me on how did I manage to rotate my character so that it faces the right direction when botting.
I do that using trigonometry! (oh no)
But don't run away - yet
Complicated as it seems, it is just this function in AutoIt that does the magic.
Code:
_Degree(_ATan2($targetY - $currentY, $targetX - $currentX)
But hey, how would I know my current location?
See my siggy
Ok, but how would I know the target location?
Huh? Just go there and record the coordinates!
Oh sorry, one last question. How would I know how long to press the 'a' for left or 'd' for right to rotate my character?
Good question.
Based on my experiments, one full character rotation is approx 7560 ms. Ok, I will not make you dizzy with computation.
Here is the code:
Code:
Func _rotateLeft($ntimes)
AutoItSetOption("SendKeyDownDelay", $ntimes * 21)
Send("a")
EndFunc ;==>_rotateLeft
As an example, if you got 45 as a result of the _Degree function above, then call _rotateLeft(45)
The code for rotation to the right is just as simple
Code:
Func _rotateRight($ntimes)
AutoItSetOption("SendKeyDownDelay", $ntimes * 21)
Send("d")
EndFunc ;==>_rotateRight
Leechers will be confused. Learners will benefit from this post. Happy holidays!
UPDATE---Example:
If your current coordinate is (10,22) and you want to bot at location (100,120)
[Only registered and activated users can see links. Click Here To Register...]
Degrees returns 47
we just need to call _rotateLeft(47) to rotate our character