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