Millisecond Forums

undodraw attribute

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

By MaxiBecker2015 - 2/21/2017

Dear Inquisit experts,

I have a question regarding the undodraw attribute: I have a task where participants are supposed to draw the answer to a visual-spatial riddle (connecting 4 dots). The drawing itself works with the draw attribute. However, I would like to enable the participants to erase their scratch while using a button ("undo") and start anew. However, it just won´t work. I tried every possible combination. Does anyone of you have an idea why not? Here is the code:

<trial loesung1S>
/ stimulusframes = [1=fixation1; 50= mask; 60 = raetsel1S, raetselbild1S, undo, done]
/ correctresponse = ("done")
/ validresponse = ("done")
/ inputdevice = mouse
/ draw = pencil
/ undodraw = [trial.loesung1S.response == "undo"]
/ screencapture = FALSE
/ showmousecursor = TRUE
/ response = timeout(120000)
</trial>

The "done" button works perfectly fine, but when clicking on the "undo" button, nothing happens.  Any help is very much appreciated.
thanks in advance, Maxi
By Dave - 2/21/2017

MaxiBecker2015 - Tuesday, February 21, 2017
Dear Inquisit experts,

I have a question regarding the undodraw attribute: I have a task where participants are supposed to draw the answer to a visual-spatial riddle (connecting 4 dots). The drawing itself works with the draw attribute. However, I would like to enable the participants to erase their scratch while using a button ("undo") and start anew. However, it just won´t work. I tried every possible combination. Does anyone of you have an idea why not? Here is the code:

<trial loesung1S>
/ stimulusframes = [1=fixation1; 50= mask; 60 = raetsel1S, raetselbild1S, undo, done]
/ correctresponse = ("done")
/ validresponse = ("done")
/ inputdevice = mouse
/ draw = pencil
/ undodraw = [trial.loesung1S.response == "undo"]
/ screencapture = FALSE
/ showmousecursor = TRUE
/ response = timeout(120000)
</trial>

The "done" button works perfectly fine, but when clicking on the "undo" button, nothing happens.  Any help is very much appreciated.
thanks in advance, Maxi

"undo" needs to be specified as a /validresponse (it isn't in your <trial>) and you'll want to restart the trial in case of an "undo" response. Something like:

<trial loesung1S>
/ stimulusframes = [1=undo, done]
/ correctresponse = ("done")
/ validresponse = ("done", "undo")
/ inputdevice = mouse
/ draw = pencil
/ undodraw = [trial.loesung1S.response == "undo"]
/ screencapture = FALSE
/ showmousecursor = TRUE
/ response = timeout(120000)
/ branch = [if(trial.loesung1s.response == "undo") trial.loesung1s]
</trial>

<text done>
/ items = ("DONE")
/ position = (40%, 90%)
</text>

<text undo>
/ items = ("UNDO")
/ position = (60%, 90%)
</text>

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

<shape pencil>
/ shape = circle
/ color = green
/ size = (50px, 50px)
</shape>

Hope this helps.
By MaxiBecker2015 - 2/22/2017

Dave - Tuesday, February 21, 2017
MaxiBecker2015 - Tuesday, February 21, 2017
Dear Inquisit experts,

I have a question regarding the undodraw attribute: I have a task where participants are supposed to draw the answer to a visual-spatial riddle (connecting 4 dots). The drawing itself works with the draw attribute. However, I would like to enable the participants to erase their scratch while using a button ("undo") and start anew. However, it just won´t work. I tried every possible combination. Does anyone of you have an idea why not? Here is the code:

<trial loesung1S>
/ stimulusframes = [1=fixation1; 50= mask; 60 = raetsel1S, raetselbild1S, undo, done]
/ correctresponse = ("done")
/ validresponse = ("done")
/ inputdevice = mouse
/ draw = pencil
/ undodraw = [trial.loesung1S.response == "undo"]
/ screencapture = FALSE
/ showmousecursor = TRUE
/ response = timeout(120000)
</trial>

The "done" button works perfectly fine, but when clicking on the "undo" button, nothing happens.  Any help is very much appreciated.
thanks in advance, Maxi

"undo" needs to be specified as a /validresponse (it isn't in your <trial>) and you'll want to restart the trial in case of an "undo" response. Something like:

<trial loesung1S>
/ stimulusframes = [1=undo, done]
/ correctresponse = ("done")
/ validresponse = ("done", "undo")
/ inputdevice = mouse
/ draw = pencil
/ undodraw = [trial.loesung1S.response == "undo"]
/ screencapture = FALSE
/ showmousecursor = TRUE
/ response = timeout(120000)
/ branch = [if(trial.loesung1s.response == "undo") trial.loesung1s]
</trial>

<text done>
/ items = ("DONE")
/ position = (40%, 90%)
</text>

<text undo>
/ items = ("UNDO")
/ position = (60%, 90%)
</text>

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

<shape pencil>
/ shape = circle
/ color = green
/ size = (50px, 50px)
</shape>

Hope this helps.
Hi Dave,
excellent, thank you so much it works now :). I would only have one final question regarding this. Is it also possible that participants only draw when they hold the mouse button pressed otherwise not?

All the best,
Maxi

By Dave - 2/22/2017

MaxiBecker2015 - Wednesday, February 22, 2017
Dave - Tuesday, February 21, 2017
MaxiBecker2015 - Tuesday, February 21, 2017
Dear Inquisit experts,

I have a question regarding the undodraw attribute: I have a task where participants are supposed to draw the answer to a visual-spatial riddle (connecting 4 dots). The drawing itself works with the draw attribute. However, I would like to enable the participants to erase their scratch while using a button ("undo") and start anew. However, it just won´t work. I tried every possible combination. Does anyone of you have an idea why not? Here is the code:

<trial loesung1S>
/ stimulusframes = [1=fixation1; 50= mask; 60 = raetsel1S, raetselbild1S, undo, done]
/ correctresponse = ("done")
/ validresponse = ("done")
/ inputdevice = mouse
/ draw = pencil
/ undodraw = [trial.loesung1S.response == "undo"]
/ screencapture = FALSE
/ showmousecursor = TRUE
/ response = timeout(120000)
</trial>

The "done" button works perfectly fine, but when clicking on the "undo" button, nothing happens.  Any help is very much appreciated.
thanks in advance, Maxi

"undo" needs to be specified as a /validresponse (it isn't in your <trial>) and you'll want to restart the trial in case of an "undo" response. Something like:

<trial loesung1S>
/ stimulusframes = [1=undo, done]
/ correctresponse = ("done")
/ validresponse = ("done", "undo")
/ inputdevice = mouse
/ draw = pencil
/ undodraw = [trial.loesung1S.response == "undo"]
/ screencapture = FALSE
/ showmousecursor = TRUE
/ response = timeout(120000)
/ branch = [if(trial.loesung1s.response == "undo") trial.loesung1s]
</trial>

<text done>
/ items = ("DONE")
/ position = (40%, 90%)
</text>

<text undo>
/ items = ("UNDO")
/ position = (60%, 90%)
</text>

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

<shape pencil>
/ shape = circle
/ color = green
/ size = (50px, 50px)
</shape>

Hope this helps.
Hi Dave,
excellent, thank you so much it works now :). I would only have one final question regarding this. Is it also possible that participants only draw when they hold the mouse button pressed otherwise not?

All the best,
Maxi


No, that isn't possible using the /draw attribute and a single <trial>. You could build something approximating this, which however will be more complicated. See e.g. the examples here: https://www.millisecond.com/forums/FindPost4421.aspx

If you run the "ShowMouseTrail" script, clicking the left mouse button will enable "drawing", clicking the right mouse button will disable drawing, and you can move the mouse cursor to a different position and start drawing from there by clicking the left mouse button again (and so forth).

The Trail Making Test script in the library might be another script worth looking at for perhaps useful additional ideas and usage of /draw: https://www.millisecond.com/download/library/trailmakingtest/

Hope this helps.