card freeze until I switch to pointer, then browser mode
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
card freeze until I switch to pointer, then browser mode
Hi All,
I have this strange problem with revolution. On one of the cards of a stack, I am showing a stimulus to which one is to make a response by keypress (press either the "p" or "q" key, depending on what the stimulus is). When I get to the card, revolution does not seem to take in the response. By chance I worked out that if I switch to the pointer tool, then back to the browser tool, i was able to make keypresses again.
I do not think this is due to a problem with my script using keysdown as it has worked smoothly before. Can someone enlighten me on this? At the moment I'm getting around the "freezing" problem by putting in:
choose pointer tool
choose browser tool
at the beginning of my card script to circumvent this problem. Not a very elegant solution.
Thanks,
Helen
I have this strange problem with revolution. On one of the cards of a stack, I am showing a stimulus to which one is to make a response by keypress (press either the "p" or "q" key, depending on what the stimulus is). When I get to the card, revolution does not seem to take in the response. By chance I worked out that if I switch to the pointer tool, then back to the browser tool, i was able to make keypresses again.
I do not think this is due to a problem with my script using keysdown as it has worked smoothly before. Can someone enlighten me on this? At the moment I'm getting around the "freezing" problem by putting in:
choose pointer tool
choose browser tool
at the beginning of my card script to circumvent this problem. Not a very elegant solution.
Thanks,
Helen
Hi Klaus,
Yes, more info...
The "stimuli" I'm showing is simply a pair of letters, one each in separate text fields. I'm programming a psychology experiment where my participants will see these letter pairs and make yes/no judgments on them, hence they could either press one of two designated keys (yes or no) on the keyboard.
I've programmed a pretty-much identical experiment like that before on Revolution, without any problems. In that experiment, I have a card showing some words (in text fields again, no keypresses required), once the words are shown, it moves onto the next card which shows the letter pairs (keypresses required). No problems at all.
But now I'm making a very minor change in that I'm swapping the words card and letters card around. So my participants see the letter pairs first (make keypresses for those), and then it moves on to the next card (which shows the words). And somehow at the beginning, the letters card freezes unless I do the "select the pointer then browser" routine.
Hope this is a bit more clear now. Thanks for reading!
Helen
Yes, more info...
The "stimuli" I'm showing is simply a pair of letters, one each in separate text fields. I'm programming a psychology experiment where my participants will see these letter pairs and make yes/no judgments on them, hence they could either press one of two designated keys (yes or no) on the keyboard.
I've programmed a pretty-much identical experiment like that before on Revolution, without any problems. In that experiment, I have a card showing some words (in text fields again, no keypresses required), once the words are shown, it moves onto the next card which shows the letter pairs (keypresses required). No problems at all.
But now I'm making a very minor change in that I'm swapping the words card and letters card around. So my participants see the letter pairs first (make keypresses for those), and then it moves on to the next card (which shows the words). And somehow at the beginning, the letters card freezes unless I do the "select the pointer then browser" routine.
Hope this is a bit more clear now. Thanks for reading!
Helen
Hi Malte, Klaus,
No, it's not freezing as in spinning beachball. It just doesn't respond to keypresses.
My script (sorry about the length) for the card is this. I've also realised that my stimuli (letters) were image files afterall (sometimes i use fields but this time it was images). Sorry for the confusion. The preopencard, opencard and showframe handlers just prepares the card to show the images (letter pairs - one on the left, one on the right). This works fine. It's just not responding to any keypresses (on idle handler).
on preopencard
put empty into field debug
put 0 into framecounter
set the idlerate to 1
put 0 into keyIsPressed
put 0 into keyEnable
put 112 into pRK
put 113 into qRK
repeat with counter = 1 to 12
hide image itemlist[counter]
end repeat
hide image "cross"
end preopencard
on opencard
set the screenMouseLoc to 1279,600
put milliseconds() into epsttime
showframe
end opencard
on showframe
add 1 to framecounter
show image "cross"
wait for 250 milliseconds
hide image "cross"
wait for 25 milliseconds
set the location of image L5Ritem[(trialcounter)*25+framecounter] to 840,400
set the location of image L5Litem[(trialcounter)*25+framecounter] to 440,400
show image L5Ritem[(trialcounter)*25+framecounter]
show image L5Litem[(trialcounter)*25+framecounter]
put milliseconds() into sttime
put 1 into timerStarted
end showframe
on idle
if keyIsPressed is 0 and timerStarted is 1 then
if pRK is in the keysDown or qRK is in the keysDown then
put milliseconds() into sptime
put 0 into timerStarted
put 1 into keyIsPressed
if pRK is in the keysDown then
rightFeedback
else
leftFeedback
end if
end if
else
if the keysDown is empty then
put 0 into keyIsPressed
end if
end if
if the milliseconds > epsttime + (5*eptime) then
put 1 into keyIsPressed
repeat with counter = 1 to 12
hide image itemlist[counter]
end repeat
writeData
end if
pass idle
end idle
No, it's not freezing as in spinning beachball. It just doesn't respond to keypresses.
My script (sorry about the length) for the card is this. I've also realised that my stimuli (letters) were image files afterall (sometimes i use fields but this time it was images). Sorry for the confusion. The preopencard, opencard and showframe handlers just prepares the card to show the images (letter pairs - one on the left, one on the right). This works fine. It's just not responding to any keypresses (on idle handler).
on preopencard
put empty into field debug
put 0 into framecounter
set the idlerate to 1
put 0 into keyIsPressed
put 0 into keyEnable
put 112 into pRK
put 113 into qRK
repeat with counter = 1 to 12
hide image itemlist[counter]
end repeat
hide image "cross"
end preopencard
on opencard
set the screenMouseLoc to 1279,600
put milliseconds() into epsttime
showframe
end opencard
on showframe
add 1 to framecounter
show image "cross"
wait for 250 milliseconds
hide image "cross"
wait for 25 milliseconds
set the location of image L5Ritem[(trialcounter)*25+framecounter] to 840,400
set the location of image L5Litem[(trialcounter)*25+framecounter] to 440,400
show image L5Ritem[(trialcounter)*25+framecounter]
show image L5Litem[(trialcounter)*25+framecounter]
put milliseconds() into sttime
put 1 into timerStarted
end showframe
on idle
if keyIsPressed is 0 and timerStarted is 1 then
if pRK is in the keysDown or qRK is in the keysDown then
put milliseconds() into sptime
put 0 into timerStarted
put 1 into keyIsPressed
if pRK is in the keysDown then
rightFeedback
else
leftFeedback
end if
end if
else
if the keysDown is empty then
put 0 into keyIsPressed
end if
end if
if the milliseconds > epsttime + (5*eptime) then
put 1 into keyIsPressed
repeat with counter = 1 to 12
hide image itemlist[counter]
end repeat
writeData
end if
pass idle
end idle
Hi Helen,
Oh, using "idle" is a dangerous thing in Rev!
You are coming from HyperCard, right?
Check the docs for "idle" and you will read:
...
on idle -- avoid if possible
...
Try to replace "on idle/end idle/pass idle" with "on keydown/end keydown/pass keydown" in your script and see if that works better.
Best
Klaus
P.S.
I did not see any local variable declaration, but I think you just did not paste them here, right?
Oh, using "idle" is a dangerous thing in Rev!
You are coming from HyperCard, right?

Check the docs for "idle" and you will read:
...
on idle -- avoid if possible
...
Try to replace "on idle/end idle/pass idle" with "on keydown/end keydown/pass keydown" in your script and see if that works better.
Best
Klaus
P.S.
I did not see any local variable declaration, but I think you just did not paste them here, right?