Jump to content

Recommended Posts

Posted (edited)

i want to make macro (not game of course)...

i got several coordinat,let say : (x1,y1),(x2,y2),(x3,y3),(x4,y4),(x5,y5)

n i want to use that coordinat using MouseMove()

how can i get random coordinat everytime i start the program???

ie:

random()


func random()
mousemove(x1,y1) or (x2,y2) or (x3,y3) ;something like that??
sleep(20)
endfunc

pls help me...thx

Edited by HaNdLoRdz
  • Moderators
Posted

HaNdLoRdz,

Store the required coordinate pairs in an array and then use Random with the integer flag to return a random index for the pair to use. :graduated:

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

 

Posted

HaNdLoRdz,

Store the required coordinate pairs in an array and then use Random with the integer flag to return a random index for the pair to use. :graduated:

M23

hmmm...like this???

$array[0] = x1,y1
$array[1] = x2,y2
$array[2] = x3,y3
...etc...

mousemove(random($array[ ]))

hmm...sorry im still learning about array.,.,so i need help to fix it to be right code...

thx for the help

Posted

Also, you cannot use Random() as a user function, its a autoit native function.

So you should use _Random() for your function name.

oh ok JohnOne,,,thx for the help...

yeah i will use it..coz its just a sample code..the problem is with array condition,can i use :

$Array[0] = x1 , x2

???

  • Moderators
Posted

HaNdLoRdz,

A quick demo script: :graduated:

; Press Escape to exit
HotKeySet("{ESC}", "On_Exit")

Global $aCoords[4][2] = [ _
    [100, 100], _
    [200, 200], _
    [300, 300], _
    [400, 400]]

While 1
    ; Get random integer 0 to 3
    $iIndex = Random(0, 3, 1)
    ; And usse it to choose a pair of coordinates from the array
    MsgBox(0, "This time round", "We would click at" & @CRLF & $aCoords[$iIndex][0] & " x " & $aCoords[$iIndex][1])
WEnd

Func On_Exit()
    Exit
EndFunc

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

 

Posted

HaNdLoRdz,

A quick demo script: :graduated:

; Press Escape to exit
HotKeySet("{ESC}", "On_Exit")

Global $aCoords[4][2] = [ _
    [100, 100], _
    [200, 200], _
    [300, 300], _
    [400, 400]]

While 1
    ; Get random integer 0 to 3
    $iIndex = Random(0, 3, 1)
    ; And usse it to choose a pair of coordinates from the array
    MsgBox(0, "This time round", "We would click at" & @CRLF & $aCoords[$iIndex][0] & " x " & $aCoords[$iIndex][1])
WEnd

Func On_Exit()
    Exit
EndFunc

M23

argghhh,,.,damn u M23...u help me so much..LOL

Big THanx for u buddy...

i think i got enough from ur "Quick Script"

thx alot bro... :(

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
×
×
  • Create New...