Jump to content
Sign in to follow this  

Reading multiple variables and executing one at a time

Recommended Posts


Ok this may be hard to explain. I will start by giving a little background info on my project. Im working on a bot for a game there are only 2 more functions i need to add and one i am completely stuck on.

I have a function to perform clicks based on a set of x,y coords i give the bot. It will run an equation and based upon the window and it will perform controlclicks until the location is reached.

Now what i want it to do after the location is reached is read the ini file for the user defined coords and continue down the list.

So basically I need the bot to use a value predetermined in an ini then continue on to the next value and once all values are expired to start back at value1. I have tried this multiple ways and i just cant get it to work. The first coord works perfectly every time but the next functions always fail.

Here is some example code of the function im using to perform the clicks.

Func Move($x,$y)  ;;variable i need to change in a function to read the ini or user defined array
   Local $mouse[2],$mousedist =;click variable
   $cPos = CurrPos()
   $dX = $x - $cPos[0]
   $dY = $y - $cPos[1]
   If (If function to define where to click or if click is necessary) Then
         $hy =;equation
         $mouse[0] =;;equation
         $mouse[1] =;;equation
         ControlClick($title, "", "", "left", 1,)

As you can see the variables I need to change are $x and $y. Hopefully someone can help if you would like me to explain in a different way i don't mind just let me know.

Share this post

Link to post
Share on other sites

Just wanted to change the title.. Im new here and cant find the edit button. Any way was thinking this should be called

"How to use an INI file for an array?" or

"Whats the best way to change a variable after a function is completed?

*Edit: Weird i can edit this post but not my topic :/

Edited by Airninja6r

Share this post

Link to post
Share on other sites


Your questions in the second post make more sense (to me at least!).

How to use an INI file for an array? - If you get the coordinates into a suitable format in their file (coords & @CRLF & coords & @CRLF & coords & @CRLF & etc) you can use FileReadToArray to get these values into an array automatically. It is then easy to loop through them using a For...Next loop

Whats the best way to change a variable after a function is completed? - Use Return to send a value back to the calling code. You read it by using a variable:

; Set an original value
$Returned_Value = "Original"

; Set the variable to the returned value
$Returned_Value = Get_Return_Value()

; Show the value
MsgBox(0, "Returned value", $Returned_Value)


Func Get_Return_Value()

; Do your computations to get the new value

; Return it 
    Return "Changed!"

You can also use SetError to return up to 3 values - look in the Help file. If you need more, then use an array.

Hope that helps. Ask if you are unsure about anything.


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:


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


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