Using "if statements" to display certain "expressions" in the instructions (DeathSuicide IAT)


Author
Message
hspixley
hspixley
Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)
Group: Forum Members
Posts: 4, Visits: 18
Hello,

I would like words to change in the instructions dependent on which group the subject is in.  I think this looks correct based on other code I've found, but I get an error message: "Expression 'groupnumber' is invalid.  Expression contains an unknown element or property name."

I've tried lots of variants according to other "group" type words I've found in the text, but I can't get any to work.

I've also tried to display the words dependent on the block that is being presented, but that didn't work, either.  Code below (shortened the "instructions" section by a few blocks).

<item instructions>
/ 1 =  "                   Block 1 of 7

During this part of the task, tap the (E) key for <%expressions.grouponedeath%> related words.  Tap the (I) key for <%expressions.grouponelife%> related words.

If you make a mistake, a red 'X' will appear.  Tap the other key to continue.

GO AS FAST AS YOU CAN while making as few mistakes as possible."

/ 2 =  "                   Block 2 of 7

During this part of the task, tap the (E) key for NOT ME related words.  Tap the (I) key for ME related words.

If you make a mistake, a red 'X' will appear.  Tap the other key to continue.

GO AS FAST AS YOU CAN while making as few mistakes as possible."

/ 3 =  "                   Block 3 of 7

During this part of the task, tap the (E) key for <%expressions.grouponedeath%> and for NOT ME related words.  Tap the (I) key for <%expressions.grouponelife%> and for ME related words.

If you make a mistake, a red 'X' will appear.  Tap the other side of the screen to continue.

GO AS FAST AS YOU CAN while making as few mistakes as possible."
</item>


****************************************************************************************************
general instruction expressions: adjust the instruction text depending on the subject's group
****************************************************************************************************
<expressions>
/grouponedeath = if (groupnumber == group1) {"DEATH";} else {"LIFE";}
/grouponelife = if (groupnumber == group1) {"LIFE";} else {"DEATH";}
</expressions>


ALSO TRIED:
****************************************************************************************************
general instruction expressions: adjust the instruction text depending on the subject's group
****************************************************************************************************
<expressions>
/grouponedeath = if (block.incompatibletest1 || block.incompatibletest2 || block.incompatibletestinstructions || block.targetincompatiblepractice || block.targetincompatiblepracticeswitch) {"DEATH";} else {"LIFE";}
/grouponelife = if (block.incompatibletest1 || block.incompatibletest2 || block.incompatibletestinstructions || block.targetincompatiblepractice || block.targetincompatiblepracticeswitch) {"LIFE";} else {"DEATH";}
</expressions>


hspixley
hspixley
Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)Partner Member (957 reputation)
Group: Forum Members
Posts: 4, Visits: 18
YESSSSS!!!!!!
I thought I had tried every possible combination...BUT, this works:

****************************************************************************************************
general instruction expressions: adjust the instruction text depending on device used to run script
****************************************************************************************************
<expressions>
/grouponedeath = if (script.groupid == 1) {"DEATH";} else {"LIFE";}
/grouponelife = if (script.groupid == 1) {"LIFE";} else {"DEATH";}
</expressions>
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: 13K, Visits: 104K
You'll probably want to generalize the logic a little further. The group / condition assignment is based on simple modulo arithmetic, i.e. with two conditions this boils down to

- odd group number -> 1st condition
- even group number -> 2nd condition

Your logic doesn't cover that yet. Enter 3 or 5 as the group number, and your expressions will not return the right thing.

What you'll want to do is something along the lines of

<expressions>
/grouponedeath = if (mod(script.groupid ,2) == 1) {"DEATH";} else {"LIFE";}
/grouponelife = if (mod(script.groupid,2) == 1) {"LIFE";} else {"DEATH";}
</expressions>                               

Hope this helps.



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search