Jump to content
Razielex

Code for Eclipse mouse move

Recommended Posts

Razielex

Well i found some old posts and edited the code little bit (original made by WeaponX) and got what i wanted.

I wanted to say Thank you for everybody that helped me.

If anybody had a same problem here is the code: 

#include <Math.au3>
Global $pointa = 635
Global $pointb = 850
Global $speed = 1

Global $radiusdiff = $pointa - $pointb
moveMouseCircle($pointa / 2, $pointb / 2, $radiusdiff, $pointa, 90, $speed, 1)

Func moveMouseCircle($h, $k, $radius, $direction = 0, $startangle = 0, $delay = 10, $step = 1)
    $pi = 3.14159265358979

    If $direction Then
        $startangle = 90 - $startangle
    EndIf

    $start = $startangle
    $end = 180

        For $A = $start to $end Step $step
            If $direction Then
                $X = $h - sin(_Radian($A)) * $radius
            Else
                $X = $h + sin(_Radian($A)) * $radius
            EndIf
            $Y = $k - cos(_Radian($A)) * $radius
            MouseMove ( $X, $Y, 0)
            Sleep($delay)
        Next
        $start = 0
        Exit
        $end = $startangle

EndFunc

I would be very thankfull if some moderator moved this topic to where it belongs, thank you.

Share this post


Link to post
Share on other sites
JLogan3o13

@Razielex Please explain how this is any different than the last two that were locked? This is your third one, so make it good.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Razielex

Difference is that i figured it out on my own when nobody is able to help because the only thing what i clearly want is to Automate a game, bravo. I never wanted to automate a game where is fun in that? You make some hack and then use it in advantage - I never did that and i don't even want to do it. The only thing i wanted to do is entertaining videos with mirrored synced mouse movement . Osu! is best choice for me because there are songs which are synced with mouse movement. In the game is even anti-cheat system which would ban me instanly and thats why i'm even offline when i'm testing it. The code what i'm now using doesn't even works properly but i don't want to make another post about it because obviously everybody who is doing something with Autoit and game is filthy cheater and automater. I don't even know why i thinked that somebody would help me here. Sorry for spaming and i'm sorry for every moderator that lost time with me. Have a nice day, -Kevin

Share this post


Link to post
Share on other sites
Jos

The forum rules are clear and simple, so should be easy for anybody to understand, so your arguments do not stick here.  

8 minutes ago, Razielex said:

Have a nice day, -Kevin

You too Kevin and assume this was your last post here. ;) 

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Malkey

The logic of the first post example is a bit suspect.   A possible eclipse of the sun.
For example, the radius of the circle is being calculated from the difference of twice the values of the X and Y coordinates of the center point of the circle.

Here is an example of elliptic movement of the mouse with or without a background image of the ellipse   (See $ShowEllipsePath parameter).

#include <WindowsConstants.au3>
#include <WinAPIGdi.au3>

Local $CenterPointa    = @DesktopWidth / 2
Local $CenterPointb    = @DesktopHeight / 2
Local $iWidthEllipse   = 300
Local $iHeightEllipse  = 500
Local $Direction       = 0   ; 0 - cursor moves in clockwise (True/False)
Local $StartAngle      = 180 ; 180 - At bottom of ellipse
Local $EndAngle        = 360 * 2
Local $speed           = 10 ; Minimum value is 10
Local $step            = 1
Local $ShowEllipsePath = 1  ; 0 to hide elliptic path. (True/False)

_MouseMoveElliptic($CenterPointa, $CenterPointa, $iWidthEllipse, $iHeightEllipse, $Direction, $StartAngle, $EndAngle, $speed, $step, $ShowEllipsePath) ;


; $h, $k  - X and Y co-ordinates of the center of the ellipse, where major and minor axes cross.
; If $DiaW = $DiaH then this elliptic special case is a circle.
; $bAntiClockwise = 0 - cursor moves in clockwise rotation; Or, = 1 - cursor moves in anti-clockwise direction.
; $StartAngle or $EndAngle - If (= 0 or = 360) then cursor is at top of ellipse;
;                           If (= 90 and $bAntiClockwise = 0) or (= 270 and $bAntiClockwise = 1) then cursor is half way up/down on right side of ellipse.
;                           If $EndAngle < $StartAngle then the mouse direction will be opposite of what the $bAntiClockwise parameter is stating.
; $ShowEllipse = 1 - Will show the elliptic path the cursor takes;  = 0 - Will hide elliptic path
;
Func _MouseMoveElliptic($h, $k, $DiaW, $DiaH, $bAntiClockwise = 0, $StartAngle = 0, $EndAngle = 360, $delay = 10, $step = 1, $ShowEllipse = 1)
    Local $pi = 4 * ATan(1)
    If $EndAngle < $StartAngle Then $step *= -1 ; Enables For-Next loop to work with this condition, and, reverses mouse direction.

    If $ShowEllipse Then  ; 1 of 3 "If $ShowEllipse Then"
        Local $hPen = _WinAPI_CreatePen($PS_SOLID, 3, 0xFF0000) ; 0xBBGGRR hex colour format.
        Local $hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
        Local $o_Orig = _WinAPI_SelectObject($hDC, $hPen)
        Local $tRECT = _WinAPI_CreateRect(0, 0, $DiaW, $DiaH) ; Total width and height of ellipse.
        _WinAPI_OffsetRect($tRECT, $h - $DiaW / 2, $k - $DiaH / 2) ; Rectangle origin is top-left corner. So, converts center of ellipse to top-left corner of ellipse.
    EndIf

    For $A = $StartAngle To $EndAngle Step $step
        $X = ($bAntiClockwise ? $h - Sin(($pi * $A) / 180) * $DiaW / 2 : $h + Sin(($pi * $A) / 180) * $DiaW / 2) ; Conditional operator dependant on $bAntiClockwise.
        $Y = $k - Cos(($pi * $A) / 180) * $DiaH / 2
        If $ShowEllipse Then _WinAPI_Ellipse($hDC, $tRECT)  ; 2 of 3 "If $ShowEllipse Then"
        MouseMove($X, $Y, 0)
        Sleep($delay)
    Next

    If $ShowEllipse Then  ; 3 of 3 "If $ShowEllipse Then"
        _WinAPI_ReleaseDC($hDC, $o_Orig)
        _WinAPI_ReleaseDC(0, $hDC)
        _WinAPI_DeleteDC($hDC)
        _WinAPI_DeleteObject($hPen)
        _WinAPI_RedrawWindow(WinGetHandle("", ""), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) ; Clear any remnants of the Ellipse's path form window.
    EndIf
EndFunc   ;==>_MouseMoveElliptic

 

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

×