Kyme Posted June 16, 2009 Posted June 16, 2009 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
nguyenbason Posted June 16, 2009 Posted June 16, 2009 If ... ElseIf ... Elseif ... Else ... Endif Switch $Itemtyperead Case... Case... Case else.. EndSwitch UnderWorldVN- Just play the way you like it
oMBRa Posted June 16, 2009 Posted June 16, 2009 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
Kyme Posted June 16, 2009 Author Posted June 16, 2009 If ... ElseIf ... Elseif ... Else ... EndifSwitch $Itemtyperead Case...Case...Case else..EndSwitchtnx for the point...i love you
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now