BrettF Posted October 3, 2006 Share Posted October 3, 2006 (edited) Hi, Does anyone know how to get the scores working? After it asks a question i want it to add 1 to a varible each time to create the number of correct answers out of 10. So far nothing for me has worked, and the most correct answers it said i got was 1 (and i got all of them right too). Here is the code from my last try (it's the whole thing...) BTW Level 1 only works... I edit the code to have the right answers: expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> ; == GUI generated with Koda == $MainMenu = GUICreate("My Math Helper", 353, 296, 192, 125) $ButLev1 = GUICtrlCreateButton("Level 1", 56, 48, 89, 41) GUICtrlCreateLabel("Please select a level to start playing:", 8, 8, 203, 25) $Butlev2 = GUICtrlCreateButton("Level 2", 56, 96, 89, 41) $Butlev3 = GUICtrlCreateButton("Level 3", 56, 144, 89, 41) $Butlev4 = GUICtrlCreateButton("Level 4", 56, 192, 89, 41) $Butlev5 = GUICtrlCreateButton("Level 5", 56, 240, 89, 41) $Group1 = GUICtrlCreateGroup("Includes:", 152, 48, 185, 41) $Group3 = GUICtrlCreateGroup("Includes:", 152, 144, 185, 41) $Group9 = GUICtrlCreateGroup("Includes:", 152, 192, 185, 41) $Group11 = GUICtrlCreateGroup("Includes:", 152, 96, 185, 41) $Group21 = GUICtrlCreateGroup("Includes:", 152, 240, 185, 41) $Pic1 = GUICtrlCreatePic("", 8, 48, 41, 41) $Pic2 = GUICtrlCreatePic("", 8, 96, 41, 41) $Pic3 = GUICtrlCreatePic("", 8, 144, 41, 41) $Pic4 = GUICtrlCreatePic("", 8, 192, 41, 41) $Pic5 = GUICtrlCreatePic("", 8, 240, 41, 41) GUICtrlCreateLabel("Addition/Subtraction to 20", 160, 64, 128, 17) GUICtrlCreateLabel("Addition/Subtraction to 50", 160, 112, 128, 17) GUICtrlCreateLabel("Multiplication/Divison to 5", 160, 160, 126, 17) GUICtrlCreateLabel("Multiplication/Divison to 10", 161, 209, 132, 17) GUICtrlCreateLabel("Addition/Subtraction to 10, Multiplication/Divison to 20 ", 160, 252, 153, 25) GUISetState(@SW_SHOW) $Name = InputBox("Welcome", "Welcome to My Math Helper V1.1. What is your name?") While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $ButLev1 GUISetState(@SW_HIDE) GUILeve11 () Case $name = 1 Exitloop Case Else ;;;;;;; EndSelect WEnd Exit Func GUILeve11 () #include <GUIConstants.au3> ; == GUI generated with Koda == $Level1 = GUICreate("Aust-Electronics: Math Helper: Level 1", 353, 296, 192, 125) GUICtrlCreateLabel("You have chosen Level 1. It contains Addition and Subtraction up to 10", 8, 8, 315, 41) $Group1 = GUICtrlCreateGroup("Instructions:", 8, 48, 329, 121) GUICtrlCreateLabel("Congratulations on choosing Level 1. After you click start, A Dialouge Box will apear with a coutdown from 10. This is all the time you have to get ready. Next you will be asked 10 questions on Addition and Subtraction up to 10. Answer these WITHOUT using a calculator, you may use paper. When you're done, your time will be displayed. Try to beat your high scores and move up the levels. Good Luck!", 16, 64, 312, 97) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Last Score:", 8, 176, 73, 41) GUICtrlCreateLabel("00109328", 16, 192, 52, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateLabel("10938", 16, 232, 34, 17) $Group3 = GUICtrlCreateGroup("High Score:", 8, 216, 73, 41) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("START!", 88, 176, 65, 41) $Pic1 = GUICtrlCreatePic("\images\Level1logo.bmp", 160, 176, 177, 81) $Button2 = GUICtrlCreateButton("Back", 88, 224, 65, 33) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button2 ExitLoop Case $msg = $Button1 Level1Q () EndSelect WEnd Exit EndFunc Func Level1Q () $1correct = 0 For $CD = 10 to 1 Step -1 MsgBox (0, "Get Ready", "You have " & $CD &" seconds remaining. Good luck!", 1) Next $time1 = TimerStart ( ) $1q1 = InputBox ( "Question 1", "What is 1 + 5?") If $1q1 = 6 Then Dim $1correct1 = $1correct + 1 Else ;;;;;; EndIf $1q2 = InputBox ( "Question 2", "What is 6 - 4?") If $1q2 = 2 Then Dim $1correct2 = $1correct1 + 1 Else ;;;;;; EndIf $1q3 = InputBox ( "Question 3", "What is 3 + 2?") If $1q3 = 5 Then Dim $1correct3 = $1correct2 + 1 Else ;;;;;; EndIf $1q4 = InputBox ( "Question 4", "What is 7 - 4?") If $1q4 = 3 Then Dim $1correct4 = $1correct3 + 1 Else ;;;;;; EndIf $1q5 = InputBox ( "Question 5", "What is 3 + 5?") If $1q5 = 8 Then Dim $1correct5 = $1correct4 + 1 Else ;;;;;; EndIf $1q6 = InputBox ( "Question 6", "What is 10 - 9?") If $1q6 = 1 Then Dim $1correct6 = $1correct5 + 1 Else ;;;;;; EndIf $1q7 = InputBox ( "Question 7", "What is 2 + 2?") If $1q7 = 4 Then Dim $1correct7 = $1correct6 + 1 Else ;;;;;; EndIf $1q8 = InputBox ( "Question 8", "What is 9 - 2?") If $1q8 = 7 Then Dim $1correct8 = $1correct7 + 1 Else ;;;;;; EndIf $1q9 = InputBox ( "Question 9", "What is 4 + 5?") If $1q9 = 9 Then Dim $1correct9 = $1correct8 + 1 Else ;;;;;; EndIf $1q10 = InputBox ( "Question 10", "What is 10 - 0?") If $1q10 = 10 Then Dim $1correct10 = $1correct9 + 1 EndIf Local $timing = TimerDiff ($time1) Local $time1 = Abs ($timing / 1000) Local $time = Round ( $time1, -1) MsgBox (0, "Time", "Congratulations, you took " & $time & " seconds to complete level 1.") MsgBox (1, "Correct Answers:", "Congratulations, " & $Name & ", You got " & $1correct1 & " out of 10 possible correct answers.") FileOpen ( "Scores\Level1Scores.txt", 1 ) FileWriteLine ("Scores\Level1Scores.txt", $Name & " Got " & $1correct1 & " answer(s) correct, in " & $time & " seconds") EndFunc Oh and how can i get the main screen to close after the level 1 gui pops up. Edited October 3, 2006 by bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
tresa Posted October 3, 2006 Share Posted October 3, 2006 $1q2 = InputBox ( "Question 2", "What is 6 - 4?") If $1q2 = 6 Then Dim $1correct2 = $1correct1 + 1 Else ;;;;;; EndIfYour test is a bit strange, you give a score if the answer is false 6-4 =2 and not 6also maybe there's a pb with inputbos which replies a string as you're testing a number? Link to comment Share on other sites More sharing options...
BrettF Posted October 3, 2006 Author Share Posted October 3, 2006 (edited) Thanks. woops- typo. So what do i should i do? Edited October 3, 2006 by bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
BrettF Posted October 3, 2006 Author Share Posted October 3, 2006 Actually, many typos . What the hell is up with that? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted October 3, 2006 Share Posted October 3, 2006 expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> Global $correct,$incorrect ; == GUI generated with Koda == $MainMenu = GUICreate("My Math Helper", 353, 296, 192, 125) $ButLev1 = GUICtrlCreateButton("Level 1", 56, 48, 89, 41) GUICtrlCreateLabel("Please select a level to start playing:", 8, 8, 203, 25) $Butlev2 = GUICtrlCreateButton("Level 2", 56, 96, 89, 41) $Butlev3 = GUICtrlCreateButton("Level 3", 56, 144, 89, 41) $Butlev4 = GUICtrlCreateButton("Level 4", 56, 192, 89, 41) $Butlev5 = GUICtrlCreateButton("Level 5", 56, 240, 89, 41) $Group1 = GUICtrlCreateGroup("Includes:", 152, 48, 185, 41) $Group3 = GUICtrlCreateGroup("Includes:", 152, 144, 185, 41) $Group9 = GUICtrlCreateGroup("Includes:", 152, 192, 185, 41) $Group11 = GUICtrlCreateGroup("Includes:", 152, 96, 185, 41) $Group21 = GUICtrlCreateGroup("Includes:", 152, 240, 185, 41) $Pic1 = GUICtrlCreatePic("", 8, 48, 41, 41) $Pic2 = GUICtrlCreatePic("", 8, 96, 41, 41) $Pic3 = GUICtrlCreatePic("", 8, 144, 41, 41) $Pic4 = GUICtrlCreatePic("", 8, 192, 41, 41) $Pic5 = GUICtrlCreatePic("", 8, 240, 41, 41) GUICtrlCreateLabel("Addition/Subtraction to 20", 160, 64, 128, 17) GUICtrlCreateLabel("Addition/Subtraction to 50", 160, 112, 128, 17) GUICtrlCreateLabel("Multiplication/Divison to 5", 160, 160, 126, 17) GUICtrlCreateLabel("Multiplication/Divison to 10", 161, 209, 132, 17) GUICtrlCreateLabel("Addition/Subtraction to 10, Multiplication/Divison to 20 ", 160, 252, 153, 25) GUISetState(@SW_SHOW) $Name = InputBox("Welcome", "Welcome to My Math Helper V1.1. What is your name?") While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $ButLev1 GUISetState(@SW_HIDE) GUILeve11 () Case $name = 1 Exitloop Case Else ;;;;;;; EndSelect WEnd Exit Func GUILeve11 () #include <GUIConstants.au3> ; == GUI generated with Koda == $Level1 = GUICreate("Aust-Electronics: Math Helper: Level 1", 353, 296, 192, 125) GUICtrlCreateLabel("You have chosen Level 1. It contains Addition and Subtraction up to 10", 8, 8, 315, 41) $Group1 = GUICtrlCreateGroup("Instructions:", 8, 48, 329, 121) GUICtrlCreateLabel("Congratulations on choosing Level 1. After you click start, A Dialouge Box will apear with a coutdown from 10. This is all the time you have to get ready. Next you will be asked 10 questions on Addition and Subtraction up to 10. Answer these WITHOUT using a calculator, you may use paper. When you're done, your time will be displayed. Try to beat your high scores and move up the levels. Good Luck!", 16, 64, 312, 97) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Last Score:", 8, 176, 73, 41) GUICtrlCreateLabel("00109328", 16, 192, 52, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateLabel("10938", 16, 232, 34, 17) $Group3 = GUICtrlCreateGroup("High Score:", 8, 216, 73, 41) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("START!", 88, 176, 65, 41) $Pic1 = GUICtrlCreatePic("\images\Level1logo.bmp", 160, 176, 177, 81) $Button2 = GUICtrlCreateButton("Back", 88, 224, 65, 33) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button2 ExitLoop Case $msg = $Button1 Level1Q () EndSelect WEnd Exit EndFunc Func Level1Q () $correct = 0 $incorrect = 0 $time1 = TimerStart ( ) $1q1 = InputBox ( "Question 1", "What is 1 + 5?") If $1q1 = 6 Then $correct +=1 Else $incorrect +=1 EndIf $1q2 = InputBox ( "Question 2", "What is 6 - 4?") If $1q2 = 2 Then $correct +=1 Else $incorrect +=1 EndIf $1q3 = InputBox ( "Question 3", "What is 3 + 2?") If $1q3 = 5 Then $correct +=1 Else $incorrect +=1 EndIf $1q4 = InputBox ( "Question 4", "What is 7 - 4?") If $1q4 = 3 Then $correct +=1 Else $incorrect +=1 EndIf $1q5 = InputBox ( "Question 5", "What is 3 + 5?") If $1q5 = 8 Then $correct +=1 Else $incorrect +=1 EndIf $1q6 = InputBox ( "Question 6", "What is 10 - 9?") If $1q6 = 1 Then $correct +=1 Else $incorrect +=1 EndIf $1q7 = InputBox ( "Question 7", "What is 2 + 2?") If $1q7 = 4 Then $correct +=1 Else $incorrect +=1 EndIf $1q8 = InputBox ( "Question 8", "What is 9 - 2?") If $1q8 = 7 Then $correct +=1 Else $incorrect +=1 EndIf $1q9 = InputBox ( "Question 9", "What is 4 + 5?") If $1q9 = 9 Then $correct +=1 Else $incorrect +=1 EndIf $1q10 = InputBox ( "Question 10", "What is 10 - 0?") If $1q10 = 10 Then $correct +=1 Else $incorrect +=1 EndIf Local $timing = TimerDiff ($time1) Local $time1 = Abs ($timing / 1000) Local $time = Round ( $time1, -1) MsgBox (0, "Time", "Congratulations, you took " & $time & " seconds to complete level 1.") MsgBox (1, "Correct Answers:", "Congratulations, " & $Name & ", You got " & $correct & " out of 10(" & $incorrect &" incorrect) possible correct answers.") FileOpen ( "Scores\Level1Scores.txt", 1 ) FileWriteLine ("Scores\Level1Scores.txt", $Name & " Got " & $correct & " answer(s) correct, in " & $time & " seconds") EndFunc Link to comment Share on other sites More sharing options...
BrettF Posted October 3, 2006 Author Share Posted October 3, 2006 I keep getting more errors with the varibles... HELP PLEASE. Thanks for your help tresa. ARRRGHHHH!! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
BrettF Posted October 3, 2006 Author Share Posted October 3, 2006 Ooohh thanks Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
BrettF Posted October 3, 2006 Author Share Posted October 3, 2006 Um i get error? Expected a "=" operator in assignment statement.: $incorrect +=1 $incorrect ^ ERROR Ummm... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted October 3, 2006 Share Posted October 3, 2006 use beta Link to comment Share on other sites More sharing options...
BrettF Posted October 3, 2006 Author Share Posted October 3, 2006 use betaok thanks Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
tresa Posted October 3, 2006 Share Posted October 3, 2006 Actually, many typos . What the hell is up with that?you have a lot of correct score so each one is set to 1 max$lcorrect1$lcorrect2 ...you have to take only one $lcorrect in each test and increase it also make a func like thisfunc question($questionNumber,$question,$correctAnswer)if inputbox("Question N° " & $questionNumber,$question)=$correctAnswer thenquestion=1elsequestion=0endifend funcand your code will be$lcorrect=$lcorrect+question(3,"What is 3+2?","5")$lcorrect=$lcorrect+question(4,"What is 6+2?","8")... Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted October 3, 2006 Share Posted October 3, 2006 get rid of those blasted variables jebesus christ although you might leave them just for the sake if you go far with this project you could analyze and show which problems they got wrong to know which ones to work on for in the future expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> Global $correct,$incorrect ; == GUI generated with Koda == $MainMenu = GUICreate("My Math Helper", 353, 296, 192, 125) $ButLev1 = GUICtrlCreateButton("Level 1", 56, 48, 89, 41) GUICtrlCreateLabel("Please select a level to start playing:", 8, 8, 203, 25) $Butlev2 = GUICtrlCreateButton("Level 2", 56, 96, 89, 41) $Butlev3 = GUICtrlCreateButton("Level 3", 56, 144, 89, 41) $Butlev4 = GUICtrlCreateButton("Level 4", 56, 192, 89, 41) $Butlev5 = GUICtrlCreateButton("Level 5", 56, 240, 89, 41) $Group1 = GUICtrlCreateGroup("Includes:", 152, 48, 185, 41) $Group3 = GUICtrlCreateGroup("Includes:", 152, 144, 185, 41) $Group9 = GUICtrlCreateGroup("Includes:", 152, 192, 185, 41) $Group11 = GUICtrlCreateGroup("Includes:", 152, 96, 185, 41) $Group21 = GUICtrlCreateGroup("Includes:", 152, 240, 185, 41) $Pic1 = GUICtrlCreatePic("", 8, 48, 41, 41) $Pic2 = GUICtrlCreatePic("", 8, 96, 41, 41) $Pic3 = GUICtrlCreatePic("", 8, 144, 41, 41) $Pic4 = GUICtrlCreatePic("", 8, 192, 41, 41) $Pic5 = GUICtrlCreatePic("", 8, 240, 41, 41) GUICtrlCreateLabel("Addition/Subtraction to 20", 160, 64, 128, 17) GUICtrlCreateLabel("Addition/Subtraction to 50", 160, 112, 128, 17) GUICtrlCreateLabel("Multiplication/Divison to 5", 160, 160, 126, 17) GUICtrlCreateLabel("Multiplication/Divison to 10", 161, 209, 132, 17) GUICtrlCreateLabel("Addition/Subtraction to 10, Multiplication/Divison to 20 ", 160, 252, 153, 25) GUISetState(@SW_SHOW) $Name = InputBox("Welcome", "Welcome to My Math Helper V1.1. What is your name?") While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $ButLev1 GUISetState(@SW_HIDE) GUILeve11 () Case $name = 1 Exitloop Case Else ;;;;;;; EndSelect WEnd Exit Func GUILeve11 () #include <GUIConstants.au3> ; == GUI generated with Koda == $Level1 = GUICreate("Aust-Electronics: Math Helper: Level 1", 353, 296, 192, 125) GUICtrlCreateLabel("You have chosen Level 1. It contains Addition and Subtraction up to 10", 8, 8, 315, 41) $Group1 = GUICtrlCreateGroup("Instructions:", 8, 48, 329, 121) GUICtrlCreateLabel("Congratulations on choosing Level 1. After you click start, A Dialouge Box will apear with a coutdown from 10. This is all the time you have to get ready. Next you will be asked 10 questions on Addition and Subtraction up to 10. Answer these WITHOUT using a calculator, you may use paper. When you're done, your time will be displayed. Try to beat your high scores and move up the levels. Good Luck!", 16, 64, 312, 97) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Last Score:", 8, 176, 73, 41) GUICtrlCreateLabel("00109328", 16, 192, 52, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateLabel("10938", 16, 232, 34, 17) $Group3 = GUICtrlCreateGroup("High Score:", 8, 216, 73, 41) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("START!", 88, 176, 65, 41) $Pic1 = GUICtrlCreatePic("\images\Level1logo.bmp", 160, 176, 177, 81) $Button2 = GUICtrlCreateButton("Back", 88, 224, 65, 33) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button2 ExitLoop Case $msg = $Button1 Level1Q () EndSelect WEnd Exit EndFunc Func Level1Q () $correct = 0 $incorrect = 0 $time1 = TimerStart ( ) If InputBox ( "Question 1", "What is 1 + 5?") = 6 Then $correct +=1 Else $incorrect +=1 EndIf If InputBox ( "Question 2", "What is 6 - 4?") = 2 Then $correct +=1 Else $incorrect +=1 EndIf If InputBox ( "Question 3", "What is 3 + 2?") = 5 Then $correct +=1 Else $incorrect +=1 EndIf If InputBox ( "Question 4", "What is 7 - 4?") = 3 Then $correct +=1 Else $incorrect +=1 EndIf If InputBox ( "Question 5", "What is 3 + 5?") = 8 Then $correct +=1 Else $incorrect +=1 EndIf If InputBox ( "Question 6", "What is 10 - 9?") = 1 Then $correct +=1 Else $incorrect +=1 EndIf If InputBox ( "Question 7", "What is 2 + 2?") = 4 Then $correct +=1 Else $incorrect +=1 EndIf If InputBox ( "Question 8", "What is 9 - 2?") = 7 Then $correct +=1 Else $incorrect +=1 EndIf If InputBox ( "Question 9", "What is 4 + 5?") = 9 Then $correct +=1 Else $incorrect +=1 EndIf If InputBox ( "Question 10", "What is 10 - 0?") = 10 Then $correct +=1 Else $incorrect +=1 EndIf Local $timing = TimerDiff ($time1) Local $time1 = Abs ($timing / 1000) Local $time = Round ( $time1, -1) MsgBox (0, "Time", "Congratulations, you took " & $time & " seconds to complete level 1.") MsgBox (1, "Correct Answers:", "Congratulations, " & $Name & ", You got " & $correct & " out of 10(" & $incorrect &" incorrect) possible correct answers.") FileOpen ( "Scores\Level1Scores.txt", 1 ) FileWriteLine ("Scores\Level1Scores.txt", $Name & " Got " & $correct & " answer(s) correct, in " & $time & " seconds") EndFunc Link to comment Share on other sites More sharing options...
tresa Posted October 3, 2006 Share Posted October 3, 2006 (edited) a sample code func question($questionNumber,$question,$correctAnswer,ByRef $rep) $rep[$questionNumber][$questionNumber][1]=$correctAnswer $rep[$questionNumber][$questionNumber][0]=$question $rep[$questionNumber][$questionNumber][2]=inputbox("Question N° " & $questionNumber,$question) if $rep[$questionNumber][$questionNumber][2]=$correctAnswer then return 1 else return 0 endif endfunc dim $reponses[10][10][3] $lcorrect=0 $lcorrect=$lcorrect+question(1,"What is 3+2?","5",$reponses) $lcorrect=$lcorrect+question(2,"What is 6+2?","8",$reponses) MsgBox(0,"Résultats","Nombre de réponses correctes : " & $lcorrect) msgbox(0,"",$reponses[1][1][0]) Edited October 3, 2006 by tresa Link to comment Share on other sites More sharing options...
BrettF Posted October 3, 2006 Author Share Posted October 3, 2006 Thanks guys, thatsgreat2345, i'll keep that in mind for future 'version' thanks for yout guys help. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
BrettF Posted October 3, 2006 Author Share Posted October 3, 2006 (edited) see in the code where i try to write to a txt file?: FileOpen ( "Scores\Level1Scores.txt", 1 ) FileWriteLine ("Scores\Level1Scores.txt", "$correct = " & $correct) EndFuncoÝ÷ ØÛajÛh Can anyone help me? Edited October 3, 2006 by bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 3, 2006 Moderators Share Posted October 3, 2006 (edited) GUICtrlSetData() Edit: Or if you trying to make the file do what the last value is in the GUI, then look at GUICtrlRead(). Edited October 3, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
BrettF Posted October 3, 2006 Author Share Posted October 3, 2006 Thanks i'll try that. 8) Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
BrettF Posted October 4, 2006 Author Share Posted October 4, 2006 I didn't work 4 me. Any chance u could give me some code to set me on my way? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 4, 2006 Moderators Share Posted October 4, 2006 I didn't work 4 me. Any chance u could give me some code to set me on my way?No, not really... Not much on the "it didn't work" exscuse, without seeing what you did to try and make it work. This way you get a better understanding. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
BrettF Posted October 4, 2006 Author Share Posted October 4, 2006 (edited) No, not really... Not much on the "it didn't work" exscuse, without seeing what you did to try and make it work. This way you get a better understanding. Heres where it opens the file and reads the first line to create the last score: $lev1rec = FileOpen ( "\Scores\RecentLevel1Scores.txt", 0) $lastrec = FileReadLine ( $lev1rec, 1)oÝ÷ Ø@ÈL7¥z×j¶§v´÷aÞë0êÞ¶¯j¸è¬ºÇ{azÇ+ZºÚ"µÍÌÍÑÜÝHÕRPÝÜX]QÜÝ ][ÝÓÝØÛÜN][ÝËMÍ ÌË JBÕRPÝÜX]SX[ ÌÍÛ]XËMNL LMÊoÝ÷ Ø ÝêÞ³^ëayø¥{¬§^¶Z½ëazV¬¶Ç(殶sbb33c¶Ã&V2ÒfÆT÷VâgV÷Cµ66÷&W2b3#µ&V6VçDÆWfVÃ66÷&W2çGBgV÷C²Â"¤fÆUw&FTÆæRgV÷Cµ66÷&W2b3#µ&V6VçDÆWfVÃ66÷&W2çGBgV÷C²Âb33c¶6÷'&V7B¤fÆT6Æ÷6Rb33c¶Ã&V2 So where di i go wrong??? Edited October 4, 2006 by bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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