JuggaloZeke Posted September 18, 2010 Share Posted September 18, 2010 (edited) I've got a script that I am trying to get to store mouse coords to load on later uses. I tried the iniWrite/Read commands but I guess I don't understand how the mouseGetPos returns the coordinates so it isn't storing them properly... or at all, actually, haha. Script included for reference... and hey, if you see a way to optimize anything in it, feel free to let me know! I am terrible at this stuff. Edited September 20, 2010 by big_daddy Removed Script Example Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 18, 2010 Moderators Share Posted September 18, 2010 JuggaloZeke,automate jobs in the Facebook gamePlease read this, Then you will not be surprised when you get no help here. 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...
seandisanti Posted September 18, 2010 Share Posted September 18, 2010 I've got a script that I am trying to get to store mouse coords to load on later uses. I tried the iniWrite/Read commands but I guess I don't understand how the mouseGetPos returns the coordinates so it isn't storing them properly... or at all, actually, haha.ok, first the obligatory "we don't discuss game automation of any kind here". That said, in regards to the file IO question that has nothing to do with the game. It looks like you're using the functions correctly, assuming that your ini file is formatted to match your function calls. If you want someone to verify that, you'd have to post the contents of your ini file also (but i wouldn't expect a whole lot of help on that front because of the purpose of your script). As far as changes that i'd make. You give the user the option to load preferences without checking if the file exists, that's an error waiting to happen. Also you're using sleeps for execution control, but that's really imprecise. You should be able to check a pixel for a color on some part of the screen to let you know when it's ok to progress to the next step. Link to comment Share on other sites More sharing options...
JuggaloZeke Posted September 18, 2010 Author Share Posted September 18, 2010 (edited) JuggaloZeke, Please read this, Then you will not be surprised when you get no help here. M23 Oh hey new guy, did I ask for help with game automation? Didn't think so. ok, first the obligatory "we don't discuss game automation of any kind here". That said, in regards to the file IO question that has nothing to do with the game. It looks like you're using the functions correctly, assuming that your ini file is formatted to match your function calls. If you want someone to verify that, you'd have to post the contents of your ini file also (but i wouldn't expect a whole lot of help on that front because of the purpose of your script). As far as changes that i'd make. You give the user the option to load preferences without checking if the file exists, that's an error waiting to happen. Also you're using sleeps for execution control, but that's really imprecise. You should be able to check a pixel for a color on some part of the screen to let you know when it's ok to progress to the next step. The ini is formatted by the iniWrite command, AFAIK. The problem I am having is it never writes anything into the "value" field. For what it's worth, here is what it produces: [Coords] bay1= bay2= bay3= bay4= bay5= bay6= bay7= bay8= job= exx= worker= stz= As far as loading without checking, I'm the only one using it so I know the file exists, lol. Thanks for the help. I forgot to mention in the first post that I tried storing the data returned from the getMousePos command in an array format(?) with the script in the first post. I also tried something like this: IniWrite ( "cartown.ini", "Coords", "bay1", $bay1 ) IniWrite ( "cartown.ini", "Coords", "bay2", $bay2 ) IniWrite ( "cartown.ini", "Coords", "bay3", $bay3 ) IniWrite ( "cartown.ini", "Coords", "bay4", $bay4 ) IniWrite ( "cartown.ini", "Coords", "bay5", $bay5 ) IniWrite ( "cartown.ini", "Coords", "bay6", $bay6 ) IniWrite ( "cartown.ini", "Coords", "bay7", $bay7 ) IniWrite ( "cartown.ini", "Coords", "bay8", $bay8 ) IniWrite ( "cartown.ini", "Coords", "job", $job ) IniWrite ( "cartown.ini", "Coords", "stz", $stz ) IniWrite ( "cartown.ini", "Coords", "exx", $exx ) IniWrite ( "cartown.ini", "Coords", "worker", $worker ) The script in the first post doesn't function at all because of formatting with the arrays in the iniWrite command. Replaced with the snippet above it will run but never write any values. Edited September 18, 2010 by JuggaloZeke Link to comment Share on other sites More sharing options...
seandisanti Posted September 18, 2010 Share Posted September 18, 2010 Oh hey new guy, did I ask for help with game automation? Didn't think so. asking for help with a script that automates gameplay IS asking for help with game automation, don't be rude because someone points out the rules. The ini is formatted by the iniWrite command, AFAIK. The problem I am having is it never writes anything into the "value" field. For what it's worth, here is what it produces: [Coords] bay1= bay2= bay3= You're not writing values, you're calling IniWrite with array's rather than elements... should be $bay1[0] & "," & $bay1[1] etc As far as loading without checking, I'm the only one using it so I know the file exists, lol. Thanks for the help. it's still a good practice Link to comment Share on other sites More sharing options...
JuggaloZeke Posted September 18, 2010 Author Share Posted September 18, 2010 asking for help with a script that automates gameplay IS asking for help with game automation, don't be rude because someone points out the rules. You're not writing values, you're calling IniWrite with array's rather than elements... should be $bay1[0] & "," & $bay1[1] etc it's still a good practice The part of the script I'm asking to could be universally applied to lots of scripts and doesn't make/break my script, just a little something extra. Not trying to be rude, I've been around here for six years so I know how things operate. I figured, like you said, since what I'm asking about is pertinent to the script I wouldn't have to hear that line, lol. Thanks for that, I knew there was a way to do that but I was trying to use plus signs, damn! Now, how about retrieving the data and putting it back into a variable with the iniRead command? I just can't seem to wrap my head around how to get these arrays into and out of the ini file. I'm going to mull it over and see if I can't work it out. Link to comment Share on other sites More sharing options...
seandisanti Posted September 18, 2010 Share Posted September 18, 2010 Thanks for that, I knew there was a way to do that but I was trying to use plus signs, damn! Now, how about retrieving the data and putting it back into a variable with the iniRead command? I just can't seem to wrap my head around how to get these arrays into and out of the ini file. I'm going to mull it over and see if I can't work it out.Use StringSplit() to use the ", " as a delimiter to turn the string into a 2 element array, and then reference each coord like you do from MouseGetPos(). Link to comment Share on other sites More sharing options...
JuggaloZeke Posted September 18, 2010 Author Share Posted September 18, 2010 (edited) Use StringSplit() to use the ", " as a delimiter to turn the string into a 2 element array, and then reference each coord like you do from MouseGetPos().Just what I was looking for! Thanks a lot, I appreciate the help. Here is what I have come up with, is that a "good" way to use this function? I know there are usually multiple ways to accomplish a task, I usually do it the sloppy way because I don't know any better, haha. Edited September 20, 2010 by big_daddy Removed Script Example Link to comment Share on other sites More sharing options...
seandisanti Posted September 18, 2010 Share Posted September 18, 2010 Good is subjective, if it accomplishes your goal, it's good. That said, a few things that i didn't even notice before... you don't need to separate your mousemove and mouseclick. mouseclick does it all you can also just do... $worker = StringSplit (IniRead ( "cartown.ini", "Coords", "worker", "0"), "," ,2 ) to evaluate and assign at same time. 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