DexterMorgan Posted March 28, 2008 Share Posted March 28, 2008 (edited) **EDIT** Fixed It, Thank you all!! This is my final script, (Try it my high score is 75326.1424558 lol) Tell me if I should change anything!! expandcollapse popup#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Brain Test", 365, 442, 284, 140) $Tab1 = GUICtrlCreateTab(0, 8, 361, 425) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("Test Your Brain") $Label1 = GUICtrlCreateLabel("Directions: Answer as quickly as possible", 8, 400, 289, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("Done", 208, 368, 89, 25, 0) $I1 = GUICtrlCreateInput("0", 110, 40, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $L1 = GUICtrlCreateLabel("Equation", 8, 40, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $I10 = GUICtrlCreateInput("0", 110, 327, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I9 = GUICtrlCreateInput("0", 110, 295, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I8 = GUICtrlCreateInput("0", 110, 263, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I7 = GUICtrlCreateInput("0", 110, 231, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I6 = GUICtrlCreateInput("0", 110, 199, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I5 = GUICtrlCreateInput("0", 110, 167, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I4 = GUICtrlCreateInput("0", 110, 135, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I3 = GUICtrlCreateInput("0", 110, 103, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I2 = GUICtrlCreateInput("0", 110, 71, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $L2 = GUICtrlCreateLabel("Equation", 8, 71, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L3 = GUICtrlCreateLabel("Equation", 8, 103, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L11 = GUICtrlCreateLabel("Equation", 184, 38, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L4 = GUICtrlCreateLabel("Equation", 8, 135, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L5 = GUICtrlCreateLabel("Equation", 8, 166, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L12 = GUICtrlCreateLabel("Equation", 184, 71, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L6 = GUICtrlCreateLabel("Equation", 8, 198, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L7 = GUICtrlCreateLabel("Equation", 8, 231, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L8 = GUICtrlCreateLabel("Equation", 8, 262, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L9 = GUICtrlCreateLabel("Equation", 8, 295, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L10 = GUICtrlCreateLabel("Equation", 8, 326, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $I11 = GUICtrlCreateInput("0", 285, 39, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I20 = GUICtrlCreateInput("0", 285, 326, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I19 = GUICtrlCreateInput("0", 285, 294, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I18 = GUICtrlCreateInput("0", 285, 262, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I17 = GUICtrlCreateInput("0", 285, 230, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I16 = GUICtrlCreateInput("0", 285, 198, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I15 = GUICtrlCreateInput("0", 285, 166, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I14 = GUICtrlCreateInput("0", 285, 134, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I13 = GUICtrlCreateInput("0", 285, 102, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $I12 = GUICtrlCreateInput("0", 285, 70, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $L13 = GUICtrlCreateLabel("Equation", 184, 103, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L14 = GUICtrlCreateLabel("Equation", 184, 136, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L15 = GUICtrlCreateLabel("Equation", 184, 167, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L16 = GUICtrlCreateLabel("Equation", 184, 200, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L17 = GUICtrlCreateLabel("Equation", 184, 231, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L18 = GUICtrlCreateLabel("Equation", 184, 264, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L19 = GUICtrlCreateLabel("Equation", 184, 295, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $L20 = GUICtrlCreateLabel("Equation", 184, 328, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Button2 = GUICtrlCreateButton("Start", 69, 367, 89, 25, 0) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Guictrlsetstate($I1, $GUI_ENABLE) Guictrlsetstate($I2, $GUI_ENABLE) Guictrlsetstate($I3, $GUI_ENABLE) Guictrlsetstate($I4, $GUI_ENABLE) Guictrlsetstate($I5, $GUI_ENABLE) Guictrlsetstate($I6, $GUI_ENABLE) Guictrlsetstate($I7, $GUI_ENABLE) Guictrlsetstate($I8, $GUI_ENABLE) Guictrlsetstate($I9, $GUI_ENABLE) Guictrlsetstate($I10, $GUI_ENABLE) Guictrlsetstate($I11, $GUI_ENABLE) Guictrlsetstate($I12, $GUI_ENABLE) Guictrlsetstate($I13, $GUI_ENABLE) Guictrlsetstate($I14, $GUI_ENABLE) Guictrlsetstate($I15, $GUI_ENABLE) Guictrlsetstate($I16, $GUI_ENABLE) Guictrlsetstate($I17, $GUI_ENABLE) Guictrlsetstate($I18, $GUI_ENABLE) Guictrlsetstate($I19, $GUI_ENABLE) Guictrlsetstate($I20, $GUI_ENABLE) $1=Random(1,10,1) $2=Random(1,10,1) $3=Random(1,10,1) $4=Random(1,10,1) $5=Random(1,10,1) $6=Random(1,10,1) $7=Random(1,10,1) $8=Random(1,10,1) $9=Random(1,10,1) $10=Random(1,10,1) $11=Random(1,10,1) $12=Random(1,10,1) $13=Random(1,10,1) $14=Random(1,10,1) $15=Random(1,10,1) $16=Random(1,10,1) $17=Random(1,10,1) $18=Random(1,10,1) $19=Random(1,10,1) $20=Random(1,10,1) $21=Random(1,10,1) $22=Random(1,10,1) $23=Random(1,10,1) $24=Random(1,10,1) $25=Random(1,10,1) $26=Random(1,10,1) $27=Random(1,10,1) $28=Random(1,10,1) $29=Random(1,10,1) $30=Random(1,10,1) $31=Random(10,20,1) $32=Random(1,10,1) $33=Random(10,20,1) $34=Random(1,10,1) $35=Random(10,20,1) $36=Random(1,10,1) $37=Random(10,20,1) $38=Random(1,10,1) $39=Random(10,20,1) $40=Random(1,10,1) GuiCtrlsetdata($L1, $1 & "+"& $2) GuiCtrlsetdata($L2, $3& "+"& $4) GuiCtrlsetdata($L3, $5& "+"& $6) GuiCtrlsetdata($L4, $7& "+"& $8) GuiCtrlsetdata($L5, $9& "+"& $10) GuiCtrlsetdata($L6, $11& "-"& $12) GuiCtrlsetdata($L7, $13& "-"& $14) GuiCtrlsetdata($L8, $15& "-"& $16) GuiCtrlsetdata($L9, $17& "-"& $18) GuiCtrlsetdata($L10, $19& "-"& $20) GuiCtrlsetdata($L11, $21& "*"& $22) GuiCtrlsetdata($L12, $23& "*"& $24) GuiCtrlsetdata($L13, $25& "*"& $26) GuiCtrlsetdata($L14, $27& "*"& $28) GuiCtrlsetdata($L15, $29& "*"& $30) GuiCtrlsetdata($L16, $31& "*"& $32) GuiCtrlsetdata($L17, $33& "*"& $34) GuiCtrlsetdata($L18, $35& "*"& $36) GuiCtrlsetdata($L19, $37& "*"& $38) GuiCtrlsetdata($L20, $39& "*"& $40) $begin = TimerInit() Case $Button1 $dif = TimerDiff($begin) IF $1 + $2 = GUIctrlread($I1) and $3 + $4 = GUIctrlread($I2 )and $5 + $6 = GUIctrlread($I3) and $7 + $8 = GUIctrlread($I4) and $9 + $10 = GUIctrlread($I5) and $11 - $12 = GUIctrlread($I6) and $13 - $14 = GUIctrlread($I7) and $15 - $16 = GUIctrlread($I8) and $17 - $18 = GUIctrlread($I9) and $19 - $20 = GUIctrlread($I10) and $21 * $22 = GUIctrlread($I11) and $23 * $24 = GUIctrlread($I12) and $25 * $26 = GUIctrlread($I13) and $27 * $28 = GUIctrlread($I14) and $29 * $30 = GUIctrlread($I15) and $31 * $32 = GUIctrlread($I16) and $33 * $34 = GUIctrlread($I17) and $35 * $36 = GUIctrlread($I18) and $37 * $38 = GUIctrlread($I19) and $39 * $40 = GUIctrlread($I20) then MsgBox(0,"It took you...","It took you "& $dif & " Milliseconds to solve these problems") Msgbox(0,"Scores","If you got less then 60000 milliseconds you are a freaky smart genius" & @CRLF & "If you got Betweern a 60000 and a 70000 you are a genius" & @CRLF & "If you got between a 70000 and a 80000 then you are Smart" & @CRLF & "If you got between a 80000 and a 95000 then you are Normal" & @CRLF & "95000 - 150000 you are stupid" & @CRLF & "We have a problem if it is less then that...") Else MsgBox(0,"Whoops","You got something wrong") EndIf EndSwitch WEnd I know i can make it a lot shorter but im not that great at scripting yet!! Edited March 28, 2008 by Nooblet code Link to comment Share on other sites More sharing options...
Valuater Posted March 28, 2008 Share Posted March 28, 2008 I played with the first script.... expandcollapse popup#include <GUIConstants.au3> Dim $L[21], $I[21], $data[21] #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Brain Test", 365, 442, 284, 140) $Tab1 = GUICtrlCreateTab(0, 8, 361, 425) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("Test Your Brain") $Label1 = GUICtrlCreateLabel("Directions: Answer as quickly as possibly", 8, 400, 289, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") Local $top = 8 For $x = 1 To 10 $top += 32 $I[$x] = GUICtrlCreateInput("0", 110, $top, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $L[$x] = GUICtrlCreateLabel("Equation", 8, $top, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") Next $top = 8 For $x = 11 To 20 $top += 32 $I[$x] = GUICtrlCreateInput("0", 285, $top, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $L[$x] = GUICtrlCreateLabel("Equation", 184, $top, 57, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") Next $Button1 = GUICtrlCreateButton("Done", 208, 368, 89, 25, 0) GUICtrlSetState(-1, $GUI_DISABLE) $Button2 = GUICtrlCreateButton("Start", 69, 367, 89, 25, 0) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 $begin = TimerInit() GUICtrlSetState($Button1, $GUI_ENABLE) GUICtrlSetState($Button2, $GUI_DISABLE) $sign = "+" For $x = 1 To 20 If $x = 6 Then $sign = "-" If $x = 11 Then $sign = "*" If $x = 16 Then $sign = "/" GUICtrlSetState($I[$x], $GUI_ENABLE) $data[$x] = Random(1, 10, 1) & $sign & Random(1, 10, 1) GUICtrlSetData($L[$x], $data[$x]) $data[$x] = Execute($data[$x]) Next Case $Button1 For $x = 1 To 20 If GUICtrlRead($I[$x]) <> $data[$x] Then MsgBox(0x0, "Try again!", "Please re-answer #" & $x & ". ", 2) ContinueCase EndIf Next MsgBox(0x0, "Congrats!", "You win a big balloon! ", 3) $dif = TimerDiff($begin) EndSwitch WEnd not bad for your first prog!! 8) Link to comment Share on other sites More sharing options...
Swift Posted March 28, 2008 Share Posted March 28, 2008 Holy crap thats alot of controls...and Valuater, did you reply to my PM? Link to comment Share on other sites More sharing options...
Valuater Posted March 29, 2008 Share Posted March 29, 2008 Holy crap thats alot of controls...and Valuater, did you reply to my PM? No, there isn't much to say... you cheated and thats it... nice try though ******************** played a little more expandcollapse popup#include <GUIConstants.au3> Global $Brain[1][1] #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Brain Test", 365, 442, 284, 140) $Tab1 = GUICtrlCreateTab(0, 8, 366, 425) $Intro = GUICtrlCreateTabItem("Test Patterns") GUICtrlCreateLabel(" an explination with all the test info goes here", 10, 100, 350, 20) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("Directions: Answer as quickly as possibly", 20, 400, 289, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("Done", 208, 368, 89, 25, 0) GUICtrlSetState(-1, $GUI_DISABLE) $Button2 = GUICtrlCreateButton("Start", 69, 367, 89, 25, 0) $Add = Tabber("Addition", "+") $Sub = Tabber("Subtraction", "-") $Mult = Tabber("Multiplication", "*") $Div = Tabber("Division", "/") $Intro = GUICtrlCreateTabItem("About?") GUICtrlCreateLabel(" .... Thanks... Valuater 8) ", 10, 100, 350, 20) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 $begin = TimerInit() GUICtrlSetState($Button1, $GUI_ENABLE) GUICtrlSetState($Button2, $GUI_DISABLE) For $x = 1 To UBound($Brain) - 1 GUICtrlSetState($Brain[$x][1], $GUI_ENABLE) Next Case $Button1 For $x = 1 To UBound($Brain) - 1 If GUICtrlRead($Brain[$x][1]) <> $Brain[$x][3] Then MsgBox(0x0, "Try again!", "Please re-answer #" & $x & ". ", 2) ContinueCase EndIf Next $dif = Int(TimerDiff($begin) / 1000 / 60) MsgBox(0x0, "Congrats!", "You win a big balloon! " & @CRLF & "Time = " & $dif & " Minutes ") EndSwitch WEnd Func Tabber($Tab_Name, $sign) Local $start = UBound($Brain) ReDim $Brain[(UBound($Brain) + 20) ][4] GUICtrlCreateTabItem($Tab_Name) Local $top = 20, $left = 110 For $x = $start To UBound($Brain) - 1 $top += 32 $Brain[$x][1] = GUICtrlCreateInput("0", $left, $top, 49, 21) GUICtrlSetState(-1, $GUI_DISABLE) $Brain[$x][2] = GUICtrlCreateLabel("Equation", $left - 80, $top, 57, 20) $Brain[$x][3] = Random(1, 10, 1) & $sign & Random(1, 10, 1) GUICtrlSetData($Brain[$x][2], $x & ". " & $Brain[$x][3]) $Brain[$x][3] = Execute($Brain[$x][3]) If $x = $start + 9 Then $top = 20 $left = 285 EndIf Next $Label1 = GUICtrlCreateLabel("Directions: Answer as quickly as possibly", 20, 400, 289, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") EndFunc ;==>Tabber 8) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now