By tela - 7/28/2016
It is already hard to come up with a proper title for my question, but I try to do my best to explain my problem.
The goal is to display the participant three simulated games in which they take part, but no response from the participant is required (the computer makes the decision for them). Each game consists of two phases, invest and return, and the participant is asked to press a button to move to the next phase and to the next game. I have the amounts to be invested and returned in list elements, and use expressions element to calculate the other information displayed to the participant.
What I want to achieve is that in the surveypage's ontrialbegin element the list.nextvalue returns the next value for each game, but now it does it for each text element displayed (these text elements correspond to the phases invest and return), so the invest and return phases are not in sync. Any idea how to make this work or better implement this? I enter the relevant part of the script here:
<surveypage TGprime_trust_sp> / stimulusframes = [1 = play_t] / ontrialbegin = [values.invest=list.investlist.nextvalue; values.return=list.equitreturn.nextvalue; values.Agets=expressions.bothplayersget; values.Bgets=expressions.bothplayersget] / ontrialbegin = [values.game += 1] / caption = "Game <%values.game%>" / finishlabel = "Suivant" / showpagenumbers = false / showquestionnumbers = false </surveypage>
<surveypage TGprime_distrust_sp> / stimulusframes = [1 = play_t] / ontrialbegin = [values.invest=list.investlist.nextvalue; values.return=list.inequitreturn.nextvalue; values.Agets=expressions.playerAgets; values.Bgets=expressions.playerBgets] / ontrialbegin = [values.game += 1] / caption = "Game <%values.game%>" / finishlabel = "Suivant" / showpagenumbers = false / showquestionnumbers = false </surveypage>
<text play_t> / items = play_i / hjustify = left / size = (50%, 50%) / select = sequence </text>
<item play_i> / 1 = "You have sent <%values.invest%> euros to your opponent. When multiplied by three it makes <%expressions.multiple%> euros. Press Next to see your opponent's decision." / 2 = "Your opponent has decided to give you <%values.return%> euros. This means that you have now <%values.Agets%> euros, whereas your opponent keeps <%values.Bgets%> euros. Press Next to continue." </item>
<list investlist> / items = ("12", "18", "9") / selectionmode = sequence </list>
<list equitreturn> / items = ("14", "26", "8") / selectionmode = sequence </list>
<list inequitreturn> / items = ("4", "8", "2") / selectionmode = sequence </list>
<values> / endow = 20 / game = 0 / invest = "" / return = "" / Agets = "" / Bgets = "" </values>
<expressions> / multiple = values.invest*3 / bothplayersget = (multiple + (values.endow - values.invest))/2 / playerAgets = (values.endow - values.invest) + values.return / playerBgets = (multiple - values.return) </expressions>
|
By Dave - 7/28/2016
The code excerpts you provided are missing some crucial bits: It is not clear when and how often each of the surveypages is run. Please note that any /ontrialbegin logic will be executed whenever the respective trial is run (a <surveypage> is a kind of trial). I.e., when you have e.g.
<block someblock> / trials = [1-2=TGprime_trust_sp] </block>
you will sample new values from your lists per /ontrialbegin
<surveypage TGprime_trust_sp> / stimulusframes = [1 = play_t] / ontrialbegin = [values.invest=list.investlist.nextvalue; values.return=list.equitreturn.nextvalue; values.Agets=expressions.bothplayersget; values.Bgets=expressions.bothplayersget] / ontrialbegin = [values.game += 1] ... </surveypage>
when the 1st instance of the page is run, and then _again_ when the 2nd instance of the page is run.
You may simply want to have separate <surveypage>s for the two different "phases" of your game: One for the "invest" phase, one for the "return" phase. Run the "return" surveypage after the "invest" page (e.g. via /branch).
You would then only update your values / sample items from lists, etc. via /ontrialbegin in the "invest" <surveypage>, but not in the "return" page element. Nothing can run out of sync then.
|
|