combine variables


Author
Message
Guido K.
Guido K.
Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)
Group: Forum Members
Posts: 5, Visits: 69
Dear forum,
while looking for a input-button-randomization we have problems to find the best solution. Subjects have to press the left or right button (perhaps "a" and "l") for right answer, randomly other have to press the switched buttons ("l" and "a").

/ onexptbegin = [values.left_right = round(rand(1,2))]

will bring a random value (1 or 2). Now we want to use the left_right-value to select the proper correctresponse. Therefore we use two lists (listname1 and listname2).

/ correctresponse = (list.listname1.nextvalue)
works, but we want to change the "1" in "listname" for the other condition into "2" like this:

/ correctresponse = (list.listname<%values.left_right%>.nextvalue)

will not work! How it's possible to use and combine variables (values) in Inquist? What is the different between values and variables?

Best

Guido



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: 109K
This will not work using the /correctresponse attribute. It only accepts hardcoded values. To have a dynamically (or randomly) determined correct response, you must use /iscorrectresponse. In a nutshell:

<values>
/ correctkey = 1
</values>

30 = keyboard scan code for "A"
38 = keyboard scan code for "L"

<block myblock>
/ onblockbegin = [values.correctkey = noreplace(30,38)]
/ trials = [1-4 = mytrial]
</block>

<trial mytrial>
...
/ validresponse = (30,38)
/ iscorrectresponse = [trial.mytrial.response == values.correctkey]
</trial>

Re. <values> vs <variables>:

<values> are akin to what you would call global variables in other programming languages.

<variables>, on the other hand define between-subjects conditions by substituting entire *elements* (e.g. <text>, <trial>, <block>) based on the assigned condition / group.

<variables> have some limitations and -- while useful under specific circumstances -- should be avoided in most cases. Use various <expt> elements instead to create between-subjects conditions via their /subjects and /groupassignment attributes.

Edited 11 Years Ago by Dave
Guido K.
Guido K.
Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)Partner Member (752 reputation)
Group: Forum Members
Posts: 5, Visits: 69
Thx, this will 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