PennController for IBEX › Forums › Support › Selector problem
- This topic has 2 replies, 2 voices, and was last updated 3 years, 8 months ago by
ginopino09.
-
AuthorPosts
-
December 11, 2020 at 6:05 am #6441
ginopino09
ParticipantHello Jeremy,
sorry to bother you again, I have a (minor) problem with the selector and I don’t understand where the error is. I have four picures randomly assigned to four positions (cross disposition). The participants will click on a button to listen to an audio and then decide which is the correct object. So I call a selector to make the mouse selection available but for some reason (unkown to me) sometimes the object on the right cannot be picked. Do you have an idea of why?
PS. I also added a test.selected with a newtext that I never print but that will show up in the results file, so I can keep track of participants accuracy. Is there another more efficient way of doing it?newTrial("recognizz", Template("recotask", row => newTrial("Reco", position=["up","left","right","down"], fisherYates(position), newCanvas("up", "25vw" , "35vh").print("center at 50%", "middle at 20%"), newCanvas("down", "25vw" , "35vh").print("center at 50%", "middle at 80%"), newCanvas("left", "25vw" , "35vh").print("center at 25%", "middle at 50%"), newCanvas("right", "25vw" , "35vh").print("center at 75%", "middle at 50%"), getCanvas(position.pop()).add( 0, 0, newImage("TARGET",row.FIGURATARGET).size( "25vw" , "35vh" )).print(), getCanvas(position.pop()).add( 0, 0, newImage("SECOND",row.IMA2).size( "25vw" , "35vh" )).print(), getCanvas(position.pop()).add( 0, 0, newImage("THIRD",row.IMA3).size( "25vw" , "35vh" )).print(), getCanvas(position.pop()).add( 0, 0, newImage("FOURTH",row.IMA4).size( "25vw" , "35vh" )).print(), newButton("escucha").print("center at 50%","middle at 50%").wait(), newAudio(row.audio).play().wait(), newSelector("objeto") .add(getImage("TARGET"), getImage("SECOND"), getImage("THIRD"), getImage("FOURTH") ) .settings.log() .wait(), clear(), getImage("TARGET").print("center at 50%", "middle at 50%"), newTimer(1000).start().wait(), clear() , getSelector("objeto").test.selected("TARGET").failure(newText("ERROR").log()).success(newText("CORRECT").log()) )))
thank you!
Giorgio
December 11, 2020 at 10:31 am #6442Jeremy
KeymasterHi Giorgio,
I’m not sure why you encounter this specific problem, but I can suggest a few edits that hopefully will help with it:
Template("recotask", row => newTrial("Reco", defaultImage.size("25vw","35vh") , newImage("TARGET",row.FIGURATARGET).print("center at 50vw", "middle at 20vh"), newImage("SECOND",row.IMA2).print("center at 50vw", "middle at 80vh"), newImage("THIRD",row.IMA3).print("center at 25vw", "middle at 50vh"), newImage("FOURTH",row.IMA4).print("center at 75vw", "middle at 50vh") , newSelector("objeto") .add(getImage("TARGET"), getImage("SECOND"), getImage("THIRD"), getImage("FOURTH") ) .shuffle() .disable() .log() , newButton("escucha").print("center at 50vw","middle at 50vh").wait().remove() , newAudio(row.audio).play().wait() , getSelector("objeto").enable().wait() , clear() , getImage("TARGET").print("center at 50vw", "middle at 50vh") , newTimer(1000).start().wait() , clear() , newVar("correct").global().set(true) , getSelector("objeto").test.selected(getImage("TARGET")) .failure(getVar("correct").set(false)) , newButton("Next").print().wait() ) .log("correctChoice", getVar("correct")) )
First I got rid of the recognizz newTrial, which improperly embedded a Template command. I replaced all the percentage coordinates with viewport coordinates, and got rid of the intermediate up/left/down/right Canvas elements. Since Selector elements have a shuffle command, I used that instead of the fisherYates method. I also replaced the .test.selected part: I test getImage("TARGET") instead of simply "TARGET". I also use a global Var element to report whether the choice was correct as an additional column in the results file
Let me know if you have questions, and whether that solved the problem
Jeremy
December 16, 2020 at 7:23 am #6448ginopino09
ParticipantThank you Jeremy, it worked!
-
AuthorPosts
- You must be logged in to reply to this topic.