PennController for IBEX › Forums › Support › Conditional feedback based on DragDrop response
Tagged: DragDrop
- This topic has 2 replies, 2 voices, and was last updated 2 years, 8 months ago by
mawilson.
-
AuthorPosts
-
July 21, 2022 at 12:25 pm #8297
mawilson
ParticipantI’m setting up a task where participants drag a word into one of two possible positions left open in a sentence. I want to have a training phase in the experiment where participants are provided different feedback based on whether they chose the correct position for the word or the wrong position.
This is the DragDrop I have at the moment (here’s a link to the experiment, https://farm.pcibex.net/r/PtpjPM/):
newDragDrop("dd", "bungee") .log("all") .addDrop(getText(first_arg), getText(second_arg)) .addDrag(getText("word")) .offset('0.5em', '0.1em', getText(first_arg), getText(second_arg)) .wait() .callback(getMouseTracker("mouse").stop()) .removeDrag(getText("word")) .removeDrop(getText(first_arg), getText(second_arg))
first_arg and second_arg are the labels of the boxes where the word can be dropped, and I have a variable target_res that is defined to be equal to one of them (with its value depending on which of a random set of words was chosen for that trial). However, I can’t seem to figure out how to add a condition to the callback function that depends on which box the word was dropped on (i.e., that depends on whether target_res is equal to the label of the box the user dropped the word on).
If it was dropped on the wrong box, I want to display some error text and (ideally if possible) allow the participant to move the word again until they get it right. If it was dropped on the right box, I want to display a confirmation message before continuing on.
July 21, 2022 at 5:11 pm #8299Jeremy
KeymasterHi,
EDIT: actually you do need
callback
if you want to only move on when dropping in the right box:newText("yes"),newText("no", "drop in the other box") , newDragDrop("dd", "bungee") .log("all") .addDrop( getText(first_arg), getText(second_arg) ) .addDrag(getText("word")) .callback( getText("yes").remove(),getText("no").remove() , self.test.dropped( getText(target_res) ) .success( getText("yes").print() ) .failure( getText("no").print() ) ) .offset('0.5em', '0.1em', getText(first_arg), getText(second_arg) ) .wait( self.test.dropped(getText(target_res)) ) .removeDrag(getText("word")) .removeDrop( getText(first_arg), getText(second_arg) ) , getMouseTracker("mouse").stop() ,
End of EDIT
You don’t need to use
callback
, just test whether the Text element whose name corresponds to the value oftarget_res
is the one that received the draggable element afterwait
:newDragDrop("dd", "bungee") .log("all") .addDrop( getText(first_arg), getText(second_arg) ) .addDrag(getText("word")) .offset('0.5em', '0.1em', getText(first_arg), getText(second_arg) ) .wait() .test.dropped( getText(target_res) ) .success( newText("yes").print() ) .failure( newText("no").print() ) .removeDrag( getText("word") ) .removeDrop( getText(first_arg), getText(second_arg) ) , getMouseTracker("mouse").stop() ,
Jeremy
-
This reply was modified 2 years, 8 months ago by
Jeremy.
July 21, 2022 at 6:25 pm #8303mawilson
ParticipantThank you for the help—this is working great now!
-
This reply was modified 2 years, 8 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.