Ok I can't figure it out, here's my code:
Turing: | import GUI
var picID, picID1, picID2, picID3, picID4, picID5, picID7, picID8, picID9, picID10, picID11, answer : int
var fontID : int := Font.New ("Import:40:underline")
var fontID1 : int := Font.New ("Import:12:underline")
var fontID2 : int := Font.New ("Script MT Bold:40:underline")
var fontID3 : int := Font.New ("Times New Roman:12:underline")
var fontID6 : int := Font.New ("Allegro BT:40:underline")
var fontID7 : int := Font.New ("Rockwell:12")
var fontID8 : int := Font.New ("Kidprint:18")
var fontID9 : int := Font.New ("Destine:40:underline")
picID := Pic.FileNew ("krusty2.jpg")
picID1 := Pic.FileNew ("mario1.jpg")
picID2 := Pic.FileNew ("aladdin.jpg")
picID3 := Pic.FileNew ("spongepic.jpg")
picID4 := Pic.FileNew ("daffy.jpg")
picID5 := Pic.FileNew ("genie.jpg")
picID7 := Pic.FileNew ("daffy1.jpg")
picID8 := Pic.FileNew ("bugs1.jpg")
picID9 := Pic.FileNew ("mariopic1.jpg")
picID10 := Pic.FileNew ("coolredback.jpg")
picID11 := Pic.FileNew ("spongepic1.jpg")
process timer
answer := 0
get answer
end timer
drawfill (0, 0, 76, 7)
Font.Draw ("Choose An Exercise", 125, 350, fontID2, green)
Pic.Draw (picID2, 370, 265, picCopy)
Pic.Draw (picID3, 0, 200, picCopy)
Pic.Draw (picID1, 370, 130, picMerge)
Pic.Draw (picID4, 0, 70, picMerge)
locatexy (150, 50)
cls
procedure Adding
%ADDING
cls
drawfill (0, 0, 7, 7)
Pic.Draw (picID5, 100, 50, picCopy)
Font.Draw ("Addition Practice!", 125, 350, fontID6, 52)
Font.Draw ("You Will Be Given 4 Seconds Per Question", 300, 275, fontID7, 52)
delay (4000)
Font.Draw ("Press Any Key When You Are Ready!", 300, 225, fontID7, 52)
Music.PlayFile ("bath.wav")
Input.Pause
delay (1000)
cls
var a, b, c, corr, incorr, timout, w : int
var t, r, d, e : array 1 .. 100 of real
var picID6 : int
picID6 := Pic.FileNew ("clock.jpg")
var fontID4 : int := Font.New ("Times New Roman:125")
randomize
timout := 0
corr := 0
incorr := 0
w := 1
for x : 1 .. 10
randint (a, 1, 10)
randint (b, 1, 10)
t (x ) := a
r (x ) := b
c := a + b
d (x ) := c
put " You only have 4 seconds to answer!!!"
put " "
put "what is ", a : 3, " plus ", b : 3, " ? " ..
fork timer
Pic.Draw (picID6, 100, 0, picCopy)
Font.Draw ("4", 210, 120, fontID4, white)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("3", 220, 120, fontID4, white)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("2", 220, 120, fontID4, red)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("1", 220, 120, fontID4, 12)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("0", 220, 120, fontID4, 12)
if answer = 0 then
put " you took too long"
timout := timout + 1
elsif answer = c then
put " great job"
corr := corr + 1
elsif answer not= c then
put " sorry"
incorr := incorr + 1
end if
e (x ) := answer
delay (2000)
cls
w := w + 1
end for
for f : 1 .. (w - 1)
put "Question ", f, " was ", t (f ), " plus ", r (f ), " = ", d (f )
if e (f ) = d (f ) then
put "Your answer was ", e (f ), " and you were correct!"
put " "
delay (2000)
elsif e (f ) not= d (f ) and e (f ) not= 0 then
put "Your answer was ", e (f ), " and you were incorrect."
put " "
delay (2000)
else
put "You did not answer in time..."
put " "
delay (2000)
end if
end for
delay (10000)
cls
locatexy (155, 400)
put "Results"
locatexy (10, 370)
put "Correct Answers: ", corr
locatexy (10, 360)
put "Time Outs: ", timout
locatexy (10, 350)
put "Incorrect Answers: ", incorr
locatexy (10, 330)
put "Total Percentage: ", ((corr / (w - 1)) * 100), "%"
drawbox (5, 397, 325, 310, 7)
end Adding
procedure Division
% DIVISION
cls
drawfill (0, 0, 1, 7)
Pic.Draw (picID7, - 200, 50, picCopy)
drawline (- 205, 50, - 205, 300, 1)
Font.Draw ("Division Practice!", 125, 350, fontID6, 44)
Music.PlayFile ("daffy.wav")
delay (200)
Music.PlayFile ("ohyou.wav")
for x : 1 .. 300
Pic.Draw (picID7, - 200 + x, 50, picCopy)
drawline (- 205 + x, 50, - 205 + x, 300, 1)
delay (10)
Pic.Draw (picID7, - 200 + x, 50, picCopy)
drawline (- 205 + x, 50, - 205 + x, 300, 1)
end for
Music.PlayFile ("ohbugs.wav")
for x : 1 .. 300
Pic.Draw (picID7, 100 - x, 50, picCopy)
drawline (265 - x, 50, 265 - x, 300, 1)
delay (5)
Pic.Draw (picID7, 100 - x, 50, picCopy)
drawline (265 - x, 50, 265 - x, 300, 1)
end for
for x : 1 .. 300
Pic.Draw (picID8, - 200 + x, 50, picCopy)
drawline (- 205 + x, 50, - 205 + x, 300, 1)
delay (10)
Pic.Draw (picID8, - 200 + x, 50, picCopy)
drawline (- 205 + x, 50, - 205 + x, 300, 1)
end for
Music.PlayFile ("whatsupdoc.wav")
delay (200)
Music.PlayFile ("startpound.wav")
delay (200)
Font.Draw ("You Will Be Given 4 Seconds Per Question", 275, 275, fontID8, 44)
delay (4000)
Font.Draw ("Press Any Key When You Are Ready!", 275, 225, fontID8, 44)
Input.Pause
cls
var a, b, c, corr, incorr, timout, w : int
var t, r, d, e : array 1 .. 100 of real
var picID6 : int
picID6 := Pic.FileNew ("clock.jpg")
var fontID4 : int := Font.New ("Times New Roman:125")
randomize
timout := 0
corr := 0
incorr := 0
w := 1
for x : 1 .. 10
randint (a, 1, 10)
randint (b, 1, 10)
t (x ) := a
r (x ) := b
c := a * b
d (x ) := c
put " You only have 4 seconds to answer!!!"
put " "
put "what is ", c : 3, " divided by ", b : 3, " ? " ..
fork timer
Pic.Draw (picID6, 100, 0, picCopy)
Font.Draw ("4", 210, 120, fontID4, white)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("3", 220, 120, fontID4, white)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("2", 220, 120, fontID4, red)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("1", 220, 120, fontID4, 12)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("0", 220, 120, fontID4, 12)
if answer = 0 then
put " you took too long"
timout := timout + 1
elsif answer = a then
put " great job"
corr := corr + 1
elsif answer not= a then
put " sorry"
incorr := incorr + 1
end if
e (x ) := answer
delay (2000)
cls
w := w + 1
end for
for f : 1 .. (w - 1)
put "Question ", f, " was ", d (f ), " divided by ", r (f ), " = ", t (f )
if e (f ) = t (f ) then
put "Your answer was ", e (f ), " and you were correct!"
put " "
delay (2000)
elsif e (f ) not= t (f ) and e (f ) not= 0 then
put "Your answer was ", e (f ), " and you were incorrect."
put " "
delay (2000)
else
put "You did not answer in time..."
put " "
delay (2000)
end if
end for
delay (10000)
cls
locatexy (155, 400)
put "Results"
locatexy (10, 370)
put "Correct Answers: ", corr
locatexy (10, 360)
put "Time Outs: ", timout
locatexy (10, 350)
put "Incorrect Answers: ", incorr
locatexy (10, 330)
put "Total Percentage: ", ((corr / (w - 1)) * 100), "%"
drawbox (5, 397, 325, 310, 7)
end Division
procedure Subtraction
% SUBTRACTION
cls
drawfill (0, 0, 72, 7)
Pic.Draw (picID11, 25, 75, picCopy)
Font.Draw ("Subtraction Practice!", 100, 350, fontID6, 7)
Music.PlayFile ("sponge.wav")
delay (200)
Font.Draw ("You Will Be Given 4 Seconds Per Question", 275, 275, fontID8, 7)
delay (4000)
Font.Draw ("Press Any Key When You Are Ready!", 275, 225, fontID8, 7)
Input.Pause
cls
var a, b, c, corr, incorr, timout, w : int
var t, r, d, e : array 1 .. 100 of real
var picID6 : int
picID6 := Pic.FileNew ("clock.jpg")
var fontID4 : int := Font.New ("Times New Roman:125")
randomize
timout := 0
corr := 0
incorr := 0
w := 1
for x : 1 .. 10
randint (a, 1, 10)
randint (b, 1, 10)
put " You only have 4 seconds to answer!!!"
put " "
if a < b then
put
"what is ", b : 3, " minus ", a : 3, " ? " ..
c := b - a
t (x ) := a
r (x ) := b
d (x ) := c
elsif
a > b then
put "what is ", a : 3, " minus ", b : 3, " ? " ..
c := a - b
t (x ) := a
r (x ) := b
d (x ) := c
else
randint (a, 1, 10)
randint (b, 1, 10)
if a < b then
put
"what is ", b : 3, " minus ", a : 3, " ? " ..
c := b - a
t (x ) := a
r (x ) := b
d (x ) := c
elsif
a > b then
put "what is ", a : 3, " minus ", b : 3, " ? " ..
c := a - b
t (x ) := a
r (x ) := b
d (x ) := c
end if
end if
fork timer
Pic.Draw (picID6, 100, 0, picCopy)
Font.Draw ("4", 210, 120, fontID4, white)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("3", 220, 120, fontID4, white)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("2", 220, 120, fontID4, red)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("1", 220, 120, fontID4, 12)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("0", 220, 120, fontID4, 12)
if answer = 0 then
put " you took too long"
timout := timout + 1
elsif answer = c then
put " great job"
corr := corr + 1
elsif answer not= c then
put " sorry"
incorr := incorr + 1
end if
e (x ) := answer
delay (2000)
cls
w := w + 1
end for
for f : 1 .. (w - 1)
put "Question ", f, " was ", t (f ), " minus ", r (f ), " = ", d (f )
if e (f ) = d (f ) then
put "Your answer was ", e (f ), " and you were correct!"
put " "
delay (2000)
elsif e (f ) not= d (f ) and e (f ) not= 0 then
put "Your answer was ", e (f ), " and you were incorrect."
put " "
delay (2000)
else
put "You did not answer in time..."
put " "
delay (2000)
end if
end for
delay (10000)
cls
locatexy (155, 400)
put "Results"
locatexy (10, 370)
put "Correct Answers: ", corr
locatexy (10, 360)
put "Time Outs: ", timout
locatexy (10, 350)
put "Incorrect Answers: ", incorr
locatexy (10, 330)
put "Total Percentage: ", ((corr / (w - 1)) * 100), "%"
drawbox (5, 397, 325, 310, 7)
end Subtraction
procedure Multiplication
% MULTIPLICATION
cls
Pic.Draw (picID10, 0, 0, picCopy)
Pic.Draw (picID9, 15, 50, picCopy)
Font.Draw ("Multiplication Practice!", 25, 350, fontID9, 72)
Music.PlayFile ("memario.wav")
delay (200)
Font.Draw ("You Will Be Given 4 Seconds Per Question", 275, 275, fontID8, 72)
delay (4000)
Font.Draw ("Press Any Key When You Are Ready!", 275, 225, fontID8, 72)
Input.Pause
Music.PlayFile ("herewego.wav")
cls
var a, b, c, corr, incorr, timout, w : int
var t, r, d, e : array 1 .. 100 of real
var picID6 : int
picID6 := Pic.FileNew ("clock.jpg")
var fontID4 : int := Font.New ("Times New Roman:125")
randomize
timout := 0
corr := 0
incorr := 0
w := 1
for x : 1 .. 10
randint (a, 1, 10)
randint (b, 1, 10)
c := a * b
t (x ) := a
r (x ) := b
d (x ) := c
put " You only have 4 seconds to answer!!!"
put " "
put "what is ", a : 3, " times ", b : 3, " ? " ..
fork timer
Pic.Draw (picID6, 100, 0, picCopy)
Font.Draw ("4", 210, 120, fontID4, white)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("3", 220, 120, fontID4, white)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("2", 220, 120, fontID4, red)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("1", 220, 120, fontID4, 12)
delay (750)
drawfillbox (175, 100, 300, 245, 7)
Font.Draw ("0", 220, 120, fontID4, 12)
if answer = 0 then
put " you took too long"
Music.PlayFile ("mariowrong.wav")
timout := timout + 1
elsif answer = c then
put " great job"
Music.PlayFile ("mariocorrect.wav")
corr := corr + 1
elsif answer not= c then
put " sorry"
Music.PlayFile ("mariotime.wav")
incorr := incorr + 1
end if
e (x ) := answer
delay (2000)
w := w + 1
cls
end for
for f : 1 .. (w - 1)
put "Question ", f, " was ", t (f ), " minus ", r (f ), " = ", d (f )
if e (f ) = d (f ) then
put "Your answer was ", e (f ), " and you were correct!"
put " "
delay (2000)
elsif e (f ) not= d (f ) and e (f ) not= 0 then
put "Your answer was ", e (f ), " and you were incorrect."
put " "
delay (2000)
else
put "You did not answer in time..."
put " "
delay (2000)
end if
end for
delay (10000)
cls
locatexy (155, 400)
put "Results"
locatexy (10, 370)
put "Correct Answers: ", corr
locatexy (10, 360)
put "Time Outs: ", timout
locatexy (10, 350)
put "Incorrect Answers: ", incorr
locatexy (10, 330)
put "Total Percentage: ", ((corr / (w - 1)) * 100), "%"
drawbox (5, 397, 325, 310, 7)
Music.PlayFile ("marioend.wav")
end Multiplication
drawfill (0, 0, 12, 7)
Font.Draw ("Math Practice!", 150, 350, fontID, blue)
Font.Draw ("Press Enter to continue", 200, 315, fontID1, blue)
Pic.Draw (picID, 100, - 200, picCopy)
Music.PlayFile ("krusysound.wav")
Input.Pause
cls
var addbutton : int := GUI.CreateButton (125, 310, 180, "Addition With Aladdin", Adding )
var subbutton : int := GUI.CreateButton (125, 250, 100, "Subtraction With Spongebob", Subtraction )
var mulbutton : int := GUI.CreateButton (125, 190, 180, " Multiplication With Mario", Multiplication )
var divbutton : int := GUI.CreateButton (125, 130, 180, "Division With Daffy", Division )
var quitbutton : int := GUI.CreateButton (125, 70, 180, "Quit", GUI.Quit)
drawfill (0, 0, 76, 7)
Font.Draw ("Choose An Exercise", 125, 350, fontID2, green)
Pic.Draw (picID2, 370, 265, picCopy)
Pic.Draw (picID3, 0, 200, picCopy)
Pic.Draw (picID1, 370, 130, picMerge)
Pic.Draw (picID4, 0, 70, picMerge) |
Now I need it to return to the part just above here with the buttons. Any help would really be appreciated.
EDIT: I figured it out, all I needed was a GUI.Refresh in the procedures...  |