**WARNING Verbose mode fully on **
Hello Phil,
Thank you for your help. I inserted your routine, however, it is not
working exactly as I expected. (Before going on into the problem,
though, I ought to stress that this message is not in any way a
complaint about help kindly offered; I simply wish to learn more about
MC by thoroughly understanding this particular problem--spent two hours
on it alone, with no luck--so, if I might bother Phil and everyone else
again to help me see what gives?)
Perhaps I'd better describe more fully what all's going on in the
substack.
After clicking on one of three possible answer squares, each a field
overlain by a button in which the now-modified repeat loop resides as
part of a longer script (appended in full below), the appropriate hidden
group becomes visible just as Phil's routine predicted. The group,
though, does not disappear (flash) off. Rather, it remains visible,
with the stack seemingly awaiting for me to do something, at which point
I hit the "next question" button and, sure enough, the group finally
disappears and the stack continues merrily along (ie, a new question is
set up).
One perhaps important twist in the equation. To go to the next question
users can also simply hit return, which is picked up by this handler in
the card:
on returnKey
get the disabled of button "make a question"
if it is true then
exit returnKey
end if
send mouseUp to button "make a question"
end returnKey
I mention this "twist", because, in fact, _my_ implementation of Phil's
routine led to two possible and similar outcomes. After hitting the
return-key five or ten times, two odd things will occassionally happen
to the visibles of groups "bin-bon!" and "boo!": a delay in the group's
disappearance, or both groups visible at the same time. (BTW, bin-bon
and boo are familiar to Japanese here from TV quiz shows.)
Could this returnKey handler be interfering somehow with the loop? Also,
if the itemDelimiter is reset elsewhere than within this specific
handler, could it in turn affect the "cancel item 1 of the
pendingMessages" in Phil's routine (see below)?
Or, most likely, is the problem simply how and where I implemented the
revised repeat loop?
Sorry for imposing with the long post.
Cheers,
--
Nicolas R Cueto
Takakura JHS/SHS
Nagoya, Japan
[here's that script into which I inserted, with modifications, Phil's
routine]
global gL1Answer, gUnitContents, gCheck
local tButton, tZax, tZox
on mouseUp
-- prevent the user from clicking on any of the (other) answers
repeat with i = 1 to 3
put "button field " & i into tButton
disable button tButton
end repeat
# a routine for checking if the student clicked on the right answer.
put the last character of the short name of me into tZax
put field tZax into gCheck
if gCheck = gL1Answer then
add 1 to field "fRight"
switch
case field 1 = gL1Answer
set the foregroundColor of field 1 to blue
exit switch
case field 2 = gL1Answer
set the foregroundColor of field 2 to blue
exit switch
case field 3 = gL1Answer
set the foregroundColor of field 3 to blue
end switch
if gUnitContents is empty then
show group "bin-bon!"
answer "Finished!" with "OK"
enable button "quit"
exit mouseUp
end if
enable button "make a question"
# PHIL'S ROUTINE: change the button label with each click
if the label of me = "stop" then
hide group "bin-bon!"
cancel item 1 of the pendingMessages
set the label of me to "go"
else
put zero into tZox
set the label of me to "stop"
end if
-- start the "doBinBon" process
send "doBinBon" to me
exit mouseUp
end if
# a similar routine for checking if the student clicked on the wrong
answer,
# in which case I, as teacher, want the correct answer stored for future
review
add 1 to field "fWrong"
switch
case field 1 = gL1Answer
set the foregroundColor of field 1 to red
exit switch
case field 2 = gL1Answer
set the foregroundColor of field 2 to red
exit switch
case field 3 = gL1Answer
set the foregroundColor of field 3 to red
end switch
if gUnitContents is empty then
show group "boo!"
answer "Finished!" with "OK"
enable button "quit"
exit mouseUp
end if
enable button "make a question"
# PHIL'S ROUTINE: change the button label with each click
if the label of me = "stop" then
hide group "boo!"
cancel item 1 of the pendingMessages
set the label of me to "go"
else
put zero into tZox
set the label of me to "stop"
end if
-- start the "doBoo" process
send "doBoo" to me
end mouseUp
on doBinBon
-- bail out after the right number of executions
add 1 to tZox
if tZox > 4 then
hide group "bin-bon!"
set the label of me to "go"
exit doBinBon
end if
-- show or hide the group and put another
-- "doBinBon" message in the queue
get the visible of group "bin-bon!"
if it = false then
show group "bin-bon!"
send "doBinBon" to me in 400 milliseconds
else
hide group "bin-bon!"
send "doBinBon" to me in 600 milliseconds
end if
end doBinBon
on doBoo
-- bail out after the right number of executions
add 1 to tZox
if tZox > 4 then
hide group "boo!"
set the label of me to "go"
exit doBoo
end if
-- show or hide the group and put another
-- "doBoo" message in the queue
get the visible of group "boo!"
if it = false then
show group "boo!"
send "doBoo" to me in 400 milliseconds
else
hide group "bin-bon!"
send "doBoo" to me in 600 milliseconds
end if
end doBoo