Sign in to follow this  
Followers 0
JuggaloZeke

Storing coords in INI for re-use

9 posts in this topic

#1 ·  Posted (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 by big_daddy
Removed Script Example

Share this post


Link to post
Share on other sites



JuggaloZeke,

automate jobs in the Facebook game

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

 

Share this post


Link to post
Share on other sites

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.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by JuggaloZeke

Share this post


Link to post
Share on other sites

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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by big_daddy
Removed Script Example

Share this post


Link to post
Share on other sites

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.


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

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  
Followers 0