Jump to content

_MouseMoveCircle()


Kickassjoe
 Share

Recommended Posts

I don't know if this is helpful to anyone, but here it is...

Func _MouseMoveCircle($xcenter, $ycenter, $radius)
$r2 = $radius * $radius


For $y = 0 to $radius
$x = int(sqrt($r2 - $y * $y) + 0.5)
Mousemove($xcenter - $x, $ycenter + $y, 0)
Next

For $x = 0 to $radius
$y = int(sqrt($r2 - $x * $x) + 0.5)
Mousemove($xcenter + $x, $ycenter + $y, 0)
Next

For $y = 0 to $radius
$x = int(sqrt($r2 - $y * $y) + 0.5)
Mousemove($xcenter + $x, $ycenter - $y, 0)
Next

For $x = 0 to $radius
$y = int(sqrt($r2 - $x * $x) + 0.5)
Mousemove($xcenter - $x, $ycenter - $y, 0)
Next

EndFunc

It moves the mouse in a circle, with the specified radius, around a specified point.

I don't know of anything this would be useful for, except maybe modified to be useful for pixelsearches, but I had nothing else to do earlier, so, tell me what you think.

What goes around comes around... Payback's a bitch.

Link to comment
Share on other sites

  • 3 weeks later...

Helpful yes, but excess code

Func _MouseMoveCircle($x, $y, $r, $t); x coord, y coord, radius, time to loop (milliseconds)
    $tInit = TimerInit()
    While 1
        $timer = TimerDiff($tInit)
        MouseMove($x + ($r * Sin($timer/100)), $y + ($r * Cos($timer/100)) ,1); simple math :P
        If $timer > $t Then ExitLoop
    WEnd
EndFunc

That one wont stop after going a full circle, I've used similar code to find monsters in diablo 2 :shocked:

That diablo monster search function increased radius in every cycle thus making not circle but a spiral ^^

Could be used in.. hmm let's see, finding a corpse to loot near the player?

Edited by Xythe

I code bots :: Need a bot? :: xythec@gmail.com

Link to comment
Share on other sites

I used to play Diablo 2. Evan better way is you use a funtion in bliz32.dll i think and it will return an array with all clickable things, their coordnates and your coordnates. amazingly useful for making bots ;P

Edit: Spelling

Edited by fear1313

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

Hmm, using dll's works better but that's merely an example of optimized code.. hmm I can't edit that last post so I have to type the damn thing again here

A bit more optimization

Func _MouseMoveCircle($x, $y, $r, $t); x coord, y coord, radius, time to loop (milliseconds)
    $tInit = TimerInit()
    Do
        $timer = TimerDiff($tInit)
        MouseMove($x + ($r * Sin($timer/100)), $y + ($r * Cos($timer/100)) ,1); simple math :P
    Until $timer > $t
EndFunc

I code bots :: Need a bot? :: xythec@gmail.com

Link to comment
Share on other sites

It can be done easier

just use Cos and Sin

CODE

;$ is the radius

;$x and $y represent the center of the circle

$r = 200

$x = 400

$y = 400

For $angle = 0 to 20 step 0.1

Mousemove($x + $r * Cos($angle),$y + $r * Sin($angle),0)

sleep(10)

Next

Link to comment
Share on other sites

Gah, trigonometry. Were going over that in math class right now and I just don't have the brain capacity for it.

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

Cool little script.. sparked my interest so I made it so your mouse moves in a spiral.

Open up MS Paint, place your mouse cursor somewhere to draw and press the Enter key. It draws a spiral!!!

#include <Misc.au3>

HotKeySet("{ESC}","_Exit")

While 1
    Local $pos = MouseGetPos()
    If _IsPressed("0D") Then _MouseMoveCircle($pos[0],$pos[1], 1, 7000)
        Sleep(1000/@DesktopRefresh)
WEnd

Func _MouseMoveCircle($x, $y, $r, $t); x coord, y coord, radius, time to loop (milliseconds)
    $tInit = TimerInit()
    MouseDown("left")
    Do
        $timer = TimerDiff($tInit)
        $r += 0.1 ;Increase radius a little bit at a time to make spiral
        MouseMove($x + ($r * Sin($timer/100)), $y + ($r * Cos($timer/100)) ,1); simple math :P
    Until $timer > $t
    MouseUp("left")
EndFunc

Func _Exit()
    Exit
EndFunc
Edited by Toady

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...