hi, ich hab mir den tutorial bei noob projekte mal angeschaut und hab mir überlegt ein quiz spiel zu machen für über einen spiel das problem ist wen bei der 1. antwort wen man die richtig beantwortet kriegt man 50 punkte und wen man bei der 2. frage auch richtig hat ha man 100 punkte aber wen ich die 3. antwort richtig hab kommen keine punkte mehr dazu
auserdem will ich das nach der letzten msgbox das programm beendet wird auserdem will ich auch noch das es mit hotkeyset also esc schließt also ich kenn mich mit dem befehl func net so aus
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
HotKeySet("{ESC}","Exit")
$punkte= 0
$pos= 50
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("mtVision Quiz", 550, 400, 192, 124)
$Label1 = GUICtrlCreateLabel("MTvision Quiz", 100, 20, 210, 41)
GUICtrlSetFont(-1, 25, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Punkte", 16, 70, 40, 17)
$Label3 = GUICtrlCreateLabel("Label3", 64, 70, 36, 17)
$Pic1 = GUICtrlCreatePic("C:\Users\Trane\Desktop\trane.jpg", 16, 296, 209, 73, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Pic2 = GUICtrlCreatePic("C:\Users\Trane\Desktop\main.bmp", 0, 0, 550, 385,BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$edit1 = GUICtrlCreateLabel("Wie viel % gibt Stein gegen Kreiger+6??? ", 24, 150, 364, 121)
GUiCtrlSetFont(-1,17)
$MenuItem2 = GUICtrlCreateMenu("&Datei")
$MenuItem6 = GUICtrlCreateMenuItem("Schließen", $MenuItem2)
$MenuItem3 = GUICtrlCreateMenu("&Info")
$MenuItem5 = GUICtrlCreateMenuItem("Anleitung", $MenuItem3)
$MenuItem1 = GUICtrlCreateMenu("Ü&bermich")
$MenuItem4 = GUICtrlCreateMenuItem("Trane", $MenuItem1)
$Group1 = GUICtrlCreateGroup("Antworten", 425, 30, 110, 280)
$A = GUICtrlCreateButton("A", 430, 50, 100, 41, $WS_GROUP)
$B = GUICtrlCreateButton("C", 430, 120, 100, 41, $WS_GROUP)
$C = GUICtrlCreateButton("B", 430, 190, 100, 41, $WS_GROUP)
$D = GUICtrlCreateButton("D", 430, 260, 100, 41, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label4 = GUICtrlCreateLabel("", 24, 100, 364, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$round=0
$correct=0
$save=0
GUICtrlSetData($label3,$punkte)
GUICtrlSetData($label4,"Die "& $pos & " Punkte Frage ")
MsgBox(0,"MTvision Quiz","Das Spiel beginnt nach dem Klicken auf 'OK' oder nach 5 sekunden",5)
_setquestions()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $A
If $correct="a" Then
MsgBox(64,"Richtig!","Sehr gut. Auf zur nächsten Frage!")
$punkte=$pos
GUICtrlSetData($label3,$punkte)
_setQuestions()
Else
MsgBox(16,"Oops","Leider falsch"&$save&" Punkte")
GUICtrlSetData($label4,"Leider falsch. Du hast "&$save&" Punkte gewonnen")
GUICtrlSetData($edit1,"")
GUICtrlSetData($A,"A")
GUICtrlSetData($B,"B")
GUICtrlSetData($C,"C")
GUICtrlSetData($D,"D")
$round=0
$correct=0
$save=0
msgBox(0,"Leider falsch","Na dann noch mal")
_setquestions()
EndIf
Case $B
If $correct="b" Then
MsgBox(64,"Richtig!","Sehr gut. Auf zur nächsten Frage!")
$punkte=$pos
GUICtrlSetData($label3,$punkte)
_setQuestions()
Else
MsgBox(16,"Oops","Leider falsch "&$save&" Punkte")
GUICtrlSetData($label4,"Leider falsch. Du hast "&$save&" Punkte gewonnen")
GUICtrlSetData($edit1,"")
GUICtrlSetData($A,"A")
GUICtrlSetData($B,"B")
GUICtrlSetData($C,"C")
GUICtrlSetData($D,"D")
$round=0
$correct=0
$save=0
msgBox(0,"Neues Spiel","Es wird ein neues Spiel begonnen")
_setquestions()
EndIf
Case $C
If $correct="c" Then
MsgBox(64,"Richtig!","Ja, genau. Los, nächste Frage!")
$punkte=$pos
GUICtrlSetData($label3,$punkte)
_setQuestions()
Else
MsgBox(16,"Oops","Leider falsch "&$save&" Punkte")
GUICtrlSetData($label4,"Leider falsch. Du hast "&$save&" Punkte gewonnen")
GUICtrlSetData($edit1,"")
GUICtrlSetData($A,"A")
GUICtrlSetData($B,"B")
GUICtrlSetData($C,"C")
GUICtrlSetData($D,"D")
$round=0
$correct=0
$save=0
msgBox(0,"Leider falsch","Na dann noch mal")
_setquestions()
EndIf
Case $D
If $correct="d" Then
MsgBox(64,"Richtig!","Sehr gut. Auf zur nächsten Frage!")
$money=$pos
GUICtrlSetData($label3,$punkte)
_setQuestions()
Else
MsgBox(16,"Oops","Leider falsch "&$save&" Punkte")
GUICtrlSetData($label4,"Leider falsch. Du hast "&$save&" Punkte gewonnen")
GUICtrlSetData($edit1,"")
GUICtrlSetData($A,"A")
GUICtrlSetData($B,"B")
GUICtrlSetData($C,"C")
GUICtrlSetData($D,"D")
$round=0
$correct=0
$save=0
msgBox(0,"Leider falsch","Na dann noch mal")
_setquestions()
EndIf
EndSwitch
WEnd
Func _setQuestions()
If $punkte= 500 Then
$save= 500
elseif $punkte= 5000 Then
$save= 5000
EndIf
$round=$round+1
Switch $round
Case 1
$pos = 50
GUICtrlSetData($label4,"Die 50 Punkte Frage")
GUICtrlSetData($edit1,"Wie viel % gibt Stein gegen Krieger+6?")
GUICtrlSetData($A,"A: 10%")
GUICtrlSetData($B,"B: 25%")
GUICtrlSetData($C,"C: 35%")
GUICtrlSetData($D,"D: 20%")
$correct="c" ;Antwort a ist richtig
Case 2
$pos=100
GUICtrlSetData($label4,"Die 50 Punkte Frage")
GUICtrlSetData($edit1,"Beispielfrage2")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="b" ;Antwort b ist richtig
Case 3
$pos=150
GUICtrlSetData($label4,"Die 50 Punkte Frage")
GUICtrlSetData($edit1,"bla bla3")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="d" ;Antwort d ist richtig
Case 4
$pos=200
GUICtrlSetData($label4,"Die 50 Punkte Frage")
GUICtrlSetData($edit1,"bla bla4")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="d" ;Antwort d ist richtig
Case 5
$pos=250
GUICtrlSetData($label4,"Die 50 Punkte Frage")
GUICtrlSetData($edit1,"bla bla5")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="d" ;Antwort d ist richtig
Case 6
$pos=300
GUICtrlSetData($label4,"Die 50 Punkte Frage")
GUICtrlSetData($edit1,"bla bla6")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="d" ;Antwort d ist richtig
Case 7
$pos=350
GUICtrlSetData($label4,"Die 50 Punkte Frage")
GUICtrlSetData($edit1,"bla bla7")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="d" ;Antwort d ist richtig
Case 8
$pos=400
GUICtrlSetData($label4,"Die 50 Punkte Frage")
GUICtrlSetData($edit1,"bla bla8")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="d" ;Antwort d ist richtig
Case 9
$pos=500
MsgBox(0,"100 Punkte","jetzt kommen die 100 Punkte fragen")
GUICtrlSetData($label4,"Die 100 Punkte Frage")
GUICtrlSetData($edit1,"bla bla9")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="d" ;Antwort d ist richtig
Case 10
$pos=600
GUICtrlSetData($label4,"Die 100 Punkte Frage")
GUICtrlSetData($edit1,"bla bla10")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="d" ;Antwort d ist richtig
Case 11
$pos=700
GUICtrlSetData($label4,"Die 100 Punkte Frage")
GUICtrlSetData($edit1,"bla bla11")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="d" ;Antwort d ist richtig
Case 12
$pos=800
GUICtrlSetData($label4,"Die 100 Punkte Frage")
GUICtrlSetData($edit1,"bla bla12")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="d" ;Antwort d ist richtig
Case 13
$pos=900
GUICtrlSetData($label4,"Die 100 Punkte Frage")
GUICtrlSetData($edit1,"bla bla13")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="d" ;Antwort d ist richtig
Case 14
$pos=1000
GUICtrlSetData($label4,"Die 100 Punkte Frage")
GUICtrlSetData($edit1,"bla bla14")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="d" ;Antwort d ist richtig
Case 15
$pos=1100
GUICtrlSetData($label4,"Die 100 Punkte Frage")
GUICtrlSetData($edit1,"bla bla15")
GUICtrlSetData($A,"A: Antwort A")
GUICtrlSetData($B,"B: Antwort B")
GUICtrlSetData($C,"C: Antwort C")
GUICtrlSetData($D,"D: Antwort C")
$correct="d" ;Antwort d ist richtig
Func
MsgBox(0,"ENDE","Du hast alle Fragen richtig beantwortet Glückwunsch :D")
Exit 0
EndFunc
Func Exit ()
Exit 0
EndFunc
EndSwitch
EndFunc