Clearing a message buffer (mouse and keypress)
Posted: Tue Apr 22, 2008 5:42 pm
Hi all,
My program involves users to make responses via keypresses and mouseclicks. The problem is if they use either repeatedly, then they receive a string of feedbacks, with only the first one being relevant. How do I ensure that the first mouse click is the only one registered (until I'm ready for the next mouseclick) and the same question for keypress. Script is below:
on keyDown theKey
put theKey into thisKey
if thisKey="d" or thisKey="k" then
on mouseUp pMouseBtnNum
if mouseClickOK then buzz
else exit mouseUp
end mouseUp
on mouseUp pMouseBtnNum
if mouseClickOK is false then exit mouseUP
put "Rect3" into clickedRect
foilClicked
end mouseUp
I could do it with a boolean I suppose, but I imagine there is a more elegant way.
Josh
My program involves users to make responses via keypresses and mouseclicks. The problem is if they use either repeatedly, then they receive a string of feedbacks, with only the first one being relevant. How do I ensure that the first mouse click is the only one registered (until I'm ready for the next mouseclick) and the same question for keypress. Script is below:
on keyDown theKey
put theKey into thisKey
if thisKey="d" or thisKey="k" then
on mouseUp pMouseBtnNum
if mouseClickOK then buzz
else exit mouseUp
end mouseUp
on mouseUp pMouseBtnNum
if mouseClickOK is false then exit mouseUP
put "Rect3" into clickedRect
foilClicked
end mouseUp
I could do it with a boolean I suppose, but I imagine there is a more elegant way.
Josh