Can text's be clicked and detected?


Author
Message
EN
EN
Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)
Group: Forum Members
Posts: 30, Visits: 177
Hello,
on my study, I want to present two options to participants -- right now, in text form -- but would like to adjust the text based on the value of globals variabls (defined under values) that will change for each participant based on the scores obtained during a pre-callibration phase.

I wonder if:

1) the /items within a <text> can be dynamically modified based on the values of such global variables?
2) can the /position defined within a <text> be modifed also? I would like to "randomize" the positions of the options between left and right at each trial.

Below is some sample code of what I'm trying to do.

3) On a related topic, is it possible to dynamically chance the /caption of <sureypage>?

Any help would be greatly appreciated. Thanks a lot!

EN

--
<values>
//xxx
/ easyThresh50 = 8 //The number of boxes at the 50% level
/ mediumThresh65 = 10 //The number of boxes at the 65% level
/ mediumThresh80 = 13 //The number of boxes at the 80% level
/ hardThresh95 = 15 //The number of boxes at the 95% level
//yyy
/ low_pay = 2 //Low reward
/ medium_pay = 6 //Medium reward
/ high_pay = 10 //High reward
</values>

<text rest_1_cr>
/ items = ("<center>Rest<br>1 credit</center>")
/ txColor = (0, 0, 255)
/ txBGColor = (255, 255, 255)
/ position = (20%, 50%)
/ valign = top
/ halign = center
</text>

<text effort_n_cr>
/ items = ("<center>xxx boxes<br>yyy credits</center>")
/ txColor = (0, 0, 255)
/ txBGColor = (255, 255, 255)
/ position = (80%, 50%)
/ valign = top
/ halign = center
</text>

<trial bottomleftpractice>
/ stimulustimes = [0=rest_1_cr, effort_n_cr]
/inputdevice = mouse
/timeout = 10000
</trial>
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: 108K
EN - 6/19/2025
Hello,
on my study, I want to present two options to participants -- right now, in text form -- but would like to adjust the text based on the value of globals variabls (defined under values) that will change for each participant based on the scores obtained during a pre-callibration phase.

I wonder if:

1) the /items within a <text> can be dynamically modified based on the values of such global variables?
2) can the /position defined within a <text> be modifed also? I would like to "randomize" the positions of the options between left and right at each trial.

Below is some sample code of what I'm trying to do.

3) On a related topic, is it possible to dynamically chance the /caption of <sureypage>?

Any help would be greatly appreciated. Thanks a lot!

EN

--
<values>
//xxx
/ easyThresh50 = 8 //The number of boxes at the 50% level
/ mediumThresh65 = 10 //The number of boxes at the 65% level
/ mediumThresh80 = 13 //The number of boxes at the 80% level
/ hardThresh95 = 15 //The number of boxes at the 95% level
//yyy
/ low_pay = 2 //Low reward
/ medium_pay = 6 //Medium reward
/ high_pay = 10 //High reward
</values>

<text rest_1_cr>
/ items = ("<center>Rest<br>1 credit</center>")
/ txColor = (0, 0, 255)
/ txBGColor = (255, 255, 255)
/ position = (20%, 50%)
/ valign = top
/ halign = center
</text>

<text effort_n_cr>
/ items = ("<center>xxx boxes<br>yyy credits</center>")
/ txColor = (0, 0, 255)
/ txBGColor = (255, 255, 255)
/ position = (80%, 50%)
/ valign = top
/ halign = center
</text>

<trial bottomleftpractice>
/ stimulustimes = [0=rest_1_cr, effort_n_cr]
/inputdevice = mouse
/timeout = 10000
</trial>

All of these things are possible. Since it's not at all obvious from your code snippet what exactly you want to do depending on what, it's not possible to give you an example on the basis of your code. Here are a few generic examples:
(1) Randomizing on-screen positions of clickable elements every trial:

<values>
/ aX = 0%
/ bX = 0%
</values>

<block exampleBlock>
/ trials = [1-10 = exampleTrial]
</block>

<trial exampleTrial>
/ onTrialBegin = [
    // pick random postion for option A
    values.aX = list.x.nextValue;
    // pick position for option B
    values.bX = list.x.nextValue;
]
/ stimulusframes = [1=a,b]
/ inputdevice = mouse
/ validresponse = (a,b)
</trial>

<text a>
/ items = ("Option A")
/ hPosition = values.aX
/ vPosition = 65%
</text>

<text b>
/ items = ("Option B")
/ hPosition = values.bX
/ vPosition = 65%
</text>

<list x>
/ items = (35%, 65%)
/ selectionrate = always
</list>


(2) Piping variables into text items:

<values>
/ aX = 0%
/ bX = 0%

/ trialType = null

/ aPoints = 0
/ bPoints = 0

/ aHigh = 100
/ bHigh = 80
/ aLow = 20
/ bLow = 40
</values>

<block exampleBlock>
/ trials = [1-10 = exampleTrial]
</block>

<trial exampleTrial>
/ onTrialBegin = [
    // pick random postion for option A
    values.aX = list.x.nextValue;
    // pick position for option B
    values.bX = list.x.nextValue;
    // determine trial type
    values.trialType = list.trialType.nextValue;
    // set winnings according to trial type
    if (values.trialType == "High") {
        values.aPoints = values.aHigh;
        values.bPoints = values.bHigh;
    } else {
        values.aPoints = values.aLow;
        values.bPoints = values.bLow;
    }
]
/ stimulusframes = [1=a,b,c]
/ inputdevice = mouse
/ validresponse = (a,b)
</trial>

<text a>
/ items = ("Option A")
/ hPosition = values.aX
/ vPosition = 65%
</text>

<text b>
/ items = ("Option B")
/ hPosition = values.bX
/ vPosition = 65%
</text>

<text c>
/ items = ("Trial type: <%values.trialType%> reward.
Option A: Chance to win <%values.aPoints%> points.
Option B: Chance to win <%values.bPoints%> points.")
/ position = (50%, 30%)
</text>

<list trialType>
/ items = ("High", "Low")
/ poolsize = 10
</list>

<list x>
/ items = (35%, 65%)
/ selectionrate = always
</list>


You can set the /caption of a surveyPage in the same way. Just pipe in the text you want via a variable you set.

These things are all covered in the Programmer's Manual, too, so I would very much recommend working through it in full:
https://www.millisecond.com/support/Inquisit%20Programmer's%20Manual.pdf
Edited 7 days ago @ 4:00 AM by Dave
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search