Jump to content
Sign in to follow this  
Kyme

little iniread help

Recommended Posts

Kyme

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

Share this post


Link to post
Share on other sites
nguyenbason

If ... ElseIf ... Elseif ... Else ... Endif

Switch $Itemtyperead

Case...

Case...

Case else..

EndSwitch


UnderWorldVN- Just play the way you like it

Share this post


Link to post
Share on other sites
oMBRa

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

Share this post


Link to post
Share on other sites
Kyme

If ... ElseIf ... Elseif ... Else ... Endif

Switch $Itemtyperead

Case...

Case...

Case else..

EndSwitch

tnx for the point...i love you :D

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  

×