Jump to content

Making your own mouse move? (confusing)


Go to solution Solved by AlmarM,

Recommended Posts

  • Solution

I must say I'm rather confused as well, but I gave it a try. Here's what I came up with:

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

Global Const $iStepSize = 32

Global $iX = 0, $iY = 0
Global $iTargetX, $iTargetY

Global $hWnd = GUICreate("", 512, 512)

Global $hTargetLabel = GUICtrlCreateLabel("", -$iStepSize, -$iStepSize, $iStepSize, $iStepSize)
GUICtrlSetBkColor(-1, 0xFF0000)

Global $hLabel = GUICtrlCreateLabel("", $iX, $iY, $iStepSize, $iStepSize)
GUICtrlSetBkColor(-1, 0x0)

_RandomizeTargetLocation()

GUISetState()
While 1
    Switch GUIGetMsg()
        Case -3
            Exit

    EndSwitch

    ; loop

    If ($iX < $iTargetX) Then $iX += $iStepSize
    If ($iX > $iTargetX) Then $iX -= $iStepSize
    If ($iY < $iTargetY) Then $iY += $iStepSize
    If ($iY > $iTargetY) Then $iY -= $iStepSize
    GUICtrlSetPos($hLabel, $iX, $iY)

    If ($iX == $iTargetX And $iY == $iTargetY) Then
        Sleep(1000)
        _RandomizeTargetLocation()
    EndIf

    Sleep(300)
WEnd

Func _RandomizeTargetLocation()
    $iTargetX = Int(Random(0, 512, 1) / $iStepSize) * $iStepSize
    $iTargetY = Int(Random(0, 512, 1) / $iStepSize) * $iStepSize

    GUICtrlSetPos($hTargetLabel, $iTargetX, $iTargetY)
EndFunc

Func _Exit()
    Exit
EndFunc

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

It's just >this topic all over again. There too some perfectly serviceable examples were posted, and all you come up with is "it's not what I mean, let me repeat the same question in different words but just as ambiguously and vague". There it was moving the mouse in a circle. Just for fun, honest.

Even if you are hoping for someone to just code exactly what you want, you would do good in fact saying what exactly you want. You're like one of these Facebook people posting publicly "I'll find a way to survive after the tears have gone" and then doesn't want to speak to anyone offering consolation. It's really irritating.

Come on man, either admit it's for a game bot and accept your loss, or be more specific.

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

It seemed the OP wasn't really interested in how to move a mouse relatively, since he already know how to do so, but rather how to utilize his (or any) method into a basic path finding. As seen in my example.

Knowing this gives his posts so much more sense. :D

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

  • Moderators

Auio42TheWin,

If you made your question a little clearer from the outset you might have had an easier ride - as it is you are lucky that at least one person guessed your intent and that the Moderators here are patient and do not prejudge.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...