holding down a button for repeated responding

Ben Robinson brobinso at mprc.umaryland.edu
Thu Apr 5 15:58:43 UTC 2007


if anyone's interested...
i figured out a solution by adding presses and releases to the allowable responses (while presses are 1s and 2s, eprime codes releases as -1s and -2s).
then i run through the following set of if-thens at the end of each trial:

*/Dim myRed as Integer
Dim myRedRGB as String
Dim holdDown as Integer*/    'these three variables need to be pasted into the User tab of the Script window

If RedScreen.ACC = 0 Then    '(an ACC of 1 kicks you out of the loop - just press ENTER when you've found isoluminance)
	Select Case RedScreen.RESP
		Case "{LEFTARROW}"
			holdDown = 1
			If myRed > 0 Then
				myRed = myRed-1
			Else
				myRed = 255
			End If
		Case "{-LEFTARROW}"
			holdDown = 0
		Case "{RIGHTARROW}"
			holdDown = 2
			If myRed < 255 Then
				myRed = myRed+1
			Else
				myRed = 0
			End If
		Case "{-RIGHTARROW}"
			holdDown = 0
		Case Else
			Select Case holdDown
				Case 1
					If myRed > 0 Then
						myRed = myRed-1
					Else
						myRed = 255
					End If
				Case 2
					If myRed < 255 Then
						myRed = myRed+1
					Else
						myRed = 0
					End If
			End Select
	End Select
	Goto Label1
End If


>>> "Ben Robinson" <brobinso at MPRC.UMARYLAND.EDU> 4/5/2007 10:07 AM >>>
hi all.
i'm trying to figure out a way to interpret a held-down key as a repeated key press.

for a little background, i'm working on a flicker paradigm where a trial consists of two slides presented one after the other.  one slide has green boxes around the center, and the other has red boxes in the same locations around the center.  when presented rapidly and repeatedly, the screen appears to flicker green-red.  depending on the user's response, i adjust the redness of the red objects until the green and red objects are equiluminant (at which time you should no longer notice a flicker between the two slides).  if my red starts out as 255,0,0 (an RGB value), each Button1 press would subtract 1 from the Red value, making the new RGB value 254,0,0.  i'd like to be able to cycle rapidly all the way through the 256 different levels of Red, but 256 individual button presses is not fun.

i would like the user to be able to press and hold a keyboard button down in order to comfortably cycle through all these levels of red.  

the first time it's pressed EPrime interprets the press with no problem, but the next time it cycles through the trial, if the button is still pressed, i'd like EPrime to interpret that as an additional button press.

is there a way to check the status of the button (depressed, or extended)?  that's just one thought.  anyone have a better idea?

ben robinson



More information about the Eprime mailing list