Airninja6r Posted February 15, 2009 Share Posted February 15, 2009 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 EndIf ControlClick($title, "", "", "left", 1,) Sleep(100) SetError(0) Else SetError(1) EndIf EndFunc 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. Link to comment Share on other sites More sharing options...
Airninja6r Posted February 16, 2009 Author Share Posted February 16, 2009 (edited) 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 February 16, 2009 by Airninja6r Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 17, 2009 Moderators Share Posted February 17, 2009 Airninja6r,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 loopWhats 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) Exit Func Get_Return_Value() ; Do your computations to get the new value ; Return it Return "Changed!" EndFuncYou 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.M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now