Millisecond Forums

Typing task Inquisit 4

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

By Wenkuo - 1/6/2015

Hi there,
I'm new at Inquisit and this is my first time on the forums, so I have no idea if I'm raising the topic correctly.

I have been trying to create a typing task on Inquisit 4 that will allow me to know when someone first starts typing an answer
and when someone stops typing. This part is currently working now, thanks to a lot of help from others, but it is the ending where I'm stuck. 
I want to add in a button that can be clicked on with the mouse, so that people can move on when they are finished.
However,  I can't seem to get that to work in Inquisit. 

This is the current script: 

<trial exppos>
/ stimulustimes = [1=blank,black,answer]
/ inputdevice = keyboard
/ validresponse = (16,17,18,19,20,21,22,23,24,25,30,31,32,33,34,35,36,37,38,44,45,46,47,48,49,50,28,14,51,52,57,79,2)
/ ontrialend = [if (trial.exppos.response == 16) values.letter = "q"]
/ ontrialend = [if (trial.exppos.response == 17) values.letter = "w"]
/ ontrialend = [if (trial.exppos.response == 18) values.letter = "e"]
/ ontrialend = [if (trial.exppos.response == 19) values.letter = "r"]
/ ontrialend = [if (trial.exppos.response == 20) values.letter = "t"]
/ ontrialend = [if (trial.exppos.response == 21) values.letter = "y"]
/ ontrialend = [if (trial.exppos.response == 22) values.letter = "u"]
/ ontrialend = [if (trial.exppos.response == 23) values.letter = "i"]
/ ontrialend = [if (trial.exppos.response == 24) values.letter = "o"]
/ ontrialend = [if (trial.exppos.response == 25) values.letter = "p"]
/ ontrialend = [if (trial.exppos.response == 30) values.letter = "a"]
/ ontrialend = [if (trial.exppos.response == 31) values.letter = "s"]
/ ontrialend = [if (trial.exppos.response == 32) values.letter = "d"]
/ ontrialend = [if (trial.exppos.response == 33) values.letter = "f"]
/ ontrialend = [if (trial.exppos.response == 34) values.letter = "g"]
/ ontrialend = [if (trial.exppos.response == 35) values.letter = "h"]
/ ontrialend = [if (trial.exppos.response == 36) values.letter = "j"]
/ ontrialend = [if (trial.exppos.response == 37) values.letter = "k"]
/ ontrialend = [if (trial.exppos.response == 38) values.letter = "l"]
/ ontrialend = [if (trial.exppos.response == 44) values.letter = "z"]
/ ontrialend = [if (trial.exppos.response == 45) values.letter = "x"]
/ ontrialend = [if (trial.exppos.response == 46) values.letter = "c"]
/ ontrialend = [if (trial.exppos.response == 47) values.letter = "v"]
/ ontrialend = [if (trial.exppos.response == 48) values.letter = "b"]
/ ontrialend = [if (trial.exppos.response == 49) values.letter = "n"]
/ ontrialend = [if (trial.exppos.response == 50) values.letter = "m"]
/ ontrialend = [if (trial.exppos.response == 28) values.letter = "~n"]
/ ontrialend = [if (trial.exppos.response == 57) values.letter = " "]
/ ontrialend = [if (trial.exppos.response == 51) values.letter = ","]
/ ontrialend = [if (trial.exppos.response == 52) values.letter = "."]
/ ontrialend = [if (trial.exppos.response != 14) {setitem(item.letter,values.letter,1); setitem(item.answer,values.answer,1)}]
/ ontrialend = [if (trial.exppos.response != 14) values.answer = concat(getitem(item.answer,1),getitem(item.letter,1))]
/ ontrialend = [setitem(item.answer,values.answer,1)]
/ ontrialend = [if (trial.exppos.response == 14) values.answer = substring(getitem(item.answer,1),0,length(values.answer)-1)]
/ ontrialend = [if (trial.exppos.response == 14) setitem(item.answer,values.answer,1)]
/ ontrialend = [values.currenttime = values.currenttime + trial.exppos.latency]
/ branch = [if (trial.exppos.response == 2) trial.end]
/ branch = [trial.exppos]
</trial>

<trial end>
/ ontrialbegin = [values.amount = 0; values.cumulative_time = 0; values.answer = ""; values.letter = "";values.currenttime = 0;values.select = values.select+1]
/ stimulusframes = [1 = blank]
/ recorddata = true
/ timeout = 1
</trial>

<item letter>
/1 = ""
</item>

<item answer>
/1 = ""
</item>

<values>
/amount = 0
/cumulative_time = 0
/answer = ""
/letter = ""
/currenttime = 0
/select = 1
</values>

<text answer>
/ items = ("<%values.answer%>")
/ position = (50%,75.5%)
/ erase = false
/txbgcolor = (255,255,255)
/ txcolor = (0, 0, 0)
/ size = (39.5%,19%)
/ valign = top
</text>

<shape blank>
/ shape = rectangle
/ size = (100%,100%)
/ color = (255,255,255)
/ erase = false
</shape>

<shape black>
/ shape = rectangle
/ size = (40%,20%)
/ color = (0,0,0)
/ erase = false
/ position = (50%,75%)
/ valign = top
</shape>

Is there any way to add in a button so that people can move on from this task with a simple mouseclick?

A second question is: does it matter what kind of keyboard someone has? The current code makes use of the scancodes as a valid response,
however, would it matter if some uses an azerty keyboard instead of a qwerty keyboard? 

I hope my questions are clear.

Many thanks in advance,

Wenkuo
By Dave - 1/6/2015

> I have been trying to create a typing task on Inquisit 4 that will allow me to know when someone first starts typing an answer
> and when someone stops typing

It would have been easier for you to use a simple <openended> element and log its firstcharlatency and lastcharlatency properties.

> I want to add in a button that can be clicked on with the mouse, so that people can move on when they are finished.

Set <trial end>'s /inputdevice to mouse, have it display a <text> or <picture> element to serve as your "button", define that object as the trial's /validresponse. It is not possible to have multiple /inputdevices in a given <trial> element, i.e., you cannot have <trial exppos> accept input from both mouse and keyboard -- it's either one or the other.

> A second question is: does it matter what kind of keyboard someone has? The current code makes use of the scancodes as
> a valid response, however, would it matter if some uses an azerty keyboard instead of a qwerty keyboard?

Yes, this matters. On a standard QWERTY keyboard, scancode 16 maps to "Q". On an AZERTY keyboard, scancode 16 maps to "A" (and so forth). The code you have in <trial exppos> will treat every keyboard as having a QWERTY layout.
By Wenkuo - 1/6/2015

Hi Dave,

Thank you for the fast reply!

I'm still unfamiliar with Inquisit and programming in general unfortunately, so this might sound a bit stupid, 
but how do I go about combining the openended element and first/lastcharlatency? I've looked at the openended element before,
but I had no idea that something like that was possible.

Many thanks in advance,

Wenkuo
By Dave - 1/6/2015

E.g.

<block myblock>
/ trials = [1=myopenended]
</block>

<openended myopenended>
...
</openended>

<data>
/ columns = [date, time, subject, ..., openended.myopenended.firstcharlatency, openended.myopenended.lastcharlatency, ...]
...
</data>
By Wenkuo - 1/7/2015

Thank you! It's working perfectly now.