Jump to content

reading from ini


Recommended Posts

I'm making a bot here which makes use of a INI-file. some parameters need to be filled in to get the bot working.

I'm already so far that he will read the ini's and do the necessary action.

Now I want to build in a function that if they didn't fill in the information in the ini file that they would get a box where they need to write the info.

1) input is mandatory and are numbers from 1-8. how can I let it loop if they type something else?

2) how can I make my script pause if necessary? I can't find a working solution...it pauses, but doesn't resume where it paused...

3) how can I verify the password that is entered if they didn't fill it in in the ini?

$password = IniRead( @scriptdir & "\sacred.ini", "startup", "password", "default")
$type = IniRead( @scriptdir & "\sacred.ini", "startup", "type", "default")
$char = IniRead( @scriptdir & "\sacred.ini", "startup", "char", "default")
$location = IniRead( @scriptdir & "\sacred.ini", "startup", "location", "default")
if $password="" then $password = InputBox ( "Sacred bot " & $Version, "ENTER PASSWORD FOR YOUR ACCOUNT", "", " M" , 240, 115)
if $type="" then $type = InputBox ( "Sacred bot " & $Version, "OPEN OR CLOSED INTERNET?", "", " M" , 240, 115)
if $char="" then $char = InputBox ( "Sacred bot " & $Version, "ENTER CHARACTER TO USE FOR QUEST", "", " M" , 240, 115)
if $location="" then $location = InputBox ( "Sacred bot " & $Version, "LOCATION OF CHARACTER ON MATRIX?", "", " M" , 240, 115)
Link to comment
Share on other sites

  • Developers

you are setting the Variable to "Default" when theres nothing in the INI.

You need something like:

$password = IniRead( @scriptdir & "\sacred.ini", "startup", "password", "")
While $password="" 
    $password = InputBox ( "Sacred bot " & $Version, "ENTER PASSWORD FOR YOUR ACCOUNT", "", " M" , 240, 115)
    If @error Then Exit  ; cancel/closed clicked
WEnd
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

it doesn't need to exit, it just needs to ask that line again

EDIT: problem 2 solved.

working on number 1 and 3

this is kinda what I need. but it still asks it only twice if the correct answer is not filled in.

While $type=""
    $type = InputBox ( "Sacred bot " & $Version, "OPEN OR CLOSED INTERNET?", "", " M" , 240, 115)
    if $type= not "open" or "closed" then $type = InputBox ( "Sacred bot " & $Version, "OPEN OR CLOSED INTERNET?", "", " M" , 240, 115)
WEnd

the answer to the line is "open" or "closed" and otherwise it needs a continuesloop

Edited by Overlord
Link to comment
Share on other sites

While 1
    $type = InputBox("Sacred bot " & $Version, "OPEN OR CLOSED INTERNET?", "", " M", 240, 115)
    If StringInStr($type, "open") Or StringInStr($type, "closed") Then ExitLoop
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

gafrost,...

I COULD KISS YOU!!!!

thx man, this was really what I needed.

one question tho:

since my inpust must be the numbers 1 to 8 is there a other way to code this?

If StringInStr($location, "1") Or StringInStr($location, "2") Or StringInStr($location, "3") Or StringInStr($location, "4") Or StringInStr($location, "5") Or StringInStr($location, "6") Or StringInStr($location, "7") Or StringInStr($location, "8") Then ExitLoop

thx again gafrost.

U'r added to the credits list also!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...