Sign in to follow this  
Followers 0
lolp1

Help with a .ini

5 posts in this topic

Hello, well I'm new to auto-it, and I have yet to figure out how to make a .INI file.

Here is what I wan't to make it for.
; Multi-tool version 1.0 
; Credits - Lolp 

Global $Paused
HotKeySet("{WAKE}", "TogglePause")
HotKeySet("{END}", "Terminate")
Hotkeyset("5", "precastthreeitems")
Hotkeyset("6", "precast")
Hotkeyset("7", "autoparty")
Hotkeyset("8", "precastfouritems")
Hotkeyset("9", "tppk")
Hotkeyset("0", "ChickenTP")



While 1
    Sleep(20)
WEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
      
        
   WEnd
EndFunc

Func Terminate()
    Exit 0
EndFunc

While 1
    Sleep(20)
WEnd

; Pre-cast 3 items part one
Func precastthreeitems()
Sleep(300)
Send("w")
Sleep(500)
Send("{F6}")
Sleep(300)
Mouseclick("Right")
Mouseclick("Right")

; Pre-cast 3 items part two

Sleep(500)
Send("{F7}")
Sleep("300")
Mouseclick("Right")
Mouseclick("Right")

; Pre-cast Three Items part three
Sleep(500)
Send("{F8}")
Sleep(300)
Mouseclick("Right")
Mouseclick("Right")
Sleep(400)
Send("w")
EndFunc

Func precast()

; Precast two Items part one

Sleep(200)
Send("w")
Sleep(500)
Send("{F6}")
Mouseclick("Right")
Mouseclick("Right")


; Pre-cast two items part two
Sleep(500)
Send("{F7}")
Mouseclick("Right")
Mouseclick("Right")
Sleep(500)
Send("w")

Endfunc

; Pre-cast 4 items part one

Func precastfouritems()
Sleep(300)
Send("w")
Sleep(500)
Send("{F5}")
Sleep(300)
Mouseclick("Right")
Mouseclick("Right")

; Pre-cast 4 items part two

Sleep(500)
Send("{F6}")
Sleep("300")
Mouseclick("Right")
Mouseclick("Right")

; Pre-cast 4 Items part three
Sleep(500)
Send("{F7}")
Sleep(300)
Mouseclick("Right")
Mouseclick("Right")
Sleep(400)
Send("w")


; Pre-cast 4 items part four

; Pre-cast 4 Items part three
Sleep(500)
Send("{F8}")
Sleep(300)
Mouseclick("Right")
Mouseclick("Right")
Sleep(400)
Send("w")
EndFunc

; Auto-part function

Func autoparty()



Send("p")

MouseClick ( "left" , 498, 303,1,0 )

MouseClick ( "left" , 490, 338,1,0 )

MouseClick ( "left" , 485, 380,1,0 )

MouseClick ( "left" , 492, 415,1,0 )

MouseClick ( "left" , 490, 449,1,0 )

MouseClick ( "left" , 494, 491,1,0 )

MouseClick ( "left" , 481, 530,1,0 )

Send("p")

Endfunc

; End auto-party function

; TPPK function

Func tppk()


Send("{F4}")

Mouseclick("Right")

Sleep(2000)

$coord = PixelSearch( 0, 0, 800, 600, 1057899, 0, 5 )
If Not @error Then
    MouseClick("Left", $coord[0],  $coord[1], 1, 0 )
EndIf

Sleep(800)

Send("p")

MouseClick ( "left" , 293,305,1,0 )

MouseClick ( "left" , 297,344,1,0 )

MouseClick ( "left" , 397,386,1,0 )

MouseClick ( "left" , 397,386,1,0 )

MouseClick ( "left" , 297,457,1,0 )

MouseClick ( "left" , 297,500,1,0 )

MouseClick ( "left" , 296,535,1,0 )

Send("p")





Endfunc

; End of TPPK

Func ChickenTP()

Send("{F4}")

Mouseclick("right")

Sleep(2000)

$coord = PixelSearch( 0, 0, 800, 600, 1057899, 0, 5 )
If Not @error Then
    MouseClick("Left", $coord[0],  $coord[1], 1, 0 )
EndIf

Endfunc

I wan't it to read these from a .ini file

Send("{F4}")

Send("{F5}")

Send("{F6}")

Send("{F7}")

Send("{F8}")

That way, they can choose which key works for them

How do I do it?

Share this post


Link to post
Share on other sites



A basic skim of the docs will show you FileWrite() and FileWriteLine() ; you may also wish to check out the INI* functions.

Please note that huge code postings unrelated to the actual question are counter-productive.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

this should give ya a idea:

$F1= IniRead( @scriptdir & "\yourinifilename.ini", "section", "key", "default")

Reads a value from a standard format .ini file.

[taken from the online documentation]

IniRead ( "filename", "section", "key", "default" )

filename: The filename of the .ini file.

section: The section name in the .ini file.

key: The key name in the in the .ini file.

default: The default value to return if the requested key is not found.

@scriptdir will tell that it needs to run the ini from the scriptdir which is easiest for you if you ask me.

and your ini file would be something like this then:

[section]

key=

you can rename section and key to whatever you want but they need to point out to eachother to work.

Share this post


Link to post
Share on other sites

Well, that won't send the key though.

Maybe something like:

IniRead( @scriptdir & "\yourinifilename.ini", "section", "key", "default")

Send("$.ini key")

?

Share this post


Link to post
Share on other sites

Well, that won't send the key though.

Maybe something like:

IniRead( @scriptdir & "\yourinifilename.ini", "section", "key", "default")

Send("$.ini key")

?

iniwrite(@scriptdir & "\yourinifilename.ini", "section", "key", "value")

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