Millisecond Forums

dragdrop correct responses

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

By nc - 7/1/2020

I have a dragdrop experiment and have 2 questions:

1. is it possible to create a /correctresponse for a trial based on the NUMBER of items dragged and dropped onto a droptarget (that is, it is correct if 4 items were dragged onto the drop stimuli).
2. if not, is it possible to record whether each individual item was dragged onto the droptarget?
By Dave - 7/1/2020

nc - 7/2/2020
I have a dragdrop experiment and have 2 questions:

1. is it possible to create a /correctresponse for a trial based on the NUMBER of items dragged and dropped onto a droptarget (that is, it is correct if 4 items were dragged onto the drop stimuli).
2. if not, is it possible to record whether each individual item was dragged onto the droptarget?

You should be able to do that using /iscorrectresponse or check the objects' positions /ontrialend -- i whether they're on the target or not -- count those on target up and set a value accordingly. Ultimately, though, as often, it all depends on what exactly you want to do and how exactly you want things to behave.
By Dave - 7/1/2020

Dave - 7/2/2020
nc - 7/2/2020
I have a dragdrop experiment and have 2 questions:

1. is it possible to create a /correctresponse for a trial based on the NUMBER of items dragged and dropped onto a droptarget (that is, it is correct if 4 items were dragged onto the drop stimuli).
2. if not, is it possible to record whether each individual item was dragged onto the droptarget?

You should be able to do that using /iscorrectresponse or check the objects' positions /ontrialend -- i whether they're on the target or not -- count those on target up and set a value accordingly. Ultimately, though, as often, it all depends on what exactly you want to do and how exactly you want things to behave.

Assuming we're still talking about the dropping-ducks-into-a-pond procedure, you can count things up pretty easily like so:

<values>
/ target_n = 0
/ n_dropped = 0
/ ducks_dropped = ""
</values>

<trial one>
/ ontrialbegin = [
   values.target_n = 1;
    values.n_dropped = 0;
    values.ducks_dropped = "";
]

/ stimulusframes = [1=one, plus_one, minus_one, try_again,
pond, duck_1_a, duck_1_b, duck_2_a, duck_2_b, duck_3_a, duck_3_b, duck_4_a, duck_4_b, duck_5_a, duck_5_b,
pond]
/ inputdevice = dragdrop
/ showmousecursor = true
/droptargets = (pond)
/ isvalidresponse = [
    if (!contains(values.ducks_dropped, trial.one.lastdropsource) && trial.one.lastdroptarget == "pond") {
        values.ducks_dropped = concat(concat(values.ducks_dropped, ","), trial.one.lastdropsource);
        values.n_dropped += 1;
        false;
    }
]

/ validresponse = (plus_one, minus_one, try_again)
/ correctresponse = (plus_one)
/ontrialbegin=[
    picture.duck_1_a.hposition=24%;
    picture.duck_1_a.vposition=45%;
    picture.duck_1_b.hposition=5%;
    picture.duck_1_b.vposition=30%;
    picture.duck_2_a.hposition=20%;
    picture.duck_2_a.vposition=30%;
    picture.duck_2_b.hposition=15%;
    picture.duck_2_b.vposition=40%;
    picture.duck_3_a.hposition=25%;
    picture.duck_3_a.vposition=55%;
    picture.duck_3_b.hposition=5%;
    picture.duck_3_b.vposition=20%;
    picture.duck_4_a.hposition=10%;
    picture.duck_4_a.vposition=35%;
    picture.duck_4_b.hposition=20%;
    picture.duck_4_b.vposition=35%;
    picture.duck_5_a.hposition=30%;
    picture.duck_5_a.vposition=55%;
    picture.duck_5_b.hposition=13%]
/branch = [if (trial.one.response == "try_again") trial.one]
/branch = [if (trial.one.response == "minus_one") trial.one]
/branch = [if (trial.one.response == "plus_one") trial.three]
</trial>

<trial two>
/ ontrialbegin = [
    values.target_n = 2;
    values.n_dropped = 0;
    values.ducks_dropped = "";
]

/ stimulusframes = [1=two, plus_one, minus_one, try_again,
pond, duck_1_a, duck_1_b, duck_2_a, duck_2_b, duck_3_a, duck_3_b, duck_4_a, duck_4_b, duck_5_a, duck_5_b,
pond]
/ inputdevice = dragdrop
/ showmousecursor = true
/droptargets = (pond)
/ isvalidresponse = [
    if (!contains(values.ducks_dropped, trial.two.lastdropsource) && trial.two.lastdroptarget == "pond") {
        values.ducks_dropped = concat(concat(values.ducks_dropped, ","), trial.two.lastdropsource);
        values.n_dropped += 1;
        false;
    }
]

/ validresponse = (plus_one, minus_one, try_again)
/ correctresponse = (plus_one)
/ontrialbegin=[
    picture.duck_1_a.hposition=24%;
    picture.duck_1_a.vposition=45%;
    picture.duck_1_b.hposition=5%;
    picture.duck_1_b.vposition=30%;
    picture.duck_2_a.hposition=20%;
    picture.duck_2_a.vposition=30%;
    picture.duck_2_b.hposition=15%;
    picture.duck_2_b.vposition=40%;
    picture.duck_3_a.hposition=25%;
    picture.duck_3_a.vposition=55%;
    picture.duck_3_b.hposition=5%;
    picture.duck_3_b.vposition=20%;
    picture.duck_4_a.hposition=10%;
    picture.duck_4_a.vposition=35%;
    picture.duck_4_b.hposition=20%;
    picture.duck_4_b.vposition=35%;
    picture.duck_5_a.hposition=30%;
    picture.duck_5_a.vposition=55%;
    picture.duck_5_b.hposition=13%]
/branch = [if (trial.two.response == "try_again") trial.two]
/branch =[if (trial.two.response == "plus_one") trial.three]
/branch = [if (trial.two.response == "minus_one") trial.one]
</trial>

(analogously for the other trials).

You'll have the target_n (number of ducks that are *supposed* to be dropped into the pond) and the number of ducks actually dropped (n_dropped) as values which you can log to the data file or peform /iscorrectresponse logic on.
By nc - 7/1/2020

Dave - 7/2/2020
nc - 7/2/2020
I have a dragdrop experiment and have 2 questions:

1. is it possible to create a /correctresponse for a trial based on the NUMBER of items dragged and dropped onto a droptarget (that is, it is correct if 4 items were dragged onto the drop stimuli).
2. if not, is it possible to record whether each individual item was dragged onto the droptarget?

You should be able to do that using /iscorrectresponse or check the objects' positions /ontrialend -- i whether they're on the target or not -- count those on target up and set a value accordingly. Ultimately, though, as often, it all depends on what exactly you want to do and how exactly you want things to behave.

how would i check whether they're on target? would i have to specify the coordinate area where they are, or is there a way to check the code to see whether the droptarget and dropsource overlap
By nc - 7/1/2020

nc - 7/2/2020
Dave - 7/2/2020
nc - 7/2/2020
I have a dragdrop experiment and have 2 questions:

1. is it possible to create a /correctresponse for a trial based on the NUMBER of items dragged and dropped onto a droptarget (that is, it is correct if 4 items were dragged onto the drop stimuli).
2. if not, is it possible to record whether each individual item was dragged onto the droptarget?

You should be able to do that using /iscorrectresponse or check the objects' positions /ontrialend -- i whether they're on the target or not -- count those on target up and set a value accordingly. Ultimately, though, as often, it all depends on what exactly you want to do and how exactly you want things to behave.

how would i check whether they're on target? would i have to specify the coordinate area where they are, or is there a way to check the code to see whether the droptarget and dropsource overlap

just saw your previous reply -- thank you! will check out this code
By Dave - 7/1/2020

nc - 7/2/2020
nc - 7/2/2020
Dave - 7/2/2020
nc - 7/2/2020
I have a dragdrop experiment and have 2 questions:

1. is it possible to create a /correctresponse for a trial based on the NUMBER of items dragged and dropped onto a droptarget (that is, it is correct if 4 items were dragged onto the drop stimuli).
2. if not, is it possible to record whether each individual item was dragged onto the droptarget?

You should be able to do that using /iscorrectresponse or check the objects' positions /ontrialend -- i whether they're on the target or not -- count those on target up and set a value accordingly. Ultimately, though, as often, it all depends on what exactly you want to do and how exactly you want things to behave.

how would i check whether they're on target? would i have to specify the coordinate area where they are, or is there a way to check the code to see whether the droptarget and dropsource overlap

just saw your previous reply -- thank you! will check out this code

Minor amendment to the code posted. The /isvalidresponse logic should be extended to

<trial one>
...
/ isvalidresponse = [
    if (!contains(values.ducks_dropped, trial.one.lastdropsource) && trial.one.lastdroptarget == "pond") {
        values.ducks_dropped = concat(concat(values.ducks_dropped, ","), trial.one.lastdropsource);
        values.n_dropped += 1;
        false;
    } else if (trial.one.response == "plus_one" || trial.one.response == "minus_one" || trial.one.response == "try_again") {
        true;
    }

]
...
</trial>

if the existing nagivation logic (experimenter determines whether to advance, go back, etc,) is to be preserved. The file attached should give you the general idea.

Some further logic may be necessary to handle repeats ("try again"), but I'll leave that for later once you've settled on how exactly you want the script to behave.
By Dave - 7/1/2020

Dave - 7/2/2020
nc - 7/2/2020
nc - 7/2/2020
Dave - 7/2/2020
nc - 7/2/2020
I have a dragdrop experiment and have 2 questions:

1. is it possible to create a /correctresponse for a trial based on the NUMBER of items dragged and dropped onto a droptarget (that is, it is correct if 4 items were dragged onto the drop stimuli).
2. if not, is it possible to record whether each individual item was dragged onto the droptarget?

You should be able to do that using /iscorrectresponse or check the objects' positions /ontrialend -- i whether they're on the target or not -- count those on target up and set a value accordingly. Ultimately, though, as often, it all depends on what exactly you want to do and how exactly you want things to behave.

how would i check whether they're on target? would i have to specify the coordinate area where they are, or is there a way to check the code to see whether the droptarget and dropsource overlap

just saw your previous reply -- thank you! will check out this code

Minor amendment to the code posted. The /isvalidresponse logic should be extended to

<trial one>
...
/ isvalidresponse = [
    if (!contains(values.ducks_dropped, trial.one.lastdropsource) && trial.one.lastdroptarget == "pond") {
        values.ducks_dropped = concat(concat(values.ducks_dropped, ","), trial.one.lastdropsource);
        values.n_dropped += 1;
        false;
    } else if (trial.one.response == "plus_one" || trial.one.response == "minus_one" || trial.one.response == "try_again") {
        true;
    }

]
...
</trial>

if the existing nagivation logic (experimenter determines whether to advance, go back, etc,) is to be preserved. The file attached should give you the general idea.

Some further logic may be necessary to handle repeats ("try again"), but I'll leave that for later once you've settled on how exactly you want the script to behave.

Actually, using the response property instead of the lastdroptarget property in the /isvalidresponse logic makes more sense and should avoid any potential issues when any of the trials has to be repeated.

<trial one>
..
/ isvalidresponse = [
    if (!contains(values.ducks_dropped, trial.one.lastdropsource) && trial.one.response == "pond") {
        values.ducks_dropped = concat(concat(values.ducks_dropped, ","), trial.one.lastdropsource);
        values.n_dropped += 1;
        false;
    } else if (trial.one.response == "plus_one" || trial.one.response == "minus_one" || trial.one.response == "try_again") {
        true;
    }
]
...
</trial>