Kreatorul Posted August 31, 2006 Posted August 31, 2006 (edited) Well...I was getting bored(again) and I decided to make a quizz game Here is the code...please tell me what you think! The code is quite a mess:D i'm still freakin' noob expandcollapse popup#include <GuiConstants.au3> Opt("OnExitFunc", "endscript") ;Get the questions and answers file InetGet("http://torrents4all.evonet.ro/q&a.txt", @TempDir & "\q&a.txt", 1) ;Variables: GuiCreate("Guessing game", 220, 500) $menu = GUICtrlCreateMenu ("File") $exit = GUICtrlCreateMenuitem ("Exit", $menu) $help= GUICtrlCreateMenu ("Help") $info = GUICtrlCreateMenuitem ("Info", $help) $about = GUICtrlCreateMenuitem ("About", $help) $label1=Guictrlcreatelabel(FileReadLine(@TempDir & "\q&a.txt", 1), 10, 20) $input1=GuiCtrlCreateInput("", 10, 35, 150) $label2=Guictrlcreatelabel(FileReadLine(@TempDir & "\q&a.txt", 2), 10, 60) $input2=GuiCtrlCreateInput("", 10, 75, 150) $label3=Guictrlcreatelabel(FileReadLine(@TempDir & "\q&a.txt", 3), 10, 100) $input3=GuiCtrlCreateInput("", 10, 115, 150) $label4=Guictrlcreatelabel(FileReadLine(@TempDir & "\q&a.txt", 4), 10, 140) $input4=GuiCtrlCreateInput("", 10, 155, 150) $label5=Guictrlcreatelabel(FileReadLine(@TempDir & "\q&a.txt", 5), 10, 180) $input5=GuiCtrlCreateInput("", 10, 195, 150) $label6=Guictrlcreatelabel(FileReadLine(@TempDir & "\q&a.txt", 6), 10, 220) $input6=GuiCtrlCreateInput("", 10, 235, 150) $label7=Guictrlcreatelabel(FileReadLine(@TempDir & "\q&a.txt", 7), 10, 260) $input7=GuiCtrlCreateInput("", 10, 275, 150) $label8=Guictrlcreatelabel(FileReadLine(@TempDir & "\q&a.txt", 8), 10, 300) $input8=GuiCtrlCreateInput("", 10, 315, 150) $label9=Guictrlcreatelabel(FileReadLine(@TempDir & "\q&a.txt", 9), 10, 340) $input9=GuiCtrlCreateInput("", 10, 355, 150) $label10=Guictrlcreatelabel(FileReadLine(@TempDir & "\q&a.txt", 10), 10, 380) $input10=GuiCtrlCreateInput("", 10, 395, 150) $check=GuiCtrlCreateButton("Check", 10, 430) $dw2=GuiCtrlCreateButton("Download questions", 55, 430) GUISetState() ;Actions: $msg=0 While $msg <> $GUI_EVENT_CLOSE If $msg=$check Then If guictrlread($input1)=FileReadLine(@TempDir & "\q&a.txt", 11) Then GuiCtrlCreateLabel("Correct", 170, 37) EndIf If $msg=$check Then If guictrlread($input1)<>FileReadLine(@TempDir & "\q&a.txt", 11) Then GuiCtrlCreateLabel("Incorrect", 170, 37) EndIf If $msg=$check Then If guictrlread($input2)=FileReadLine(@TempDir & "\q&a.txt", 12) Then GuiCtrlCreateLabel("Correct", 170, 77) EndIf If $msg=$check Then If guictrlread($input2)<>FileReadLine(@TempDir & "\q&a.txt", 12) Then GuiCtrlCreateLabel("Incorrect", 170, 77) EndIf If $msg=$check Then If guictrlread($input3)=FileReadLine(@TempDir & "\q&a.txt", 13) Then GuiCtrlCreateLabel("Correct", 170, 117) EndIf If $msg=$check Then If guictrlread($input3)<>FileReadLine(@TempDir & "\q&a.txt", 13) Then GuiCtrlCreateLabel("Incorrect", 170, 117) EndIf If $msg=$check Then If guictrlread($input4)=FileReadLine(@TempDir & "\q&a.txt", 14) Then GuiCtrlCreateLabel("Correct", 170, 157) EndIf If $msg=$check Then If guictrlread($input4)<>FileReadLine(@TempDir & "\q&a.txt", 14) Then GuiCtrlCreateLabel("Incorrect", 170, 157) EndIf If $msg=$check Then If guictrlread($input5)=FileReadLine(@TempDir & "\q&a.txt", 15) Then GuiCtrlCreateLabel("Correct", 170, 197) EndIf If $msg=$check Then If guictrlread($input5)<>FileReadLine(@TempDir & "\q&a.txt", 15) Then GuiCtrlCreateLabel("Incorrect", 170, 197) EndIf If $msg=$check Then If guictrlread($input6)=FileReadLine(@TempDir & "\q&a.txt", 16) Then GuiCtrlCreateLabel("Correct", 170, 237) EndIf If $msg=$check Then If guictrlread($input6)<>FileReadLine(@TempDir & "\q&a.txt", 16) Then GuiCtrlCreateLabel("Incorrect", 170, 237) EndIf If $msg=$check Then If guictrlread($input7)=FileReadLine(@TempDir & "\q&a.txt", 17) Then GuiCtrlCreateLabel("Correct", 170, 277) EndIf If $msg=$check Then If guictrlread($input7)<>FileReadLine(@TempDir & "\q&a.txt", 17) Then GuiCtrlCreateLabel("Incorrect", 170, 277) EndIf If $msg=$check Then If guictrlread($input8)=FileReadLine(@TempDir & "\q&a.txt", 18) Then GuiCtrlCreateLabel("Correct", 170, 317) EndIf If $msg=$check Then If guictrlread($input8)<>FileReadLine(@TempDir & "\q&a.txt", 18) Then GuiCtrlCreateLabel("Incorrect", 170, 317) EndIf If $msg=$check Then If guictrlread($input9)=FileReadLine(@TempDir & "\q&a.txt", 19) Then GuiCtrlCreateLabel("Correct", 170, 357) EndIf If $msg=$check Then If guictrlread($input9)<>FileReadLine(@TempDir & "\q&a.txt", 19) Then GuiCtrlCreateLabel("Incorrect", 170, 357) EndIf If $msg=$check Then If guictrlread($input10)=FileReadLine(@TempDir & "\q&a.txt", 20) Then GuiCtrlCreateLabel("Correct", 170, 397) EndIf If $msg=$check Then If guictrlread($input10)<>FileReadLine(@TempDir & "\q&a.txt", 20) Then GuiCtrlCreateLabel("Incorrect", 170, 397) EndIf If $msg=$dw2 Then InetGet("http://torrents4all.evonet.ro/q&a.txt", @TempDir & "\q&a.txt", 1) GuiCtrlSetData($label1,FileReadLine(@TempDir & "\q&a.txt", 1)) GuiCtrlSetData($label2,FileReadLine(@TempDir & "\q&a.txt", 2)) GuiCtrlSetData($label3,FileReadLine(@TempDir & "\q&a.txt", 3)) GuiCtrlSetData($label4,FileReadLine(@TempDir & "\q&a.txt", 4)) GuiCtrlSetData($label5,FileReadLine(@TempDir & "\q&a.txt", 5)) GuiCtrlSetData($label6,FileReadLine(@TempDir & "\q&a.txt", 6)) GuiCtrlSetData($label7,FileReadLine(@TempDir & "\q&a.txt", 7)) GuiCtrlSetData($label8,FileReadLine(@TempDir & "\q&a.txt", 8)) GuiCtrlSetData($label9,FileReadLine(@TempDir & "\q&a.txt", 9)) GuiCtrlSetData($label10,FileReadLine(@TempDir & "\q&a.txt", 10)) EndIf If $msg=$info Then MsgBox(0, "Info", "Enter your answers in the input box and click check!") If $msg=$about Then MsgBox(0, "About", "Simple guessing game :) Programing by Kreatorul") $msg = GUIGetMsg() If $msg=$exit Then ExitLoop WEnd Func endscript() FileDelete(@TempDir & "\q&a.txt") EndFunc This is just an example..i will put some real questions later...p.s: for question 1 the answer is answer 1 and so on...just to check if it works...You can upload your own q&a.txt to a webserver and change the inetget adress. This is the first release...Only use the download questions button if you changed the questions on the webserver and want a quick refresh....it still has some bugs but I'll improve it soon...I said enough Enjoy Edited August 31, 2006 by Kreatorul
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