Menü:
Quote:
Code:If Not IsAdmin() Then #RequireAdmin If @error Then MsgBox(16, "Wer wird Millionär Fehler", @error) Exit EndIf EndIf #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <File.au3> ;Form1, Menü #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Wer wird Millionär", 267, 43, 192, 124) GUISetFont(10, 400, 0, "Verdana") GUISetBkColor(0xFFFFFF) $Button1 = GUICtrlCreateButton("Fragen erstellen", 8, 8, 123, 25) $Button2 = GUICtrlCreateButton("Spielen", 136, 8, 123, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ;Fragen erstellen Case $Button1 Run(@ScriptDir & "\Wer wird Millionär Frage erstellen.exe") Exit ;Spielen Case $Button2 Run(@ScriptDir & "\Wer wird Millionär Spielen.exe") Exit EndSwitch WEnd
Spielen:
Quote:
Code:#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> ;Form1, Frage erstellen #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Wer wird Millionär", 609, 132, 192, 124) GUISetFont(10, 400, 0, "Verdana") GUISetBkColor(0xFFFFFF) $Label1 = GUICtrlCreateLabel("Frage:", 8, 8, 95, 20) $Input1 = GUICtrlCreateInput("", 104, 8, 497, 24) $Label2 = GUICtrlCreateLabel("(Beispiel: Wie heißt der ersteller des Programmes, A Sezer, B Baum?)", 104, 32, 495, 17) GUICtrlSetFont(-1, 8, 400, 0, "Verdana") $Label3 = GUICtrlCreateLabel("Antwort:", 8, 56, 95, 20) $Input2 = GUICtrlCreateInput("", 104, 56, 497, 24) $Label4 = GUICtrlCreateLabel("(Beispiel: A oder B)", 104, 80, 493, 17) GUICtrlSetFont(-1, 8, 400, 0, "Verdana") $Button1 = GUICtrlCreateButton("Frage erstellen", 0, 104, 603, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $RInput1 = GUICtrlRead($Input1) If Not $RInput1 = "" Then $RInput2 = GUICtrlRead($Input2) If Not $RInput2 = "" Then If Not FileExists(@ScriptDir & "\Fragen.ini") Then _FileCreate(@ScriptDir & "\Fragen.ini") IniWrite(@ScriptDir & "\Fragen.ini", "Fragen", "Frage0", "Wie heißt der ersteller des Programmes, A Sezer, B Baum") IniWrite(@ScriptDir & "\Fragen.ini", "Fragen", "Frage1", "Wie alt ist der ersteller des Programmes, A 16, B 14") IniWrite(@ScriptDir & "\Fragen.ini", "AnzFragen", "Fragen", "1") EndIf If Not FileExists(@ScriptDir & "\Antworten.ini") Then _FileCreate(@ScriptDir & "\Antworten.ini") IniWrite(@ScriptDir & "\Antworten.ini", "Antworten", "Antwort0", "A") IniWrite(@ScriptDir & "\Antworten.ini", "Antworten", "Antwort1", "B") EndIf $RMAX = IniRead(@ScriptDir & "\Fragen.ini", "AnzFragen", "Fragen", "1") $RMAX += 1 IniWrite(@ScriptDir & "\Fragen.ini", "AnzFragen", "Fragen", $RMAX) IniWrite(@ScriptDir & "\Fragen.ini", "Fragen", "Frage" & $RMAX, $RInput1) IniWrite(@ScriptDir & "\Antworten.ini", "Antworten", "Antwort" & $RMAX, $RInput2) GUICtrlSetData($Input1, "") GUICtrlSetData($Input2, "") MsgBox(64, "Wer wird Millionär Frage erstellt", "Sie haben eine Frage erstellt.") Else MsgBox(16, "Wer wird Millionär Fehler", "Sie müssen A oder B bei der Antwort schreiben.") EndIf Else MsgBox(16, "Wer wird Millionär Fehler", "Sie müssen eine Frage stellen.") EndIf EndSwitch WEnd
Frage erstellen:
Quote:
Code:If Not IsAdmin() Then #RequireAdmin If @error Then MsgBox(16, "Wer wird Millionär Fehler", @error) Exit EndIf EndIf #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <File.au3> Global $RMAX = 1 Global $A = False, $B = False, $F = False ;Form1, Laden #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Wer wird Millionär", 256, 89, 191, 121) GUISetFont(10, 400, 0, "Verdana") GUISetBkColor(0xFFFFFF) $Label1 = GUICtrlCreateLabel("Ladet", 0, 0, 253, 84) GUICtrlSetFont(-1, 50, 400, 0, "Verdana") GUICtrlSetColor(-1, 0x000000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;Form2, Spielen #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Wer wird Millionär", 598, 64, 191, 123) GUISetFont(10, 400, 0, "Verdana") GUISetBkColor(0xFFFFFF) $Label2 = GUICtrlCreateLabel("Zeile 1", 8, 8, 584, 20) $Button1 = GUICtrlCreateButton("A", 56, 32, 27, 25) $Button2 = GUICtrlCreateButton("B", 488, 32, 27, 25) GUISetState(@SW_HIDE) #EndRegion ### END Koda GUI section ### Einstellung() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ;A Case $Button1 If $A = True Then MsgBox(64, "Richtig", "Sie haben die Frage gelöst.") Weiter() ElseIf $B = True Then MsgBox(16, "Verloren", "Sie haben leider verloren.") Exit Else MsgBox(16, "Fehler", "Es ist ein unbekannter Fehler aufgetreten.") Exit EndIf ;B Case $Button2 If $B = True Then MsgBox(64, "Richtig", "Sie haben die Frage gelöst.") Weiter() ElseIf $A = True Then MsgBox(16, "Verloren", "Sie haben leider verloren.") Exit Else MsgBox(16, "Fehler", "Es ist ein unbekannter Fehler aufgetreten.") Exit EndIf EndSwitch WEnd Func Einstellung() If Not FileExists(@ScriptDir & "\Fragen.ini") Then _FileCreate(@ScriptDir & "\Fragen.ini") IniWrite(@ScriptDir & "\Fragen.ini", "Fragen", "Frage0", "Wie heißt der ersteller des Programmes, A Sezer, B Baum") IniWrite(@ScriptDir & "\Fragen.ini", "Fragen", "Frage1", "Wie alt ist der ersteller des Programmes, A 16, B 14") IniWrite(@ScriptDir & "\Fragen.ini", "AnzFragen", "Fragen", "1") EndIf If Not FileExists(@ScriptDir & "\Antworten.ini") Then _FileCreate(@ScriptDir & "\Antworten.ini") IniWrite(@ScriptDir & "\Antworten.ini", "Antworten", "Antwort0", "A") IniWrite(@ScriptDir & "\Antworten.ini", "Antworten", "Antwort1", "B") EndIf $RMAX = IniRead(@ScriptDir & "\Fragen.ini", "AnzFragen", "Fragen", "1") $RandomZ = Random(0, $RMAX, 1) $Frage = IniRead(@ScriptDir & "\Fragen.ini", "Fragen", "Frage" & $RandomZ, "Fehler") $Antwort = IniRead(@ScriptDir & "\Antworten.ini", "Antworten", "Antwort" & $RandomZ, "Fehler") GUICtrlSetData($Label2, $Frage) If $Antwort = "A" Then $A = True $B = False $F = False ElseIf $Antwort = "B" Then $B = True $A = False $F = False Else $F = True $A = False $B = False EndIf GUISetState(@SW_SHOW, $Form2) GUISetState(@SW_HIDE, $Form1) EndFunc Func Weiter() Run(@ScriptDir & "\Wer wird Millionär Spielen.exe") Exit EndFunc