Hallo,
ich möchte nicht stören, aber ich kapiere es einfach nicht warum ich den Script nicht zum laufen kriege. Ich habe es auch schon mit "do - until" oder "switch - case - endswitch" probiert aber da ging es auch nicht. Hier erstmal mein Script:
While
$random = Random(1, 10, 1)
$answer = InputBox("Good Luck!", "Please choose a number between 1 and 10.")
If $random <> $answer Then
MsgBox(16, "Failed", "Your choosed number (" & $answer & ") wasn't the winning number. The winning number was " & $random & ". Just try it again.")
#include <GUIConstantsEx.au3>
opt("GUIOnEventMode", 1)
GUIcreate("Try it one more time", 300, 300)
GUIsetstate(@sw_show)
$ID = GUIctrlcreatebutton("I want to try it again", 100, 100)
GUIctrlsetonEvent($ID, "_msg")
While 1
Sleep(1000)
WEnd
Func _msg()
Msgbox(0, "lol", "hi")
EndFunc
ElseIf $random == $answer Then
MsgBox(48, "Good!", "You are really lucky, the random choosed number was " & $random & " and your number was " & $answer & ", too. Do you want to try it again with a random number between 1 and 20?") ExitLoop
#include <GUIConstantsEx.au3>
opt("GUIOnEventMode", 1)
GUIcreate("Try it one more time", 300, 300)
GUIsetstate(@sw_show)
$ID1 = GUIctrlcreatebutton("I want to try it again with a number between 1 and 20", 100, 100)
GUIctrlsetonEvent($ID, "_msg")
While 1
Sleep(1000)
WEnd
Func _msg()
Msgbox(48, "Oh my God", "You are extremly lucky...or you tried this stupid mini-game 200 Times. I hope you just had Luck!")
EndFunc
WEnd
Das Problem ist das er meint, dass es zu dem WEnd (ganz am Ende) ein While geben muss, das meiner meinung aber schon ganz am anfang des Scripts steht.
Bei "Do - Until" und "Switch - Case - Endswitch" hat ihm auch immer entweder der untere Teil (until oder endswitch) oder der obere Teil (Do oder Switch) gefehlt
Vielleicht funktioniert es wegen des GUI-Codes mittendrin nicht oder weil er das erste WEnd schon mit dem ersten While als zusammengehörig zählt.
Hoffentlich könnt ihr mir helfen.
lg. Benny