Jump to content

Quiz


broodplank
 Share

Recommended Posts

;INCLUDES
#include <GuiConstants.au3>

;CREATES THE GUI
GUICreate("QUIZ..", 200, 255)

;SETS FONT
GUISetFont(8, 8, 0, "Verdana")

;LABELS
GUICtrlCreateGroup("Whats the age of broodplank?", 2, 5, 190, 70)
$age_14 = GUICtrlCreateButton("14", 25, 25, 40, 20)
$age_15 = GUICtrlCreateButton("15", 70, 25, 40, 20)
$age_16 = GUICtrlCreateButton("16", 115, 25, 40, 20)

GUICtrlCreateGroup("In what month he born?", 2, 85, 190, 70)
$month_may = GUICtrlCreateButton("May", 20, 105, 45, 20)
$month_april = GUICtrlCreateButton("April", 70, 105, 45, 20)
$month_august = GUICtrlCreateButton("August", 120, 105, 45, 20)

$awnser = GUICtrlCreateLabel("Awnser is: ", 7, 58, 175, 15) 
$awnser1 = GUICtrlCreateLabel("Awnser is: ", 7, 138, 150, 15) 
GUICtrlCreateLabel("Questions you awnsered correctly:", 3, 165, 195, 15) 
$output = GUICtrlCreateLabel("0 out of 2", 3, 180, 195, 15) 

GUICtrlCreateLabel("DEV NOTE: You first need to awnser the first question before awnsering the 2nd to get the good output status.", 2, 205, 200, 200) 


;SHOWS THE GUI
GUISetState()

;THE LOOP 
While 1 
    $msg = GUIGetMsg()
Select
    
;WHEN CLICKING ON X
    Case $msg = $GUI_EVENT_CLOSE
    ExitLoop
    
Case $msg = $age_14
    ControlDisable("", "", $age_15)
    ControlDisable("", "", $age_16)
    GUICtrlSetData($awnser, "Awnser is: Incorrect", "Awnser is:")
    GUICtrlSetColor($awnser, "0x800000")
    
Case $msg = $age_15
    ControlDisable("", "", $age_14)
    ControlDisable("", "", $age_16)
    GUICtrlSetData($awnser, "Awnser is: Correct", "Awnser is:")
    GUICtrlSetData($output, "1 out of 2", "0 out of 2")
    GUICtrlSetColor($awnser, "0x006400")

Case $msg = $age_16
    ControlDisable("", "", $age_14)
    ControlDisable("", "", $age_15)
    GUICtrlSetData($awnser, "Awnser is: Incorrect", "Awnser is:")
    GUICtrlSetColor($awnser, "0x800000")
    
Case $msg = $month_may
    ControlDisable("", "", $month_april)
    ControlDisable("", "", $month_august)
    GUICtrlSetData($awnser1, "Awnser is: Incorrect", "Awnser is:")
    GUICtrlSetColor($awnser1, "0x800000")
    
Case $msg = $month_april
    ControlDisable("", "", $month_may)
    ControlDisable("", "", $month_august)
    GUICtrlSetData($awnser1, "Awnser is: Correct", "Awnser is:")
    GUICtrlSetData($output, "2 out of 2", "0 out of 2")
    GUICtrlSetColor($awnser1, "0x006400")
    
    
Case $msg = $month_august
    ControlDisable("", "", $month_april)
    ControlDisable("", "", $month_may)
    GUICtrlSetData($awnser1, "Awnser is: Incorrect", "Awnser is:")
    GUICtrlSetColor($awnser1, "0x800000")
    
Case Else
    sleep(50)

EndSelect
WEnd

my problem is now that if you awnser the second question first that it automaticly says: 2 of 2 awnsered correctly, but thats not the trough is there some script that just adds 1 (good awnser) to the label?

iam sry, this is kinda confusing i guess

Link to comment
Share on other sites

;INCLUDES
#include <GuiConstants.au3>

;CREATES THE GUI
GUICreate("QUIZ..", 200, 255)

;SETS FONT
GUISetFont(8, 8, 0, "Verdana")

;LABELS
GUICtrlCreateGroup("Whats the age of broodplank?", 2, 5, 190, 70)
$age_14 = GUICtrlCreateButton("14", 25, 25, 40, 20)
$age_15 = GUICtrlCreateButton("15", 70, 25, 40, 20)
$age_16 = GUICtrlCreateButton("16", 115, 25, 40, 20)

GUICtrlCreateGroup("In what month he born?", 2, 85, 190, 70)
$month_may = GUICtrlCreateButton("May", 20, 105, 45, 20)
$month_april = GUICtrlCreateButton("April", 70, 105, 45, 20)
$month_august = GUICtrlCreateButton("August", 120, 105, 45, 20)
GUICtrlSetState($month_may, $GUI_DISABLE)
GUICtrlSetState($month_april, $GUI_DISABLE)
GUICtrlSetState($month_august, $GUI_DISABLE)
$awnser = GUICtrlCreateLabel("Awnser is: ", 7, 58, 175, 15)
$awnser1 = GUICtrlCreateLabel("Awnser is: ", 7, 138, 150, 15)
GUICtrlCreateLabel("Questions you awnsered correctly:", 3, 165, 195, 15)
$output = GUICtrlCreateLabel("0 out of 2", 3, 180, 195, 15)

GUICtrlCreateLabel("DEV NOTE: You first need to awnser the first question before awnsering the 2nd to get the good output status.", 2, 205, 200, 200)


;SHOWS THE GUI
GUISetState()

;THE LOOP
While 1
    $msg = GUIGetMsg()
    Select

        ;WHEN CLICKING ON X
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop

        Case $msg = $age_14
            GUICtrlSetState($age_15, $GUI_DISABLE)
            GUICtrlSetState($age_16, $GUI_DISABLE)
            GUICtrlSetData($awnser, "Awnser is: Incorrect", "Awnser is:")
            GUICtrlSetColor($awnser, "0x800000")
            GUICtrlSetState($month_may, $GUI_ENABLE)
            GUICtrlSetState($month_april, $GUI_ENABLE)
            GUICtrlSetState($month_august, $GUI_ENABLE)

        Case $msg = $age_15
            GUICtrlSetState($age_14, $GUI_DISABLE)
            GUICtrlSetState($age_16, $GUI_DISABLE)
            GUICtrlSetData($awnser, "Awnser is: Correct", "Awnser is:")
            GUICtrlSetData($output, "1 out of 2", "0 out of 2")
            GUICtrlSetColor($awnser, "0x006400")
            GUICtrlSetState($month_may, $GUI_ENABLE)
            GUICtrlSetState($month_april, $GUI_ENABLE)
            GUICtrlSetState($month_august, $GUI_ENABLE)

        Case $msg = $age_16
            GUICtrlSetState($age_14, $GUI_DISABLE)
            GUICtrlSetState($age_15, $GUI_DISABLE)
            GUICtrlSetData($awnser, "Awnser is: Incorrect", "Awnser is:")
            GUICtrlSetColor($awnser, "0x800000")
            GUICtrlSetState($month_may, $GUI_ENABLE)
            GUICtrlSetState($month_april, $GUI_ENABLE)
            GUICtrlSetState($month_august, $GUI_ENABLE)

        Case $msg = $month_may
            GUICtrlSetState($month_april, $GUI_DISABLE)
            GUICtrlSetState($month_august, $GUI_DISABLE)
            GUICtrlSetData($awnser1, "Awnser is: Incorrect", "Awnser is:")
            GUICtrlSetColor($awnser1, "0x800000")

        Case $msg = $month_april
            GUICtrlSetState($month_may, $GUI_DISABLE)
            GUICtrlSetState($month_august, $GUI_DISABLE)
            GUICtrlSetData($awnser1, "Awnser is: Correct", "Awnser is:")
            GUICtrlSetData($output, "2 out of 2", "0 out of 2")
            GUICtrlSetColor($awnser1, "0x006400")


        Case $msg = $month_august
            GUICtrlSetState($month_april, $GUI_DISABLE)
            GUICtrlSetState($month_may, $GUI_DISABLE)
            GUICtrlSetData($awnser1, "Awnser is: Incorrect", "Awnser is:")
            GUICtrlSetColor($awnser1, "0x800000")

;~      Case Else
;~          Sleep(50)

    EndSelect
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...