Kyler Carlson Posted November 10, 2006 Share Posted November 10, 2006 okay heres my code... expandcollapse popupGlobal $count = 1 Global $correct1 Global $correct2 Global $correct3 Global $correct4 Global $correct5 Global $correct6 Global $correct7 Global $correct8 Global $correct9 Global $correct10 Global $correct11 Global $correct12 Global $correct13 Global $correct14 ;### Words ### $word_1 = "Pala" $word_2 = "Anteojos" $word_3 = "Huevo" $word_4 = "Maiz" $word_5 = "Tamano" $word_6 = "Tortuga" $word_7 = "Desvan" $word_8 = "Abeja" $word_9 = "Pulsera" $word_10 = "Ninguna Parte" $word_11 = "Alguna parte" $word_12 = "Cajon" $word_13 = "Mojarse" $word_14 = "Imperdible" ;### Defenitions ### $def_1 = "Spade" $def_2 = "Glasses" $def_3 = "Egg" $def_4 = "Corn" $def_5 = "Size" $def_6 = "Turtle" $def_7 = "Attic" $def_8 = "Bumble Bee" $def_9 = "Bracelet" $def_10 = "Nowhere" $def_11 = "Somewhere" $def_12 = "Drawer" $def_13 = "To Wet" $def_14 = "Pin" HotKeySet("{F1}","start") HotKeySet("{esc}","exit1") While 1 sleep(100) WEnd Func start() $num = Round(Random(0.5,14.5),0) Do If $num = 1 And $correct1 = 0 Then word($word_1,$def_1) MsgBox(0,"",$correct1) ElseIf $num = 2 And $correct2 = 0 Then word($word_2,$def_2) MsgBox(0,"",$correct2) ElseIf $num = 3 And $correct3 = 0 Then word($word_3,$def_3) MsgBox(0,"",$correct3) ElseIf $num = 4 And $correct4 = 0 Then word($word_4,$def_4) MsgBox(0,"",$correct4) ElseIf $num = 5 And $correct5 = 0 Then word($word_5,$def_5) MsgBox(0,"",$correct5) ElseIf $num = 6 And $correct6 = 0 Then word($word_6,$def_6) MsgBox(0,"",$correct6) ElseIf $num = 7 And $correct7 = 0 Then word($word_7,$def_7) MsgBox(0,"",$correct7) ElseIf $num = 8 And $correct8 = 0 Then word($word_8,$def_8) MsgBox(0,"",$correct8) ElseIf $num = 9 And $correct9 = 0 Then word($word_9,$def_9) MsgBox(0,"",$correct9) ElseIf $num = 10 And $correct10 = 0 Then word($word_10,$def_10) MsgBox(0,"",$correct10) ElseIf $num = 11 And $correct11 = 0 Then word($word_11,$def_11) MsgBox(0,"",$correct11) ElseIf $num = 12 And $correct12 = 0 Then word($word_12,$def_12) MsgBox(0,"",$correct12) ElseIf $num = 13 And $correct13 = 0 Then word($word_13,$def_13) MsgBox(0,"",$correct13) ElseIf $num = 14 And $correct14 = 0 Then word($word_14,$def_14) MsgBox(0,"",$correct14) Else $num = Round(Random(0.5,14.5),0) EndIf Until $correct1 = 1 And $correct2 = 1 And $correct3 = 1 And $correct4 = 1 And $correct5 = 1 And $correct6 = 1 And $correct7 = 1 And $correct8 = 1 And $correct9 = 1 And $correct10 = 1 And $correct11 = 1 And $correct12 = 1 And $correct13 = 1 And $correct14 = 1 EndFunc Func word($word,$def) $ans = InputBox("Spanish Papelles Bancos",$def,"") If $ans = $word Then If $count = 1 Then $correct1 = 1 ;MsgBox(0,"",$correct1) EndIf If $count = 2 Then $correct2 = 1 ;MsgBox(0,"",$correct2) EndIf If $count = 3 Then $correct3 = 1 ; MsgBox(0,"",$correct3) EndIf If $count = 4 Then $correct4 = 1 ;MsgBox(0,"",$correct4) EndIf If $count = 5 Then $correct5 = 1 ;MsgBox(0,"",$correct5) EndIf If $count = 6 Then $correct6 = 1 ;MsgBox(0,"",$correct6) EndIf If $count = 7 Then $correct7 = 1 ;MsgBox(0,"",$correct7) EndIf If $count = 8 Then $correct8 = 1 ;MsgBox(0,"",$correct8) EndIf If $count = 9 Then $correct9 = 1 ;MsgBox(0,"",$correct9) EndIf If $count = 10 Then $correct10 = 1 ;MsgBox(0,"",$correct10) EndIf If $count = 11 Then $correct11 = 1 ;MsgBox(0,"",$correct11) EndIf If $count = 12 Then $correct12 = 1 ;MsgBox(0,"",$correct12) EndIf If $count = 13 Then $correct13 = 1 ;MsgBox(0,"",$correct13) EndIf If $count = 14 Then $correct14 = 1 ;MsgBox(0,"",$correct14) EndIf Global $num = Round(Random(0.5,14.5),0) $count = $count + 1 MsgBox(0,"Correct",$def & " : " & $word) Else MsgBox(0,"Incorrect",$def & " : " & $word) EndIf EndFunc Func exit1() Exit EndFunc it you run it, it will pop up a random word that i'm studying for for my spanish test... the problem is that its repeating the words even after you've spelt them right... say it has "spade" as the first thing to spell... you type in "pala", the right answer... it should then be setting $correct1 = 1 but when my little debug message pops up that tells you what $correct1 really equals... it doesn't register that it should equal one and thus repeates things u've already spelt right... anyone know why because help is greatly appreciated and time is of the essence since the test is tomorrow... also... please don't tell me to study the old fashioned way... ik that that would b better since this isn't a functioning program yet but... u don't need to remind me... thanks in advance Link to comment Share on other sites More sharing options...
Paulie Posted November 10, 2006 Share Posted November 10, 2006 Not bad, but you could shorten you code immensely by looking into arrays. and also "Switch...case" statements can get reid of alot of those "If" statments Link to comment Share on other sites More sharing options...
Kyler Carlson Posted November 10, 2006 Author Share Posted November 10, 2006 okay thanks but... why isn't it working... like why arent the variables registering as being 1 to stop them from repeating that question? Link to comment Share on other sites More sharing options...
herewasplato Posted November 10, 2006 Share Posted November 10, 2006 expandcollapse popupGlobal $num Global $correct1 Global $correct2 Global $correct3 Global $correct4 Global $correct5 Global $correct6 Global $correct7 Global $correct8 Global $correct9 Global $correct10 Global $correct11 Global $correct12 Global $correct13 Global $correct14 ;### Words ### $word_1 = "Pala" $word_2 = "Anteojos" $word_3 = "Huevo" $word_4 = "Maiz" $word_5 = "Tamano" $word_6 = "Tortuga" $word_7 = "Desvan" $word_8 = "Abeja" $word_9 = "Pulsera" $word_10 = "Ninguna Parte" $word_11 = "Alguna parte" $word_12 = "Cajon" $word_13 = "Mojarse" $word_14 = "Imperdible" ;### Defenitions ### $def_1 = "Spade" $def_2 = "Glasses" $def_3 = "Egg" $def_4 = "Corn" $def_5 = "Size" $def_6 = "Turtle" $def_7 = "Attic" $def_8 = "Bumble Bee" $def_9 = "Bracelet" $def_10 = "Nowhere" $def_11 = "Somewhere" $def_12 = "Drawer" $def_13 = "To Wet" $def_14 = "Pin" HotKeySet("{F1}", "start") HotKeySet("{esc}", "exit1") While 1 Sleep(100) WEnd Func start() Do $num = Random(1, 14, 1) If $num = 1 And $correct1 = 0 Then word($word_1, $def_1) If $num = 2 And $correct2 = 0 Then word($word_2, $def_2) If $num = 3 And $correct3 = 0 Then word($word_3, $def_3) If $num = 4 And $correct4 = 0 Then word($word_4, $def_4) If $num = 5 And $correct5 = 0 Then word($word_5, $def_5) If $num = 6 And $correct6 = 0 Then word($word_6, $def_6) If $num = 7 And $correct7 = 0 Then word($word_7, $def_7) If $num = 8 And $correct8 = 0 Then word($word_8, $def_8) If $num = 9 And $correct9 = 0 Then word($word_9, $def_9) If $num = 10 And $correct10 = 0 Then word($word_10, $def_10) If $num = 11 And $correct11 = 0 Then word($word_11, $def_11) If $num = 12 And $correct12 = 0 Then word($word_12, $def_12) If $num = 13 And $correct13 = 0 Then word($word_13, $def_13) If $num = 14 And $correct14 = 0 Then word($word_14, $def_14) Until $correct1 = 1 And $correct2 = 1 And $correct3 = 1 And $correct4 = 1 And $correct5 = 1 And $correct6 = 1 And $correct7 = 1 And $correct8 = 1 And $correct9 = 1 And $correct10 = 1 And $correct11 = 1 And $correct12 = 1 And $correct13 = 1 And $correct14 = 1 EndFunc ;==>start Func word($word, $def) $ans = InputBox("Spanish Papelles Bancos", $def, "") If $ans = $word Then If $num = 1 Then $correct1 = 1 If $num = 2 Then $correct2 = 1 If $num = 3 Then $correct3 = 1 If $num = 4 Then $correct4 = 1 If $num = 5 Then $correct5 = 1 If $num = 6 Then $correct6 = 1 If $num = 7 Then $correct7 = 1 If $num = 8 Then $correct8 = 1 If $num = 9 Then $correct9 = 1 If $num = 10 Then $correct10 = 1 If $num = 11 Then $correct11 = 1 If $num = 12 Then $correct12 = 1 If $num = 13 Then $correct13 = 1 If $num = 14 Then $correct14 = 1 MsgBox(0, "Correct", $def & " : " & $word) Else MsgBox(0, "Incorrect", $def & " : " & $word) EndIf EndFunc ;==>word Func exit1() Exit EndFunc ;==>exit1 [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Kyler Carlson Posted November 10, 2006 Author Share Posted November 10, 2006 wow thanks a lot! Link to comment Share on other sites More sharing options...
CodeMaster Rapture Posted November 10, 2006 Share Posted November 10, 2006 (edited) There has been a technical difficulty, will repost later... -CMR Edited November 10, 2006 by CodeMaster Rapture Link to comment Share on other sites More sharing options...
herewasplato Posted November 10, 2006 Share Posted November 10, 2006 (edited) expandcollapse popupGlobal $num Global $correct[14] Global $word[14] Global $def[14] ;### Words ### $word[0] = "Pala" $word[1] = "Anteojos" $word[2] = "Huevo" $word[3] = "Maiz" $word[4] = "Tamano" $word[5] = "Tortuga" $word[6] = "Desvan" $word[7] = "Abeja" $word[8] = "Pulsera" $word[9] = "Ninguna Parte" $word[10] = "Alguna parte" $word[11] = "Cajon" $word[12] = "Mojarse" $word[13] = "Imperdible" ;### Defenitions ### $def[0] = "Spade" $def[1] = "Glasses" $def[2] = "Egg" $def[3] = "Corn" $def[4] = "Size" $def[5] = "Turtle" $def[6] = "Attic" $def[7] = "Bumble Bee" $def[8] = "Bracelet" $def[9] = "Nowhere" $def[10] = "Somewhere" $def[11] = "Drawer" $def[12] = "To Wet" $def[13] = "Pin" HotKeySet("{F1}", "start") HotKeySet("{esc}", "exit1") While 1 Sleep(100) WEnd Func start() Do $num = Random(0, 13, 1) If $correct[$num] = 0 Then word($word[$num], $def[$num]) Until $correct[0] = 1 And _ $correct[1] = 1 And _ $correct[2] = 1 And _ $correct[3] = 1 And _ $correct[4] = 1 And _ $correct[5] = 1 And _ $correct[6] = 1 And _ $correct[7] = 1 And _ $correct[8] = 1 And _ $correct[9] = 1 And _ $correct[10] = 1 And _ $correct[11] = 1 And _ $correct[12] = 1 And _ $correct[13] = 1 EndFunc ;==>start Func word($word, $def) $ans = InputBox("Spanish Papelles Bancos", $def, "") If $ans = $word Then $correct[$num] = 1 MsgBox(0, "Correct", $def & " : " & $word) Else MsgBox(0, "Incorrect", $def & " : " & $word) EndIf EndFunc ;==>word Func exit1() Exit EndFunc ;==>exit1Edit: used line continuations for cleaner posts Edited November 10, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] 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