Millisecond Forums

Randomising Trial Selection

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

By raynae - 1/16/2022

Hello, 

I'm looking for help on how to program an idiosyncratic presentation for sorting rules in a sorting task. 
In my script I have a radiobutton selection of the sorting rules in which participants select 1 option of 4 possible options. Then using /skip I present this sorting rule in the first block of trials. What I want is, in a second block of trials, to randomly present one of the other 3 options. I believe should be using the /counter function. But I'm having a hard time thinking of a way to define the /items basic upon an earlier response. 

Thanks in advance 
By Dave - 1/17/2022

raynae - 1/16/2022
Hello, 

I'm looking for help on how to program an idiosyncratic presentation for sorting rules in a sorting task. 
In my script I have a radiobutton selection of the sorting rules in which participants select 1 option of 4 possible options. Then using /skip I present this sorting rule in the first block of trials. What I want is, in a second block of trials, to randomly present one of the other 3 options. I believe should be using the /counter function. But I'm having a hard time thinking of a way to define the /items basic upon an earlier response. 

Thanks in advance 

You need to be more specific. Also, provide example code.
By Dave - 1/17/2022

Dave - 1/17/2022
raynae - 1/16/2022
Hello, 

I'm looking for help on how to program an idiosyncratic presentation for sorting rules in a sorting task. 
In my script I have a radiobutton selection of the sorting rules in which participants select 1 option of 4 possible options. Then using /skip I present this sorting rule in the first block of trials. What I want is, in a second block of trials, to randomly present one of the other 3 options. I believe should be using the /counter function. But I'm having a hard time thinking of a way to define the /items basic upon an earlier response. 

Thanks in advance 

You need to be more specific. Also, provide example code.

Here's a basic template; It contains a lot of guesswork since you didn't reveal very much about the structure of your script, but it should give you something you can adapt to your needs nonetheless.

<values>
/ selected_rule = 0
</values>

<block first_rule>
/ trials = [1=surveypage.first_rule]
</block>

<surveypage first_rule>
/ ontrialend = [
    values.selected_rule = dropdown.first_rule.response; // store selected rule number in variable
    list.rules.removeitem(values.selected_rule); // remove selected rule option from list
    list.rulenumbers.removeitem(values.selected_rule); // remove corresponding rule number from list
]
/ questions = [1=dropdown.first_rule]
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>

// 4 rules available for the first selection
<dropdown first_rule>
/ caption = "select a sorting rule"
/ options = ("<%list.rules.items.1%>", "<%list.rules.items.2%>", "<%list.rules.items.3%>", "<%list.rules.items.4%>")
/ optionvalues = ("<%list.rulenumbers.items.1%>", "<%list.rulenumbers.items.2%>", "<%list.rulenumbers.items.3%>", "<%list.rulenumbers.items.4%>")
</dropdown>

<block second_rule>
/ onblockbegin = [
    values.selected_rule = list.rulenumbers.nextvalue; // now select one of the 3 remaining rules at random for the second round
]
</block>

// option text displayed by the rule selection dropdown; can be any kind of descriptive text
<list rules>
/ items = ("Rule A", "Rule B", "Rule C", "Rule D")
</list>

// numerical identifiers for the rules used as optionvalues
<list rulenumbers>
/ items = (1, 2, 3, 4)
</list>

// rule 1 block: skipped if selected rule is not rule #1
<block rule_1>
/ skip = [
    values.selected_rule != 1;
]
/ trials = [1=trial.mytrial]
</block>

// rule 2 block: skipped if selected rule is not rule #2
<block rule_2>
/ skip = [
    values.selected_rule != 2;
]
/ trials = [1=trial.mytrial]
</block>

// rule 3 block: skipped if selected rule is not rule #3
<block rule_3>
/ skip = [
    values.selected_rule != 3;
]
/ trials = [1=trial.mytrial]
</block>

// rule 4 block: skipped if selected rule is not rule #4
<block rule_4>
/ skip = [
    values.selected_rule != 4;
]
/ trials = [1=trial.mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=text.mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("Rule #<%values.selected_rule%> was selected. This is block.<%script.currentblock%>.")
</text>

<expt>
/ blocks = [
    1=sequence(block.first_rule, block.rule_1, block.rule_2, block.rule_3, block.rule_4); // first round
    2=sequence(block.second_rule, block.rule_1, block.rule_2, block.rule_3, block.rule_4); // second round
    ]
</expt>