conditional trajectories


Author
Message
troyh
troyh
Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)
Group: Forum Members
Posts: 38, Visits: 190
Hello!

Is it possible to program, e.g., the following:

Let's say I have 4 "room descriptions" that are presented with 2-4 items in each room. You can click on one item at a time, which will lead to its own description, but then returns to the room description. To go from room to room, there are "keys" that get presented following 1 of 4 different contingencies: i) all items have to be clicked on, ii) the same item has to be clicked on twice, iii) the same item has to be clicked on twice in a row, and iv) after the 6th click.
Essentially, I'm envisioning something like,
<trial room1>
/stimulusframes = [ room1description, item1, item2, item3, item4, item1description, item2description, item3description, item4description ]
/branch = [ (if trial.room1.response == "item1"){ return item1description; }

And, with each item description, I have a return button that returns to the room description, unless the contingency for that room is met. The problems I'm running into are that I have two separate trials for each "item" (which is really a link to its description) and "item description", when everything has to be randomized. By everything I mean which contingency is applied to which room and the overall order of the rooms need to be randomized.

Any help would be greatly appreciated.
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
troyh - 9/18/2020
Hello!

Is it possible to program, e.g., the following:

Let's say I have 4 "room descriptions" that are presented with 2-4 items in each room. You can click on one item at a time, which will lead to its own description, but then returns to the room description. To go from room to room, there are "keys" that get presented following 1 of 4 different contingencies: i) all items have to be clicked on, ii) the same item has to be clicked on twice, iii) the same item has to be clicked on twice in a row, and iv) after the 6th click.
Essentially, I'm envisioning something like,
<trial room1>
/stimulusframes = [ room1description, item1, item2, item3, item4, item1description, item2description, item3description, item4description ]
/branch = [ (if trial.room1.response == "item1"){ return item1description; }

And, with each item description, I have a return button that returns to the room description, unless the contingency for that room is met. The problems I'm running into are that I have two separate trials for each "item" (which is really a link to its description) and "item description", when everything has to be randomized. By everything I mean which contingency is applied to which room and the overall order of the rooms need to be randomized.

Any help would be greatly appreciated.

> The problems I'm running into are that I have two separate trials for each "item"

Why?

Also, it's not a problem to apply different contingencies to different "rooms" at random, not sure what you're struggling with in that regard.

troyh
troyh
Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)
Group: Forum Members
Posts: 38, Visits: 190
Dave - 9/19/2020
troyh - 9/18/2020
Hello!

Is it possible to program, e.g., the following:

Let's say I have 4 "room descriptions" that are presented with 2-4 items in each room. You can click on one item at a time, which will lead to its own description, but then returns to the room description. To go from room to room, there are "keys" that get presented following 1 of 4 different contingencies: i) all items have to be clicked on, ii) the same item has to be clicked on twice, iii) the same item has to be clicked on twice in a row, and iv) after the 6th click.
Essentially, I'm envisioning something like,
<trial room1>
/stimulusframes = [ room1description, item1, item2, item3, item4, item1description, item2description, item3description, item4description ]
/branch = [ (if trial.room1.response == "item1"){ return item1description; }

And, with each item description, I have a return button that returns to the room description, unless the contingency for that room is met. The problems I'm running into are that I have two separate trials for each "item" (which is really a link to its description) and "item description", when everything has to be randomized. By everything I mean which contingency is applied to which room and the overall order of the rooms need to be randomized.

Any help would be greatly appreciated.

> The problems I'm running into are that I have two separate trials for each "item"

Why?

Also, it's not a problem to apply different contingencies to different "rooms" at random, not sure what you're struggling with in that regard.

Sorry, I wasn't really clear at all and am new to all this. I guess what I'm trying to figure out is how--if each 'item description' has a return button to return to the room description--to randomly incorporate a new stimulus instead of that return button when the room-specific contingency is met.
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
troyh - 9/19/2020
Dave - 9/19/2020
troyh - 9/18/2020
Hello!

Is it possible to program, e.g., the following:

Let's say I have 4 "room descriptions" that are presented with 2-4 items in each room. You can click on one item at a time, which will lead to its own description, but then returns to the room description. To go from room to room, there are "keys" that get presented following 1 of 4 different contingencies: i) all items have to be clicked on, ii) the same item has to be clicked on twice, iii) the same item has to be clicked on twice in a row, and iv) after the 6th click.
Essentially, I'm envisioning something like,
<trial room1>
/stimulusframes = [ room1description, item1, item2, item3, item4, item1description, item2description, item3description, item4description ]
/branch = [ (if trial.room1.response == "item1"){ return item1description; }

And, with each item description, I have a return button that returns to the room description, unless the contingency for that room is met. The problems I'm running into are that I have two separate trials for each "item" (which is really a link to its description) and "item description", when everything has to be randomized. By everything I mean which contingency is applied to which room and the overall order of the rooms need to be randomized.

Any help would be greatly appreciated.

> The problems I'm running into are that I have two separate trials for each "item"

Why?

Also, it's not a problem to apply different contingencies to different "rooms" at random, not sure what you're struggling with in that regard.

Sorry, I wasn't really clear at all and am new to all this. I guess what I'm trying to figure out is how--if each 'item description' has a return button to return to the room description--to randomly incorporate a new stimulus instead of that return button when the room-specific contingency is met.

The basic gist (here: one room as an example) goes like this, I think?

<values>
/ roomconstraint = 0
/ n_roomitems = 0
/ item1_nclicks = 0
/ item2_nclicks = 0
/ item3_nclicks = 0
/ item4_nclicks = 0
/ lastresponse = ""
/ constraint_met = false
/ buttontext = ""
</values>

1 = click all
2 = click same item twice
3 = click same item twice in a row
4 = six clicks
<list constraints>
/ items = (1, 2, 3, 4)
</list>

<block room_a_block>
/ onblockbegin = [
    values.buttontext = "RETURN";
    values.item1_nclicks = 0;
    values.item2_nclicks = 0;
    values.item3_nclicks = 0;
    values.item4_nclicks = 0;
    values.lastresponse = "";
    values.constraint_met = false;
    values.n_roomitems = 4;
    values.roomconstraint = list.constraints.nextvalue;
]
/ trials = [1=room_a]
</block>

<trial room_a>
/ ontrialbegin = [
    values.lastresponse = trial.room_a.response;
]
/ stimulusframes = [1=clearscreen, room_a_description, room_a_item1, room_a_item2, room_a_item3, room_a_item4]
/ inputdevice = mouse
/ validresponse = (room_a_item1, room_a_item2, room_a_item3, room_a_item4)
/ ontrialend = [
    if (trial.room_a.response == "room_a_item1"){
        values.item1_nclicks += 1;
    } else if (trial.room_a.response == "room_a_item2"){
        values.item2_nclicks += 1;
    } else if (trial.room_a.response == "room_a_item3"){
        values.item3_nclicks += 1;
    } else if (trial.room_a.response == "room_a_item4"){
        values.item4_nclicks += 1;
    };
]
/ ontrialend = [
    if (values.roomconstraint == 1){
        if (values.item1_nclicks > 0 && values.item2_nclicks > 0 && values.item3_nclicks > 0 && values.item4_nclicks > 0){
            values.constraint_met = true;
        }
    } else if (values.roomconstraint == 2){
        if (values.item1_nclicks >= 2 || values.item2_nclicks >= 2 || values.item3_nclicks >= 2 || values.item4_nclicks >= 2){
            values.constraint_met = true;
        }
    } else if (values.roomconstraint == 3){
        if (trial.room_a.response == values.lastresponse) {
            values.constraint_met = true;
        }
    } else if (values.roomconstraint == 4) {
        if (values.item1_nclicks + values.item2_nclicks + values.item3_nclicks + values.item4_nclicks >= 6) {
            values.constraint_met = true;
        }
    }
]
/ branch = [
    if (trial.room_a.response == "room_a_item1"){
        trial.room_a_item1_description;
    } else if (trial.room_a.response == "room_a_item2"){
        trial.room_a_item2_description;
    } else if (trial.room_a.response == "room_a_item3"){
        trial.room_a_item3_description;
    } else if (trial.room_a.response == "room_a_item4"){
        trial.room_a_item4_description;
    };
]
</trial>

<trial room_a_item1_description>
/ ontrialbegin = [
    if (values.constraint_met) {
        values.buttontext = "NEXT ROOM";
        trial.room_a_item1_description.insertstimulusframe(text.key_message,1);
    };
]
/ ontrialend = [
    trial.room_a_item1_description.resetstimulusframes();
]
/ stimulusframes = [1=clearscreen, room_a_item1_description, return]
/ inputdevice = mouse
/ validresponse = (return)
/ branch = [
    if (!values.constraint_met) {
        trial.room_a;
    };
]
</trial>

<trial room_a_item2_description>
/ ontrialbegin = [
    if (values.constraint_met) {
        values.buttontext = "NEXT ROOM";
        trial.room_a_item2_description.insertstimulusframe(text.key_message,1);
    };
]
/ ontrialend = [
    trial.room_a_item2_description.resetstimulusframes();
]
/ stimulusframes = [1=clearscreen, room_a_item2_description, return]
/ inputdevice = mouse
/ validresponse = (return)
/ branch = [
    if (!values.constraint_met) {
        trial.room_a;
    };
]
</trial>

<trial room_a_item3_description>
/ ontrialbegin = [
    if (values.constraint_met) {
        values.buttontext = "NEXT ROOM";
        trial.room_a_item3_description.insertstimulusframe(text.key_message,1);
    };
]
/ ontrialend = [
    trial.room_a_item3_description.resetstimulusframes();
]
/ stimulusframes = [1=clearscreen, room_a_item3_description, return]
/ inputdevice = mouse
/ validresponse = (return)
/ branch = [
    if (!values.constraint_met) {
        trial.room_a;
    };
]
</trial>

<trial room_a_item4_description>
/ ontrialbegin = [
    if (values.constraint_met) {
        values.buttontext = "NEXT ROOM";
        trial.room_a_item4_description.insertstimulusframe(text.key_message,1);
    };
]
/ ontrialend = [
    trial.room_a_item4_description.resetstimulusframes();
]
/ stimulusframes = [1=clearscreen, room_a_item4_description, return]
/ inputdevice = mouse
/ validresponse = (return)
/ branch = [
    if (!values.constraint_met) {
        trial.room_a;
    };
]
</trial>

<text room_a_description>
/ items = ("Description of Room A")
/ erase = false
/ position = (50%, 15%)
</text>

<text room_a_item1>
/ items = ("Item 1")
/ erase = false
/ position = (20%, 50%)
</text>

<text room_a_item2>
/ items = ("Item 2")
/ erase = false
/ position = (40%, 50%)
</text>

<text room_a_item3>
/ items = ("Item 3")
/ erase = false
/ position = (60%, 50%)
</text>

<text room_a_item4>
/ items = ("Item 4")
/ erase = false
/ position = (80%, 50%)
</text>

<text room_a_item1_description>
/ items = ("Description of item 1")
/ erase = false
/ position = (50%, 40%)
/ size = (50%, 20%)
</text>

<text room_a_item2_description>
/ items = ("Description of item 2")
/ erase = false
/ position = (50%, 40%)
</text>

<text room_a_item3_description>
/ items = ("Description of item 3")
/ erase = false
/ position = (50%, 40%)
/ size = (50%, 20%)
</text>

<text room_a_item4_description>
/ items = ("Description of item 4")
/ erase = false
/ position = (50%, 40%)
/ size = (50%, 20%)
</text>

<text key_message>
/ items = ("You've found the key and can advance to the next room.")
/ position = (50%, 40%)
/ size = (50%, 20%)
</text>

<button return>
/ caption = "<%values.buttontext%>"
/ size = (10%, 5%)
/ position = (50%, 60%)
</button>


troyh
troyh
Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)
Group: Forum Members
Posts: 38, Visits: 190
Thank you , this is absolutely perfect. I really appreciate it.
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K

Or a bit more concise:

<values>
/ roomconstraint = 0
/ n_roomitems = 0
/ item1_nclicks = 0
/ item2_nclicks = 0
/ item3_nclicks = 0
/ item4_nclicks = 0
/ lastresponse = ""
/ constraint_met = false
/ descriptionitem = 1
/ buttontext = ""
</values>

1 = click all
2 = click same item twice
3 = click same item twice in a row
4 = six clicks
<list constraints>
/ items = (1, 2, 3, 4)
</list>

<block room_a_block>
/ onblockbegin = [
    values.descriptionitem = 1;
    values.buttontext = "RETURN";
    values.item1_nclicks = 0;
    values.item2_nclicks = 0;
    values.item3_nclicks = 0;
    values.item4_nclicks = 0;
    values.lastresponse = "";
    values.constraint_met = false;
    values.n_roomitems = 4;
    values.roomconstraint = list.constraints.nextvalue;
]
/ trials = [1=room_a]
</block>

<trial room_a>
/ ontrialbegin = [
    values.lastresponse = trial.room_a.response;
]
/ stimulusframes = [1=clearscreen, room_a_description, room_a_item1, room_a_item2, room_a_item3, room_a_item4]
/ inputdevice = mouse
/ validresponse = (room_a_item1, room_a_item2, room_a_item3, room_a_item4)
/ ontrialend = [
    if (trial.room_a.response == "room_a_item1"){
        values.descriptionitem = 1;
        values.item1_nclicks += 1;
    } else if (trial.room_a.response == "room_a_item2"){
        values.descriptionitem = 2;
        values.item2_nclicks += 1;
    } else if (trial.room_a.response == "room_a_item3"){
        values.descriptionitem = 3;
        values.item3_nclicks += 1;
    } else if (trial.room_a.response == "room_a_item4"){
        values.descriptionitem = 4;
        values.item4_nclicks += 1;
    };
]
/ ontrialend = [
    if (values.roomconstraint == 1){
        if (values.item1_nclicks > 0 && values.item2_nclicks > 0 && values.item3_nclicks > 0 && values.item4_nclicks > 0){
            values.constraint_met = true;
        }
    } else if (values.roomconstraint == 2){
        if (values.item1_nclicks >= 2 || values.item2_nclicks >= 2 || values.item3_nclicks >= 2 || values.item4_nclicks >= 2){
            values.constraint_met = true;
        }
    } else if (values.roomconstraint == 3){
        if (trial.room_a.response == values.lastresponse) {
            values.constraint_met = true;
        }
    } else if (values.roomconstraint == 4) {
        if (values.item1_nclicks + values.item2_nclicks + values.item3_nclicks + values.item4_nclicks >= 6) {
            values.constraint_met = true;
        }
    }
]
/ branch = [
    trial.room_a_item_description;
]
</trial>

<trial room_a_item_description>
/ ontrialbegin = [
    if (values.constraint_met) {
        values.buttontext = "NEXT ROOM";
        trial.room_a_item_description.insertstimulusframe(text.key_message,1);
    };
]
/ ontrialend = [
    trial.room_a_item_description.resetstimulusframes();
]
/ stimulusframes = [1=clearscreen, room_a_item_description, return]
/ inputdevice = mouse
/ validresponse = (return)
/ branch = [
    if (!values.constraint_met) {
        trial.room_a;
    };
]
</trial>

<text room_a_description>
/ items = ("Description of Room A")
/ erase = false
/ position = (50%, 15%)
</text>

<text room_a_item1>
/ items = ("Item 1")
/ erase = false
/ position = (20%, 50%)
</text>

<text room_a_item2>
/ items = ("Item 2")
/ erase = false
/ position = (40%, 50%)
</text>

<text room_a_item3>
/ items = ("Item 3")
/ erase = false
/ position = (60%, 50%)
</text>

<text room_a_item4>
/ items = ("Item 4")
/ erase = false
/ position = (80%, 50%)
</text>

<text room_a_item_description>
/ items = ("Description of item 1", "Description of item 2", "Description of item 3", "Description of item 4")
/ select = values.descriptionitem
/ erase = false
/ position = (50%, 40%)
/ size = (50%, 20%)
</text>

<text key_message>
/ items = ("You've found the key and can advance to the next room.")
/ position = (50%, 40%)
/ size = (50%, 20%)
</text>

<button return>
/ caption = "<%values.buttontext%>"
/ size = (10%, 5%)
/ position = (50%, 60%)
</button>


troyh
troyh
Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)
Group: Forum Members
Posts: 38, Visits: 190
Is it possible to have the 'key text' appear in the frame with the item description, so that, after the contingency is met, a participant would still click 'return', however, this time the 'key text' appears on screen with that item description along with the next room button? 
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
troyh - 9/19/2020
Is it possible to have the 'key text' appear in the frame with the item description, so that, after the contingency is met, a participant would still click 'return', however, this time the 'key text' appears on screen with that item description along with the next room button? 

Sure.

<values>
/ roomconstraint = 0
/ n_roomitems = 0
/ item1_nclicks = 0
/ item2_nclicks = 0
/ item3_nclicks = 0
/ item4_nclicks = 0
/ lastresponse = ""
/ constraint_met = false
/ descriptionitem = 1
/ buttontext = ""
/ keytext = ""
</values>

1 = click all
2 = click same item twice
3 = click same item twice in a row
4 = six clicks
<list constraints>
/ items = (1, 2, 3, 4)
</list>

<block room_a_block>
/ onblockbegin = [
    values.keytext = "";
    values.descriptionitem = 1;
    values.buttontext = "RETURN";
    values.item1_nclicks = 0;
    values.item2_nclicks = 0;
    values.item3_nclicks = 0;
    values.item4_nclicks = 0;
    values.lastresponse = "";
    values.constraint_met = false;
    values.n_roomitems = 4;
    values.roomconstraint = list.constraints.nextvalue;
]
/ trials = [1=room_a]
</block>

<trial room_a>
/ ontrialbegin = [
    values.lastresponse = trial.room_a.response;
]
/ stimulusframes = [1=clearscreen, room_a_description, room_a_item1, room_a_item2, room_a_item3, room_a_item4]
/ inputdevice = mouse
/ validresponse = (room_a_item1, room_a_item2, room_a_item3, room_a_item4)
/ ontrialend = [
    if (trial.room_a.response == "room_a_item1"){
        values.descriptionitem = 1;
        values.item1_nclicks += 1;
    } else if (trial.room_a.response == "room_a_item2"){
        values.descriptionitem = 2;
        values.item2_nclicks += 1;
    } else if (trial.room_a.response == "room_a_item3"){
        values.descriptionitem = 3;
        values.item3_nclicks += 1;
    } else if (trial.room_a.response == "room_a_item4"){
        values.descriptionitem = 4;
        values.item4_nclicks += 1;
    };
]
/ ontrialend = [
    if (values.roomconstraint == 1){
        if (values.item1_nclicks > 0 && values.item2_nclicks > 0 && values.item3_nclicks > 0 && values.item4_nclicks > 0){
            values.constraint_met = true;
        }
    } else if (values.roomconstraint == 2){
        if (values.item1_nclicks >= 2 || values.item2_nclicks >= 2 || values.item3_nclicks >= 2 || values.item4_nclicks >= 2){
            values.constraint_met = true;
        }
    } else if (values.roomconstraint == 3){
        if (trial.room_a.response == values.lastresponse) {
            values.constraint_met = true;
        }
    } else if (values.roomconstraint == 4) {
        if (values.item1_nclicks + values.item2_nclicks + values.item3_nclicks + values.item4_nclicks >= 6) {
            values.constraint_met = true;
        }
    }
]
/ branch = [
    trial.room_a_item_description;
]
</trial>

<trial room_a_item_description>
/ ontrialbegin = [
    if (values.constraint_met) {
        values.buttontext = "NEXT ROOM";
        values.keytext = "You've found the key and can advance to the next room.";
    };
]
/ stimulusframes = [1=clearscreen, room_a_item_description, return]
/ inputdevice = mouse
/ validresponse = (return)
/ branch = [
    if (!values.constraint_met) {
        trial.room_a;
    };
]
</trial>

<text room_a_description>
/ items = ("Description of Room A")
/ erase = false
/ position = (50%, 15%)
</text>

<text room_a_item1>
/ items = ("Item 1")
/ erase = false
/ position = (20%, 50%)
</text>

<text room_a_item2>
/ items = ("Item 2")
/ erase = false
/ position = (40%, 50%)
</text>

<text room_a_item3>
/ items = ("Item 3")
/ erase = false
/ position = (60%, 50%)
</text>

<text room_a_item4>
/ items = ("Item 4")
/ erase = false
/ position = (80%, 50%)
</text>

<text room_a_item_description>
/ items = ("Description of item 1.~n<%values.keytext%>", "Description of item 2.~n<%values.keytext%>", "Description of item 3.~n<%values.keytext%>", "Description of item 4.~n<%values.keytext%>")
/ select = values.descriptionitem
/ erase = false
/ position = (50%, 40%)
/ size = (50%, 20%)
</text>

<button return>
/ caption = "<%values.buttontext%>"
/ size = (10%, 5%)
/ position = (50%, 60%)
</button>


troyh
troyh
Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)
Group: Forum Members
Posts: 38, Visits: 190
Thank you for all the hel
troyh
troyh
Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)Partner Member (564 reputation)
Group: Forum Members
Posts: 38, Visits: 190
troyh - 9/19/2020
Thank you for all the hel

help!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search