Sign in to follow this  
Followers 0
Kickassjoe

_MouseMoveCircle()

12 posts in this topic

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.

Share this post


Link to post
Share on other sites



YES!

Thanks!!! :whistle:


Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key

Share this post


Link to post
Share on other sites

Useful for those times I need to draw a perfect circle =D


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

Share this post


Link to post
Share on other sites

Cyber, may I ask what you are using it for?

and fear... if you mean in paint, you can just press shift.... (paint is as advanced with graphics as I get)


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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Thanks Xythe, very cool. :shocked:

Mind sharing your diablo scripts?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Those examples are only a couple of years out of my league!

:shocked:


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

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0