hide and display running clock upon key-press


Author
Message
mri2t
mri2t
Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)
Group: Forum Members
Posts: 14, Visits: 58
Dave - Friday, October 27, 2017
mri2t - Thursday, October 26, 2017

  I have tried to adapt the above stopwatch script to meet my requirements.  Here’s the script (with my questions below):

<clock stopwatch>
/ mode = stopwatch
/ txcolor = white
/ txbgcolor = white
/ format = "hh:mm:ss"
/ position = (50%, 10%)
</clock>


<trial showclock>
/ posttrialpause = 500
/ ontrialbegin = [clock.stopwatch.textcolor=black]
/ ontrialend = [clock.stopwatch.textcolor=white]
/ trialduration = 1000
/ validresponse = (0)
/recorddata = true
</trial>


<text targettext>
/items = ("Target sighted")
/fontstyle = ("Arial", 2%)
/position = (50%, 95%)
/size = (10%, 5%)
/txcolor = white
/txbgcolor = white
</text>

<trial showtargetmessage>
/stimulusframes = [1=targettext]
/ontrialbegin = [text.targettext.textcolor=black]
/ontrialend=[text.targettext.textcolor=white]
/trialduration = 2000
/recorddata = true
</trial>


<text mytext>
/ items = ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
</text>


<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57, 1, 33)
/ branch = [if (trial.mytrial.response==1) trial.showclock]
/ branch = [if (trial.mytrial.response==33) trial.showtargetmessage]
</trial>

<block myblock>
/ bgstim = (stopwatch, targettext)
/ trials = [1-26=mytrial]
/ onblockend = [if (block.myblock.elapsedtime == 10000)]
</block>

*****Press the ESCAPE key to make the clock visible and press the F key when vowel is sighted****


Participants are instructed to 1) press the “ESC” key every 10 seconds to check how much time has elapsed and 2) press the “F” key when a vowel is sighted and the words “Target Sighted” will appear.  I want the script to log when the participant presses the ESC and/or F keys and log the response latencies for either keys. 
Currently, the next trial will appear if participants press the ESC, F or SPACEBAR keys.  Is there a way for the next trial to appear only when the participant presses the SPACEBAR?
Lastly, the experiment should end after 10000ms (this does not seem to be working in the above script).
Any help is greatly appreciated.


Not sure I fully understand the description. Do you mean something like this?

<clock stopwatch>
/ mode = stopwatch
/ txcolor = white
/ txbgcolor = white
/ format = "hh:mm:ss"
/ position = (50%, 10%)
</clock>


<trial showclock>
/ posttrialpause = 500
/ ontrialbegin = [clock.stopwatch.textcolor=black]
/ ontrialend = [clock.stopwatch.textcolor=white]
/ trialduration = 1000
/ validresponse = (0)
/recorddata = true
</trial>


<text targettext>
/items = ("Target sighted")
/fontstyle = ("Arial", 2%)
/position = (50%, 95%)
/size = (10%, 5%)
/txcolor = black
/txbgcolor = white
</text>

<trial showtargetmessage>
/stimulusframes = [1=targettext]
/trialduration = 2000
/recorddata = true
</trial>


<text mytext>
/ items = (
"A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N",
"O", "P", "Q", "R", "S", "T", "U",
"V", "W", "X", "Y", "Z")
/ select = values.itemnumber
</text>

<list itenumbers>
/ poolsize = 26
</list>

<values>
/ itemnumber = 0
</values>


<trial mytrial>
/ ontrialbegin = [if (trial.mytrial.response == 57 || trial.mytrial.response == 0) values.itemnumber = list.itenumbers.nextindex]
/ stimulusframes = [1=mytext]
/ validresponse = (57, 1, 33)
/ branch = [if (trial.mytrial.response==1) trial.showclock]
/ branch = [if (trial.mytrial.response==33) trial.showtargetmessage]
</trial>


<block myblock>
/ bgstim = (stopwatch)
/ trials = [1-26=mytrial]
/ onblockend = [if (block.myblock.elapsedtime == 10000)]
</block>

Thank you, Dave!  This is exactly what I was after.  Your help is greatly appreciated.  

Regards,
Mri
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
mri2t - Thursday, October 26, 2017

  I have tried to adapt the above stopwatch script to meet my requirements.  Here’s the script (with my questions below):

<clock stopwatch>
/ mode = stopwatch
/ txcolor = white
/ txbgcolor = white
/ format = "hh:mm:ss"
/ position = (50%, 10%)
</clock>


<trial showclock>
/ posttrialpause = 500
/ ontrialbegin = [clock.stopwatch.textcolor=black]
/ ontrialend = [clock.stopwatch.textcolor=white]
/ trialduration = 1000
/ validresponse = (0)
/recorddata = true
</trial>


<text targettext>
/items = ("Target sighted")
/fontstyle = ("Arial", 2%)
/position = (50%, 95%)
/size = (10%, 5%)
/txcolor = white
/txbgcolor = white
</text>

<trial showtargetmessage>
/stimulusframes = [1=targettext]
/ontrialbegin = [text.targettext.textcolor=black]
/ontrialend=[text.targettext.textcolor=white]
/trialduration = 2000
/recorddata = true
</trial>


<text mytext>
/ items = ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
</text>


<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57, 1, 33)
/ branch = [if (trial.mytrial.response==1) trial.showclock]
/ branch = [if (trial.mytrial.response==33) trial.showtargetmessage]
</trial>

<block myblock>
/ bgstim = (stopwatch, targettext)
/ trials = [1-26=mytrial]
/ onblockend = [if (block.myblock.elapsedtime == 10000)]
</block>

*****Press the ESCAPE key to make the clock visible and press the F key when vowel is sighted****


Participants are instructed to 1) press the “ESC” key every 10 seconds to check how much time has elapsed and 2) press the “F” key when a vowel is sighted and the words “Target Sighted” will appear.  I want the script to log when the participant presses the ESC and/or F keys and log the response latencies for either keys. 
Currently, the next trial will appear if participants press the ESC, F or SPACEBAR keys.  Is there a way for the next trial to appear only when the participant presses the SPACEBAR?
Lastly, the experiment should end after 10000ms (this does not seem to be working in the above script).
Any help is greatly appreciated.


Not sure I fully understand the description. Do you mean something like this?

<clock stopwatch>
/ mode = stopwatch
/ txcolor = white
/ txbgcolor = white
/ format = "hh:mm:ss"
/ position = (50%, 10%)
</clock>


<trial showclock>
/ posttrialpause = 500
/ ontrialbegin = [clock.stopwatch.textcolor=black]
/ ontrialend = [clock.stopwatch.textcolor=white]
/ trialduration = 1000
/ validresponse = (0)
/recorddata = true
</trial>


<text targettext>
/items = ("Target sighted")
/fontstyle = ("Arial", 2%)
/position = (50%, 95%)
/size = (10%, 5%)
/txcolor = black
/txbgcolor = white
</text>

<trial showtargetmessage>
/stimulusframes = [1=targettext]
/trialduration = 2000
/recorddata = true
</trial>


<text mytext>
/ items = (
"A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N",
"O", "P", "Q", "R", "S", "T", "U",
"V", "W", "X", "Y", "Z")
/ select = values.itemnumber
</text>

<list itenumbers>
/ poolsize = 26
</list>

<values>
/ itemnumber = 0
</values>


<trial mytrial>
/ ontrialbegin = [if (trial.mytrial.response == 57 || trial.mytrial.response == 0) values.itemnumber = list.itenumbers.nextindex]
/ stimulusframes = [1=mytext]
/ validresponse = (57, 1, 33)
/ branch = [if (trial.mytrial.response==1) trial.showclock]
/ branch = [if (trial.mytrial.response==33) trial.showtargetmessage]
</trial>


<block myblock>
/ bgstim = (stopwatch)
/ trials = [1-26=mytrial]
/ onblockend = [if (block.myblock.elapsedtime == 10000)]
</block>

mri2t
mri2t
Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)Partner Member (903 reputation)
Group: Forum Members
Posts: 14, Visits: 58

  I have tried to adapt the above stopwatch script to meet my requirements.  Here’s the script (with my questions below):

<clock stopwatch>
/ mode = stopwatch
/ txcolor = white
/ txbgcolor = white
/ format = "hh:mm:ss"
/ position = (50%, 10%)
</clock>


<trial showclock>
/ posttrialpause = 500
/ ontrialbegin = [clock.stopwatch.textcolor=black]
/ ontrialend = [clock.stopwatch.textcolor=white]
/ trialduration = 1000
/ validresponse = (0)
/recorddata = true
</trial>


<text targettext>
/items = ("Target sighted")
/fontstyle = ("Arial", 2%)
/position = (50%, 95%)
/size = (10%, 5%)
/txcolor = white
/txbgcolor = white
</text>

<trial showtargetmessage>
/stimulusframes = [1=targettext]
/ontrialbegin = [text.targettext.textcolor=black]
/ontrialend=[text.targettext.textcolor=white]
/trialduration = 2000
/recorddata = true
</trial>


<text mytext>
/ items = ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
</text>


<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57, 1, 33)
/ branch = [if (trial.mytrial.response==1) trial.showclock]
/ branch = [if (trial.mytrial.response==33) trial.showtargetmessage]
</trial>

<block myblock>
/ bgstim = (stopwatch, targettext)
/ trials = [1-26=mytrial]
/ onblockend = [if (block.myblock.elapsedtime == 10000)]
</block>

*****Press the ESCAPE key to make the clock visible and press the F key when vowel is sighted****


Participants are instructed to 1) press the “ESC” key every 10 seconds to check how much time has elapsed and 2) press the “F” key when a vowel is sighted and the words “Target Sighted” will appear.  I want the script to log when the participant presses the ESC and/or F keys and log the response latencies for either keys. 
Currently, the next trial will appear if participants press the ESC, F or SPACEBAR keys.  Is there a way for the next trial to appear only when the participant presses the SPACEBAR?
Lastly, the experiment should end after 10000ms (this does not seem to be working in the above script).
Any help is greatly appreciated.


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
If you wanted to specify RGB channels specifically, you would have to do so via the separate textcolorred, textcolorgreen and textcolorblue properties:

/ ontrialbegin = [clock.myclock.textcolorred=128; clock.myclock.textcolorgreen=0; clock.myclock.textcolorblue=255]

for the RGB color (128, 0, 255)

clairez
clairez
Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)
Group: Forum Members
Posts: 41, Visits: 49
Thanks, Dave! It worked. I was a bit puzzled at first, because for some reason it didn't seem to work when specifying the numbers with RGB values. I don't know why that is, but what's important is that it works now.

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
It isn't working because your syntax is invalid. You'll want to try something along the lines of

<clock stopwatch>
/ mode = stopwatch
/ txcolor = white
/ txbgcolor = white
/ format = "hh:mm:ss"
/ position = (50%, 10%)
</clock>

<block myblock>
/ bgstim = (stopwatch)
/ trials = [1-8=mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57, 1)
/ branch = [if (trial.mytrial.response==1) trial.showclock]
</trial>

<trial showclock>
/ posttrialpause = 500
/ ontrialbegin = [clock.stopwatch.textcolor=black]
/ ontrialend = [clock.stopwatch.textcolor=white]
/ trialduration = 5000
/ validresponse = (0)
</trial>

<text mytext>
/ items = ("A", "B", "C", "D")
</text>

Press the ESCAPE key to make the clock visible.




clairez
clairez
Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)
Group: Forum Members
Posts: 41, Visits: 49
Hi!

I want to make a prospective memory task in which participants are asked to press a particular key on the keyboard (e.g., Enter) every 10 minutes (while performing some other task in the meantime--here a number discrimination task). Participants can check how much time has elapsed whenever they want by looking at a stopwatch. I don't want the stopwatch to be continuously visible, thought. It should be displayed only when participants press a designated key (e.g., t, for time), and then disappear again. I also want to be able to analyze later on when participants checked the stopwatch and when they pressed the Enter key. This presents a couple of challenges for me.

The first challenge is making the clock visible or invisible. One way to do this, I thought, would be to manipulate its backgroundcolor. If that's the same color as the numbers on the clock and the screencolor, it won't be visible. Now I want to make the clock's backgroundcolor a variable, and specify on each trial what the value of that variable should be depending on the participant's response. Whatever I try, this isn't working. I can't even make the backgroundcolor a variable to begin with.

This is some basic piece of srcipt with which I've experimented.

<clock timer>
/ format = "mm:ss"
/ mode = stopwatch
/ position = (80%, 80%)
/ resetrate = block
/ txbgcolor = timerbgcolor
</clock>

<values>
/ timerbgcolor = ""
</values>

<trial ANYTRIAL>
...
/ ontrialend = [if trial.greeneven.response == 20 values.timer = "(0, 0, 0)" else values.timer = "(255, 255, 255)"]
</trial>

I have a couple more questions, but I think it doesn't make sense to bring them up before I have figured this out. Just one more comment at this point: I want to put the clock in my experimental blocks (using the /bgstim command), rather than in each trial. This is to prevent that the clock isn't displayed during post-trial pauses. I don't know if this will be a problem, since I want to specify the color of the clock in each trial. Sorry if this is a little abstract. I'm happy to explain everything in more detail if somebody thinks he can help me with this problem.

Thanks!

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search