Jump to content

little iniread help


Recommended Posts

hi all

i try to make one function with more words in iniread at same field

some like this

Func run()
    Do
        $itemtyperead=IniRead("data.txt","Weapon Type","Type","")
        $x=$x+1
        If $itemtyperead="sword" Then;sword
            MsgBox(0,"","sword selected")   
        EndIf
        If $itemtyperead="blade" Then;blade
            MsgBox(0,"","blade selected")   
        EndIf
        If $itemtyperead="spear" Then;spear
            MsgBox(0,"","spear selected")   
        EndIf
        If $itemtyperead="glavie" Then;glavie
            MsgBox(0,"","glavie selected")  
        EndIf
        If $itemtyperead="bow" Then;bow
            MsgBox(0,"","bow selected") 
        EndIf
        If $itemtyperead= "sword" = False Or $itemtyperead= "blade" = False Or $itemtyperead= "spear" = False Or $itemtyperead= "glavie" = False Or $itemtyperead= "bow" = False then
            MsgBox(0,"Warning","Incorect weapon type"&@CRLF&"Please chack the data.txt from root director")
            Exit
        EndIf
    Until $x=20
    $x=0
EndFunc

my problem it's i don't know how to make it to set error if are other word(to do only if words are sword blade spear glavie bow, if it's other word to exit)

my script do msg from 1 word and then incorect weapon type...

can anybody please give me some clue how to make it?

thank you

Regards, Emanuel

Link to comment
Share on other sites

use If-ElseIf:

Func Run()
    Do
        $itemtyperead = IniRead("data.txt", "Weapon Type", "Type", "")
        $x = $x + 1
        If $itemtyperead = "sword" Then;sword
            MsgBox(0, "", "sword selected")
        ElseIf $itemtyperead = "blade" Then;blade
            MsgBox(0, "", "blade selected")
        ElseIf $itemtyperead = "spear" Then;spear
            MsgBox(0, "", "spear selected")
        ElseIf $itemtyperead = "glavie" Then;glavie
            MsgBox(0, "", "glavie selected")
        ElseIf $itemtyperead = "bow" Then;bow
            MsgBox(0, "", "bow selected")
        Else
            MsgBox(0, "Warning", "Incorect weapon type" & @CRLF & "Please chack the data.txt from root director")
            Exit
        EndIf
    Until $x = 20
    $x = 0
EndFunc  ;==>Run
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...