Problems converting BART to keyboard press


Author
Message
ekothe
ekothe
Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)
Group: Forum Members
Posts: 3, Visits: 1

I'm trying to edit the default BART script to use keyboard responses rather than button presses. However I'm having problems with the script.



I've made changes to the choice trials but they are not performing as expected.



<trial choice>


/ ontrialbegin = [values.countchoice = values.countchoice + 1]


/ ontrialbegin = [values.pumpresult = counter.pumpresult.selectedvalue]


/ stimulustimes = [1=collectbutton, balloon, pumpbutton, totalearnings, pumpcount, potentialearnings, ballooncount]


/ inputdevice = keyboard


/ validresponse = ("1", "2")


/ ontrialend = [if (trial.choice.response == "1" && values.countchoice == 1) 


                  values.timebefore1stpump = trial.choice.latency ]


/ ontrialend = [if (trial.choice.response == "1"  && values.countchoice > 1) 


                  {values.timebtwpumps = trial.choice.latency; 


                  values.sum_timebtwpumps = values.sum_timebtwpumps + values.timebtwpumps }]


/ ontrialend = [if (trial.choice.response == "2" && values.countchoice == 1) 


                  values.timebeforecollectwithoutpump =  trial.choice.latency ]


/ ontrialend = [if (trial.choice.response == "2" && values.countchoice > 1) 


                  values.timebtwlastpumpandcollect =  trial.choice.latency ]



/ branch = [if ( trial.choice.response == "1") trial.pump]


/ branch = [if ( trial.choice.response == "2") trial.collect]



/ recorddata = true


</trial>



When I run this script a keyboard press of 1 is registered as a collect, and a keyboard press of 2 takes me straight to the final instructions "Congratulations you've made $0.0". So there is no way to pump the balloon! 



If edit the script so that...


<trial choice>


/ ontrialbegin = [values.countchoice = values.countchoice + 1]


/ ontrialbegin = [values.pumpresult = counter.pumpresult.selectedvalue]


/ stimulustimes = [1=collectbutton, balloon, pumpbutton, totalearnings, pumpcount, potentialearnings, ballooncount]


/ inputdevice = keyboard


/ validresponse = ("2", "3")


/ ontrialend = [if (trial.choice.response == "3" && values.countchoice == 1) 


                  values.timebefore1stpump = trial.choice.latency ]


/ ontrialend = [if (trial.choice.response == "3"  && values.countchoice > 1) 


                  {values.timebtwpumps = trial.choice.latency; 


                  values.sum_timebtwpumps = values.sum_timebtwpumps + values.timebtwpumps }]


/ ontrialend = [if (trial.choice.response == "2" && values.countchoice == 1) 


                  values.timebeforecollectwithoutpump =  trial.choice.latency ]


/ ontrialend = [if (trial.choice.response == "2" && values.countchoice > 1) 


                  values.timebtwlastpumpandcollect =  trial.choice.latency ]



/ branch = [if ( trial.choice.response == "3") trial.pump]


/ branch = [if ( trial.choice.response == "2") trial.collect]



/ recorddata = true


</trial>


When I run this script a keyboard press of 2 is registered as a pump, and a keyboard press of 3 takes me straight to the final instructions "Congratulations you've made $0.0". So there is no way to collect my winnings! 

If I set the valid responses to "a" and "f" (and change all of the trial.choice.response to corresponding values) then both responses take me straight to the final instructions.


Any ideas about what might be causing this and a potential fix? 


Attachments
BART_withkeyboardpress.exp (114 views, 21.00 KB)
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: 108K

You need to work with keyboard scancodes in your /branch etc. attributes. "Literal" key values will not work, as that is not what the response property returns. See the "Keyboard Scan Codes" topic in the documentation as well as Tools -> Keyboard Scancodes...


ekothe
ekothe
Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)Respected Member (424 reputation)
Group: Forum Members
Posts: 3, Visits: 1

Thanks Dave, I managed to get it working.



Out of interest what is the logic about when Inquisit will use "literal" key values and when it uses keyboard scan codes?


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search