Keyboard version of AAT


Keyboard version of AAT

Author
Message
cwk
cwk
Respected Member
Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)

Group: Forum Members
Posts: 2, Visits: 1

I suspect that this has been addressed before, but I haven't been able to find the answer in other posts. I am trying to adapt the AAT script to keyboard use. I think I have all the elements but appear to be missing something obvious. When I run the script I get the first image but no changes follow keystrokes, i.e., the picture neither increases nor decreases. 


I am including the entire script (minus instructions) in the hope that my error will be clear.



**************************************************************************************************************


<defaults >


/canvasaspectratio = (4,3)


/minimumversion = "4.0.2.0"


/inputdevice = keyboard


</defaults>




<values>


/ratioA = 0.4


/ratioB = 0.5


/MinHeight = 0.1


/intertrialinterval = 300


/key_pull = 21


/key_push = 48


/pushkey = "Y"


/pullkey = "B"


</values>               



<values >


/pulls = 0


/pushes = 0


/startheight_A = 0


/startheight_B = 0


/Maxheight = display.height


/selectstimulus = 0


/targetstimulus = 0


</values>



<expressions >


/ratio_changePerAssignedpixel = 1000/((values.ratioA - values.MinHeight) * values.Maxheight)


</expressions>



<page AAT_demo_start>


</page>



<item targets>


/1="1P_9.jpg"


/2="1P_8.jpg"


/3="2P_2.jpg"


/4="2P_1.jpg"



/5="1L_9.jpg"


/6="1L_8.jpg"


/7="2L_2.jpg"


/8="2L_1.jpg"


</item>



<picture targetstimulus>


/ items = targets


/ select = values.selectstimulus


/ position = (50%, 50%)


/ size = (100%, 100%)


/ erase = false


</picture>



<shape eraser>


/ shape = rectangle


/ color = white


/ size = (100%, 100%)


/ erase = false


</shape>



<list category1>


/ items = (1, 2, 3, 4)


/ replace = false


</list>



<list category2>


/ items = (5, 6, 7, 8)


/ replace = false


</list>




<trial AAT_push>


/ ontrialbegin = [values.selectstimulus = list.category1.nextvalue]


/ ontrialbegin = [picture.targetstimulus.height = values.startheight_A]


/ stimulusframes = [1 = targetstimulus]



/ validresponse = (values.key_push, values.key_pull)


/ iscorrectresponse = [(trial.AAT_push.response == values.key_push)]


/ branch = [if (trial.AAT_push.response == values.key_push) trial.decrease else trial.increase]



</trial>



<trial AAT_pull>


/ ontrialbegin = [values.selectstimulus = list.category2.nextvalue]


/ ontrialbegin = [picture.targetstimulus.height = values.startheight_A]


/ stimulusframes = [1 = targetstimulus]



/ validresponse = (values.key_push, values.key_pull)


/ iscorrectresponse = [(trial.AAT_pull.response == values.key_pull)]


/ branch = [if (trial.AAT_pull.response == values.key_pull) trial.increase else trial.decrease]


</trial>



<trial InterTrialInterval>


/ ontrialbegin = [values.pushes = 0; values.pulls = 0]


/ stimulusframes = [1 = eraser]


/ timeout = values.intertrialinterval


</trial>



<trial decrease>


/ontrialbegin = [values.pushes +=1]


/ontrialbegin = [picture.targetstimulus.height = picture.targetstimulus.height - ((values.pushes*250)/expressions.ratio_changeperassignedpixel)]


/stimulusframes = [1 = eraser, targetstimulus]


/validresponse = (values.key_push, values.key_pull)



/ontrialend = [trial.decrease.resetstimulusframes()]



/branch = [if (values.pushes >= 4) 


            trial.intertrialinterval]


/branch = [if (values.pushes < 4 && (trial.decrease.response == values.key_push)) 


            trial.decrease]


/branch = [if (trial.decrease.response == values.key_pull) 


            {values.pushes -=1; trial.increase}]


</trial>



<trial increase>


/ontrialbegin = [values.pulls +=1]


/ontrialbegin = [picture.targetstimulus.height = picture.targetstimulus.height + ((values.pulls*250)/expressions.ratio_changeperassignedpixel)]


/stimulusframes = [1 = targetstimulus]


/validresponse = (values.key_pull, values.key_push)



/ontrialend = [trial.increase.resetstimulusframes()]



/branch = [if (values.pulls >= 4) 


            trial.intertrialinterval]


/branch = [if (values.pulls < 4 && (trial.increase.response == values.key_pull)) 


            trial.increase]


/branch = [if (trial.increase.response == values.key_push) 


            {values.pulls -=1; trial.decrease}]


</trial>



<block AAT_demo>


/ preinstructions = (AAT_demo_start)


/ trials = [1-8 = random(AAT_push,AAT_pull)]


</block>



<expt>


/ onexptbegin = [values.startheight_A = values.ratioA*display.height]


/ onexptbegin = [values.startheight_B = values.ratioB*display.height]


/ blocks = [1 = AAT_demo]


/ recorddata = false


</expt>




Dave
Dave
Supreme Being
Supreme Being (753K reputation)Supreme Being (753K reputation)Supreme Being (753K reputation)Supreme Being (753K reputation)Supreme Being (753K reputation)Supreme Being (753K reputation)Supreme Being (753K reputation)Supreme Being (753K reputation)Supreme Being (753K reputation)

Group: Administrators
Posts: 9.9K, Visits: 49K

/ validresponse = (values.key_push, values.key_pull)


The /validresponse attribute can't be used like that. You either need to use /isvalidresponse (with proper syntax) instead, or supply the scancodes.


cwk
cwk
Respected Member
Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)Respected Member (331 reputation)

Group: Forum Members
Posts: 2, Visits: 1

Thank you very much Dave!


GO


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....






Millisecond Forums


Search