Millisecond Forums

Show subject input to themselves

https://forums.millisecond.com/Topic18568.aspx

By Coati - 3/10/2016

Dear all,

I have another little problem I cannot find any solution for. In my experiment I want to show subjects a series of digits for a short time (2 seconds). After that a blank screen should pop up and subjects have now 5 seconds to type in the digits they remember from the former series. For this I want Inquisit to show the participants the digits they type in at the moment as kind of a feedback. 

So if they type in 123, the digits 1,2 and 3 should appear one after another. And if they delete a digit with the Backspace button the digit should disappear from the screen as well. I do not want to use an openended element because of the next-button and the frame, there should be just digits appearing in the middle of the screen.

I tried to figure out if the solution could be using the values element, but I could not get it going.

Is there any simple solution for this? As always, I really, really appreciate your help!

Jakob.

By Dave - 3/11/2016

> Is there any simple solution for this?

No, there is no simple solution. At best, there is a complicated one along the following lines:

<block myblock>
/ onblockbegin = [values.typeddigits = ""; values.typetimeout = 5000; ]
/ trials = [1=type]
</block>

scancodes 2-10: digits 1 to 9 at the top of the keyboard
scancode 14: backspace
<trial type>
/ stimulusframes = [1=typetext]
/ validresponse = (2,3,4,5,6,7,8,9,10,14)
/ ontrialend = [if (trial.type.response != 14) values.typeddigits = concat(values.typeddigits, trial.type.response-1); ]
/ ontrialend = [if (trial.type.response == 14 && length(values.typeddigits) > 0) values.typeddigits = substring(values.typeddigits,0,length(values.typeddigits)-1); ]
/ ontrialend = [values.typetimeout -= trial.type.elapsedtime]
/ timeout = values.typetimeout
/ branch = [if (values.typetimeout > 0) trial.type]
</trial>

<text typetext>
/ items = ("<%values.typeddigits%>")
/ erase = false
/ size = (50%, 25%)
/ vjustify = center
</text>

<values>
/ typetimeout = 5000
/ typeddigits = ""
</values>

By Coati - 3/11/2016

That's fantastic, thank you very much for all your effort!
By Coati - 3/20/2016

Hey Dave, 

a further short question referring to this. I now want to show the participants a message that they have to type in something during the trial. 

I came up with this:


<block type>
/ onblockbegin = [values.typeddigits = ""; values.typetimeout = 7000]
/ trials = [1=type]
</block>

<trial type>
/ stimulusframes = [1=typetext; 1=instrtotype]
/ validresponse = (2,3,4,5,6,7,8,9,10,14)
/ ontrialend = [if (trial.type.response != 14) values.typeddigits = concat(values.typeddigits, trial.type.response-1); ]
/ ontrialend = [if (trial.type.response == 14 && length(values.typeddigits) > 0) values.typeddigits = substring(values.typeddigits,0,length(values.typeddigits)-1); ]
/ ontrialend = [values.typetimeout -= trial.type.elapsedtime]
/ timeout = values.typetimeout
/ branch = [if (values.typetimeout > 0) trial.type]

<text instrtotype>
/items = ("Type in:")
/select = noreplace
/position = (50, 35)
/ fontstyle = ("Arial", 28, true)
/txcolor = (0, 0, 0)

It works but the message is flickering with every new digit I type in. Is there any possibility that the message remains on the screen without flickering?

Thanks a lot!

Jakob. 

By Dave - 3/20/2016

You need to set the <text> element's /erase attribute to 'false' for it to remain on-screen across trials.
By Tingyu - 2/19/2023

Dave - 3/11/2016
> Is there any simple solution for this?

No, there is no simple solution. At best, there is a complicated one along the following lines:

<block myblock>
/ onblockbegin = [values.typeddigits = ""; values.typetimeout = 5000; ]
/ trials = [1=type]
</block>

scancodes 2-10: digits 1 to 9 at the top of the keyboard
scancode 14: backspace
<trial type>
/ stimulusframes = [1=typetext]
/ validresponse = (2,3,4,5,6,7,8,9,10,14)
/ ontrialend = [if (trial.type.response != 14) values.typeddigits = concat(values.typeddigits, trial.type.response-1); ]
/ ontrialend = [if (trial.type.response == 14 && length(values.typeddigits) > 0) values.typeddigits = substring(values.typeddigits,0,length(values.typeddigits)-1); ]
/ ontrialend = [values.typetimeout -= trial.type.elapsedtime]
/ timeout = values.typetimeout
/ branch = [if (values.typetimeout > 0) trial.type]
</trial>

<text typetext>
/ items = ("<%values.typeddigits%>")
/ erase = false
/ size = (50%, 25%)
/ vjustify = center
</text>

<values>
/ typetimeout = 5000
/ typeddigits = ""
</values>


Hi Dave,

I tried similar way to show letters subject input to themselves. But I found all of the letters shown are uppercas. May I ask is there anyway to show lowercase letters subject input?

Thank you!
Tingy

By Dave - 2/20/2023

Tingyu - 2/20/2023
Dave - 3/11/2016
> Is there any simple solution for this?

No, there is no simple solution. At best, there is a complicated one along the following lines:

<block myblock>
/ onblockbegin = [values.typeddigits = ""; values.typetimeout = 5000; ]
/ trials = [1=type]
</block>

scancodes 2-10: digits 1 to 9 at the top of the keyboard
scancode 14: backspace
<trial type>
/ stimulusframes = [1=typetext]
/ validresponse = (2,3,4,5,6,7,8,9,10,14)
/ ontrialend = [if (trial.type.response != 14) values.typeddigits = concat(values.typeddigits, trial.type.response-1); ]
/ ontrialend = [if (trial.type.response == 14 && length(values.typeddigits) > 0) values.typeddigits = substring(values.typeddigits,0,length(values.typeddigits)-1); ]
/ ontrialend = [values.typetimeout -= trial.type.elapsedtime]
/ timeout = values.typetimeout
/ branch = [if (values.typetimeout > 0) trial.type]
</trial>

<text typetext>
/ items = ("<%values.typeddigits%>")
/ erase = false
/ size = (50%, 25%)
/ vjustify = center
</text>

<values>
/ typetimeout = 5000
/ typeddigits = ""
</values>


Hi Dave,

I tried similar way to show letters subject input to themselves. But I found all of the letters shown are uppercas. May I ask is there anyway to show lowercase letters subject input?

Thank you!
Tingy


Yes, by applying the the tolower() string function.

https://www.millisecond.com/support/docs/v4/html/language/expressions/functions.htm