show user automatically updated score after trial?


Author
Message
pn_dc5
pn_dc5
Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)
Group: Forum Members
Posts: 2, Visits: 7
Hello,

I am trying to customize an existing experiment (4 person cyberball) such that the user is shown each non-human player's cumulative total number of tosses (as a score) each time the ball is passed around. I've added code to show a "score" and have created values for the score that are set to increase by 1 each time the player receives the ball (values.count_player2throws += 1, etc;). However, I can't quite figure out how to get inquisit to update the stimulus screen such that the new score is shown to them. I'm fairly new to the program and am assuming that the problem has something to do with the ontrialstart/ontrialend commands(?) I think that the value of the counter is updating correctly, but just can't figure out how to then show that updated counter after each pass of the ball on the stimulus screen.

I've looked around at other posts asking how to add a counter, how to show a clock, etc (which is how I've gotten to where I'm at now) but am otherwise stumped. Any help would be greatly appreciated!  



<usermanual>
                       
                                    Cyberball: 4 PLAYERS
SCRIPT INFO
xf
Script Author: Sean Draine, PhD
last updated:  10-25-2018 by K. Borchert (katjab@millisecond.com) for Millisecond Software, LLC

Script Copyright ©  10-25-2018 Millisecond Software


BACKGROUND INFO

                                            *Purpose*
This script implements the Cyberball paradigm based on:

Williams, K. D., Cheung, C. K. T., & Choi, W. (2000). CyberOstracism: Effects of being ignored over
the Internet. Journal of Personality and Social Psychology, 79, 748-762.

Williams, K. D., & Jarvis, B. (2006). Cyberball: A program for use in research on ostracism and interpersonal
acceptance. Behavior Research Methods, Instruments, and Computers, 38, 174-180.

see also: http://www1.psych.purdue.edu/~willia55/Announce/cyberball.htm

                                              *Task*
Participant plays ball with 3 other participants (= the computer). It can be predefined with what
probability the computer includes/excludes the participant into the ball game.


DATA FILE INFORMATION:
The default data stored in the data files are:

(1) Raw data file: '4PlayerCyberball_raw*.iqdat' (a separate file for each participant)

build:                            Inquisit build
computer.platform:                the platform the script was run on
date, time, subject, group:        date and time script was run with the current subject/groupnumber
blockcode, blocknum:            the name and number of the current block
trialcode, trialnum:             the name and number of the currently recorded trial
                                    (Note: not all trials that are run might record data)
                                Trialcode Explanation:
                                Examples:
                                    "1to2" => in this trial player 2 (participant) throws the ball AFTER getting it from player 1
                                    "1to3" => in this trial player 3 throws the ball AFTER getting it from player 1 (random selection decides whether player 3 throws to player 1)
/player:                        stores the current player
/recipient:                        stores the recipient of the current ball toss (1, 2, 3, 4)                               
response:                        the (participant's) response
latency:                         the response latency in ms (for trials in which player 1 and 3 "play", the latency
                                is the randomly selected trialduration)
/count_ignore2:                    counts how often player 2 (participant) was "ignored" before a throw (resets every time
                                player 2 gets to throw the ball)

(2) Summary data file: '4PlayerCyberball_summary*.iqdat' (a separate file for each participant)

script.startdate:                date script was run
script.starttime:                time script was started
script.subjectid:                subject id number
script.groupid:                    group id number
script.elapsedtime:                time it took to run script (in ms)
computer.platform:                the platform the script was run on
/completed:                        0 = script was not completed (prematurely aborted); 1 = script was completed (all conditions run)
/showpictures:                    true = pictures of players are onscreen (default)
                                false = no pictures are presented
/showlabels:                    true = labels of players are onscreen (default)
                                false = no labels are presented

item.player1.1-
item.player4label.1:            images and labels used for the various players

/max_trialcount:                maximum number of trials (= passes between all players) played       

/ignore2_streak1:                 the number of times player 2 (participant) was ignored before player2 (participant) gets to respond for the first time
/max_ignore2:                    the longest streak of ignoring player 2 (participant) in the game that participant experienced
                                before being able to respond

/count_player2throws:            counts the number of times that player 1 gets to throw the ball
/count_player2throws:            counts the number of times that player 3 gets to throw the ball
/count_player2throws:            counts the number of times that player 2 (participant) gets to throw the ball
/meanRT_player2:                mean latency (in ms) of player 2 (participant)

/count_12:                        counts the number of times that player 1 throws to player 2 (participant)
/perc_12:                        percentage of player 1 throws that play to player 2 (participant)
/count_21:                        counts the number of times that player 2 (participant) throws to player 1
/perc_21:                        percentage of player 2 throws (participant) that play to player 1
/meanRT_21:                        mean latency (in ms) of player 2 (participant) decisions to throw to player 1

(same for player 3 and 4)

/perc_sameplayer:                percentage of player 2 (participant) throws when player 2 throws the ball back to the player who threw the ball to participant
                                        Note: random selection -> 1/3 times of all player 2 throws
/perc_otherplayer:                percentage of player 2 (participant) throws when player 2 throws ball to the player who didn't threw the ball to participant
                                        Note: random selection -> 2/3 times of all player 2 throws
/meanRT_sameplayer:                mean latency (in ms) of trials in which player2 (participant) throws ball back to the player who threw the ball to participant
/meanRT_otherplayer:            mean latency (in ms) of trials in which player2 (participant) throws ball to a player who didn't threw the ball to participant



EXPERIMENTAL SET-UP
* Participant plays ball with 3 other players for 50 trials.
The number of trials can be edited under section EDITABLE PARAMETERS.

* By default, all players are represented by names and pictures.
Names and pictures can be edited under section EDITABLE STIMULI.
To remove names or pictures go to EDITABLE PARAMETERS.

* By default, player 1 throws the ball to participant (=player2)  with a pre-determined probability (default: 14% of the times)
as does Player 3 and 4 (default: 14% of the times). The probabilities can be edited under EDITABLE LISTS.
The player schedules can further be customized to dictate specific/fixed throw sequences for each of the
"computer player".Go to section EDITABLE LISTS for further instructions.

* Decision Times for Player 1,3 and 4 are controlled by expressions.cyberdecisiontime under
EDITABLE PARAMETERS.

STIMULI
picture examples are provided by Millisecond Software. They can easily be edited under section
Editable Stimuli

INSTRUCTIONS
can be edited under section Editable Instructions

EDITABLE CODE:
check below for (relatively) easily editable parameters, stimuli, instructions etc.
Keep in mind that you can use this script as a template and therefore always "mess" with the entire code to further customize your experiment.

The parameters you can change are:

/max_trialcount:    maximum number of trials (= passes between the players) played       
/showpictures:        true = pictures of players are onscreen (default)
                    false = no pictures are presented
/showlabels:        true = labels of players are onscreen (default)
                    false = no labels are presented
                       
NOTE: parameters.showpictures and parameters.showlabels cannot be set to false at the same time.

/ cyberdecisiontime:         selects without replacement (noreplace) one of the 4 decision times for players1,3 and 4

</usermanual>


**************************************************************************************************************
**************************************************************************************************************
    EDITABLE PARAMETERS: change editable parameters here
**************************************************************************************************************
**************************************************************************************************************

<parameters>
/ max_trialcount = 10
/ showpictures = true
/ showlabels = true
</parameters>


<expressions>
/ cyberdecisiontime = noreplace(500, 1000, 1500, 2000)
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE STIMULI: change editable stimuli here
**************************************************************************************************************
**************************************************************************************************************

***********************
Player Pictures
***********************
<item player1>
/ 1 = "cassie.jpg"
</item>

<item player2>
/ 1 = "kip.jpg"
</item>

<item player3>
/ 1 = "trevor.jpg"
</item>

<item player4>
/ 1 = "sean.jpg"
</item>
***********************
Player Labels
***********************

<item player1label>
/ 1 = "Cassie"
</item>

<item player3label>
/ 1 = "Trevor"
</item>

<item player4label>
/ 1 = "Sean"
</item>

fills in automatically:
<item player2label>
/ 1 = "<%capitalize(textbox.name.response)%>"
</item>

***********************
Animation Movies
***********************
<item animations>
/ 1 = "1to2.gif"
/ 2 = "1to3.gif"
/ 3 = "1to4.gif"
/ 4 = "2to1.gif"
/ 5 = "2to3.gif"
/ 6 = "2to4.gif"
/ 7 = "3to1.gif"
/ 8 = "3to2.gif"
/ 9 = "3to4.gif"
/ 10 = "4to1.gif"
/ 11 = "4to2.gif"
/ 12 = "4to3.gif"
</item>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE INSTRUCTIONS: change instructions here
**************************************************************************************************************
**************************************************************************************************************

<item instructions>
/ 1 = "Welcome to Cyberball, the Interactive Ball-Tossing Game Used for Mental Visualization!"

/ 2 = "In the upcoming experiment, we test the effects of practicing mental visualization on task performance. Thus, we need you to practice your mental visualization skills. We have found that the best way to do this is to have you play an on-line ball tossing game with other participants who are logged on at the same time.

In a few moments, you will be playing a ball tossing game with other students over our network. The game is very simple. When the ball is tossed to you, simply <%expressions.buttoninstruct2%> the player you want to throw it to.

What is important is not your ball tossing performance, but that you MENTALLY visualize the entire experience. Imagine what the others look like. What sort of people are they? Where are you playing? Is it warm and sunny or cold and rainy? Create in your mind a complete mental picture of what might be going on if you were playing this game in real life.

Okay, ready to begin? Please <%expressions.buttoninstruct1%> 'Start' to begin."
</item>

****************************************************************************************************
general instruction expressions: adjust the instruction text depending on device used to run script
****************************************************************************************************
<expressions>
/ buttoninstruct1 = if (computer.touch && !computer.haskeyboard) {"Touch";} else {"click";}
/ buttoninstruct2 = if (computer.touch && !computer.haskeyboard) {"touch";} else {"click on";}
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE LISTS: change editable lists here
**************************************************************************************************************
**************************************************************************************************************

Note: by default players 1, 3 and 4 throw to player 2 roughly 14% of the time (1 out 7 times)

The item lists of these schedules can be further controlled by setting a specific/fixed throw sequence:
Example Player 1:

/items = (3, 4, 2, 3, 4, 4, 3, 3, 4, 4, 4, 3, 3, 2, 3, 2, 4, 2, 3, 3, 4, 4, 3, 3, 4)
/selectionmode = sequence

(if selectionmode = sequence => it is suggested to create the list as long as (parameters.max_trialcount/2)
to ensure that the beginning of the list does NOT get repeated)

<list player1schedule>
/ items = (3, 3, 3, 3, 3, 3, 2, 4)
/ replace = false
</list>

<list player3schedule>
/ items = (1, 1, 4, 4, 2, 2)
/ replace = false
</list>

<list player4schedule>
/ items = (3, 3, 3, 3, 3, 3, 2, 1)
/ replace = false
</list>

**************************************************************************************************************
                                !!!REMAINING CODE: Customize after careful consideration only!!!
**************************************************************************************************************


**************************************************************************************************************
**************************************************************************************************************
    DEFAULTS
**************************************************************************************************************
**************************************************************************************************************
script requires Inquisit 5.0.0.0 or higher

<defaults>
/ canvasaspectratio = (4,3)
/ minimumversion = "5.0.0.0"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txbgcolor = white
/ txcolor = black
/ inputdevice = mouse
</defaults>

**************************************************************************************************************
**************************************************************************************************************
    DATA
**************************************************************************************************************
**************************************************************************************************************
*************
raw data
*************

<data>
/ separatefiles = true
/ columns = (build, computer.platform, date, time, subject, group, blockcode, blocknum, trialcode, trialnum,
            values.player, values.recipient, response, latency,
            values.count_ignore2)

</data>

*************
summary data: remove variables that are not of interest
*************

<summarydata>
/ columns = (script.startdate, script.starttime, script.subjectid, script.groupid, script.elapsedtime, computer.platform, values.completed,
            parameters.showpictures, parameters.showlabels,
            item.player1.1, item.player1label.1, item.player2.1, item.player2label.1, item.player3.1, item.player3label.1, item.player4.1, item.player4label.1,
            parameters.max_trialcount, values.ignore2_streak1, values.max_ignore2,
            values.count_player1throws, values.count_player3throws, values.count_player4throws, values.count_player2throws, expressions.meanRT_player2,
            values.count_12, expressions.perc_12, values.count_21, expressions.perc_21, expressions.meanRT_21,
            values.count_32, expressions.perc_32, values.count_23, expressions.perc_23, expressions.meanRT_23,
            values.count_42, expressions.perc_42, values.count_24, expressions.perc_24, expressions.meanRT_24,
            expressions.perc_sameplayer, expressions.perc_otherplayer, expressions.meanRT_sameplayer, expressions.meanRT_otherplayer)
/ separatefiles = true
</summarydata>

**************************************************************************************************************
**************************************************************************************************************
    AUTOMATICALLY UPDATED VALUES
**************************************************************************************************************
**************************************************************************************************************
/completed:                            0 = script was not completed; 1 = script was completed (all conditions run)

/player:                            stores the current player (1, 2, 3, 4)
/recipient:                            stores the recipient of the current ball toss (1, 2, 3, 4)

/count_player1throws:                counts the number of times that player 1 gets to throw the ball
/count_player3throws:                counts the number of times that player 3 gets to throw the ball
/count_player4throws:                counts the number of times that player 4 gets to throw the ball
/count_player2throws:                counts the number of times that player 2 (participant) gets to throw the ball

/sumrt_player2:                        sums the latencies of player2 throws (participant)
/sumrt_21:                            sums the latencies of player 2 throws (participant) to player 1
/sumrt_23:                            sums the latencies of player 2 throws (participant) to player 3
/sumrt_24:                            sums the latencies of player 2 throws (participant) to player 4

/count_ignore2:                        counts how often player 2 (participant) was "ignored" before a throw (resets every time
                                    player 2 gets to throw the ball)
/max_ignore2:                        the longest streak of ignoring player 2 in the game that participant experienced
                                    before responding
/ignore2_streak1:                     the ignorestreak before player2 (participant) gets to respond for the first time

/count_12:                            counts the number of times that player 1 throws to player 2 (participant)
/count_32:                            counts the number of times that player 3 throws to player 2 (participant)
/count_13:                            counts the number of times that player 1 throws to player 3
/count_31:                            counts the number of times that player 3 throws to player 1
/count_21:                            counts the number of times that player 2 (participant) throws to player 1
/count_23:                            counts the number of times that player 2 (participant) throws to player 3
/count_41:                            counts the number of times that player 4 throws to player 1
/count_43:                            counts the number of times that player 4 throws to player 3
/count_42:                            counts the number of times that player 4 throws to player 2 (participant)
/count_14:                            counts the number of times that player 1 throws to player 4
/count_24:                            counts the number of times that player 2 (participant) throws to player 4
/count_34:                            counts the number of times that player 3 throws to player 4

/count_121:                            counts how often player2 (participant) throws the ball back to player 1 (after getting it from player 1)
/count_323:                            counts how often player2 (participant) throws the ball back to player 3 (after getting it from player 3)
/count_424:                            counts how often player2 (participant) throws the ball back to player 4 (after getting it from player 4)

/count_123:                            counts how often player2 (participant) throws the ball to player 3 after getting it from player 1
/count_321:                            counts how often player2 (participant) throws the ball to player 1 after getting it from player 3
/count_124:                            counts how often player2 (participant) throws the ball to player 4 after getting it from player 1
/count_324:                            counts how often player2 (participant) throws the ball to player 4 after getting it from player 3
/count_421:                            counts how often player2 (participant) throws the ball to player 1 after getting it from player 4
/count_423:                            counts how often player2 (participant) throws the ball to player 3 after getting it from player 4

/sumrt_121:                            sums latencies for all trials in which player2 (participant) throws the ball back to player 1  (after getting it from player 1)
/sumrt_323:                            sums latencies for all trials in which player2 (participant) throws the ball back to player 3 (after getting it from player 3)
/sumrt_424:                            sums latencies for all trials in which player2 (participant) throws the ball back to player 4 (after getting it from player 4)
/sumrt_123:                            sums latencies for all trials in which player2 (participant) throws the ball to player 3 after getting it from player 1
/sumrt_321:                            sums latencies for all trials in which player2 (participant) throws the ball to player 1 after getting it from player 3
/sumrt_124:                            sums latencies for all trials in which player2 (participant) throws the ball to player 4 after getting it from player 1
/sumrt_324:                            sums latencies for all trials in which player2 (participant) throws the ball to player 4 after getting it from player 3
/sumrt_421:                            sums latencies for all trials in which player2 (participant) throws the ball to player 1 after getting it from player 4
/sumrt_423:                            sums latencies for all trials in which player2 (participant) throws the ball to player 3 after getting it from player 4

<values>
/ completed = 0
/ player = 0
/ recipient = 0

/ count_player1throws = 0
/ count_player3throws = 0
/ count_player4throws = 0
/ count_player2throws = 0

/score1 = 100
/score3 = 100
/score4 = 100

/ sumrt_player2 = 0
/ sumrt_21 = 0
/ sumrt_23 = 0
/ sumrt_24 = 0

/ count_ignore2 = 0
/ max_ignore2 = 0
/ ignore2_streak1 = 0

/ count_12 = 0
/ count_32 = 0
/ count_13 = 0
/ count_31 = 0
/ count_21 = 0
/ count_23 = 0
/ count_14 = 0
/ count_24 = 0
/ count_34 = 0
/ count_41 = 0
/ count_42 = 0
/ count_43 = 0

/ count_121 = 0
/ count_323 = 0
/ count_424 = 0
/ count_123 = 0
/ count_321 = 0
/ count_124 = 0
/ count_324 = 0
/ count_421 = 0
/ count_423 = 0

/ sumrt_121 = 0
/ sumrt_323 = 0
/ sumrt_424 = 0
/ sumrt_123 = 0
/ sumrt_321 = 0
/ sumrt_124 = 0
/ sumrt_324 = 0
/ sumrt_421 = 0
/ sumrt_423 = 0
</values>

**************************************************************************************************************
**************************************************************************************************************
    EXPRESSIONS
**************************************************************************************************************
**************************************************************************************************************
/meanRT_player2:            mean latency of player 2 throws (participant)
/meanRT_21:                    mean latency of player 2 (participant) decisions to throw to player 1
/meanRT_23:                    mean latency of player 2 (participant) decisions to throw to player 3
/meanRT_24:                    mean latency of player 2 (participant) decisions to throw to player 4

/perc_12:                    percentage of player 1 throws that play to player 2 (participant)
/perc_21:                    percentage of player 2 throws (participant) that play to player 1
/perc_32:                    percentage of player 3 throws that play to player 2 (participant)
/perc_23:                    percentage of player 2 throws (participant) that play to player 3
/perc_42:                    percentage of player 4 throws that play to player 2 (participant)
/perc_24:                    percentage of player 2 throws (participant) that play to player 4

/perc_sameplayer:            percentage of player 2 (participant) throws when player 2 throws the ball back to the player who threw the ball to participant
                                Note: random selection would suggest 1/3 of all player 2 throws
/perc_otherplayer:            percentage of player 2 (participant) throws when player 2 throws ball to a player who didn't threw the ball to participant
                                Note: random selection would suggest 2/3 of all player 2 throws

/meanRT_sameplayer:            mean latencies of trials in which player2 (participant) throws ball back to the player who threw the ball to participant
/meanRT_otherplayer:        mean latencies of trials in which player2 (participant) throws ball to a player who didn't threw the ball to participant


<expressions>
/ meanRT_player2 = values.sumrt_player2/values.count_player2throws
/ meanRT_21 = values.sumrt_21/values.count_21
/ meanRT_23 = values.sumrt_23/values.count_23
/ meanRT_24 = values.sumrt_24/values.count_24


/ perc_12 = (values.count_12/values.count_player1throws) * 100
/ perc_21 = (values.count_21/values.count_player2throws) * 100
/ perc_32 = (values.count_32/values.count_player3throws) * 100
/ perc_23 = (values.count_23/values.count_player2throws) * 100
/ perc_42 = (values.count_42/values.count_player4throws) * 100
/ perc_24 = (values.count_24/values.count_player2throws) * 100

/ perc_sameplayer = ((values.count_121 + values.count_323 + values.count_424)/values.count_player2throws) * 100
/ perc_otherplayer = ((values.count_123 + values.count_321 + values.count_124 + + values.count_421 + values.count_324  + values.count_423)/values.count_player2throws) * 100

/ meanRT_sameplayer = (values.sumrt_121 + values.sumrt_323 + values.sumrt_424)/(values.count_121 + values.count_323 + values.count_424)
/ meanRT_otherplayer = (values.sumrt_123 + values.sumrt_321 + values.sumrt_124 + values.sumrt_421 + values.sumrt_324  + values.sumrt_423)/(values.count_123 + values.count_321 + values.count_124 + values.count_421 + values.count_324  + values.count_423)
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    INSTRUCTIONS:
**************************************************************************************************************
**************************************************************************************************************
<text welcome>
/ items = instructions
/ select = 1
/ position = (50%, 40%)
/ fontstyle = ("Arial", 2%, true, false, false, false, 5, 0)
/ txcolor = darkblue
/ valign = top
</text>

<text instructions>
/ items = instructions
/ select = 2
/ position = (50%, 45%)
/ fontstyle = ("Arial", 1.5%)
/ size = (80%, 30%)
/ hjustify = left
/ txcolor = darkblue
/ valign = top
</text>

*************ADDITIONAL STIMULI*****************
<text startlabel>
/ items = ("Start")
/ position = (50%, 80%)
/ fontstyle = ("Arial", 3%, false, false, true, false, 5, 0)
/ txcolor = blue
</text>

<picture cyberball>
/ items = ("cyberball.gif")
/ position = (50%, 10%)
/ size = (20%, 20%)
</picture>

<picture cyberboy>
/ items = ("cyberboy.gif")
/ position = (50%, 30%)
/ size = (20%, 20%)
</picture>

<shape blankscreen>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
</shape>

*************TRIALS & BLOCKS*****************
<trial instructions>
/ stimulusframes = [1=cyberball, cyberboy, welcome, instructions, startlabel]
/ validresponse = (startlabel)
/ responsemessage = (startlabel, blankscreen, 0)
/ recorddata = false
</trial>

<block instructions>
/ trials = [1=instructions; 2=name]
</block>

**************************************************************************************************************
**************************************************************************************************************
    PLAYER STIMULI
**************************************************************************************************************
**************************************************************************************************************

<picture player1>
/ items = player1
/ position = (25%, 53%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>

<text player1label>
/ items = player1label
/ position = (25%, 53%)
/ halign = center
/ valign = top
/ erase = false
</text>

<text player1score>
/ items = ("Taka: <%values.score1 -= values.count_player1throws%>")
/ position = (25%, 58%)
/ halign = center
/ valign = center
/ erase = false
</text>

<picture player2>
/ items = player2
/ position = (50%, 73%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>

<text player2label>
/ items = player2label
/ position = (50%, 73%)
/ valign = top
/ erase = false
</text>

<picture player3>
/ items = player3
/ position = (75%, 53%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>

<text player3label>
/ items = player3label
/ position = (75%, 53%)
/ valign = top
/ erase = false
</text>

<text player3score>
/ items = ("Taka: <%values.score3 -= values.count_player3throws%>")
/ position = (75%, 58%)
/ halign = center
/ valign = center
/ erase = false
</text>

<picture player4>
/ items = player4
/ position = (50%, 30%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>


<text player4label>
/ items = player4label
/ position = (50%, 30%)
/ halign = center
/ valign = top
/ erase = false
</text>

<text player4score>
/ items = ("Taka: <%values.score4 -= values.count_player4throws%>")
/ position = (50%, 35%)
/ halign = center
/ valign = center
/ erase = false
</text>

<picture start>
/ items = ("start.gif")
/ erase = false
/ size = (30%, 32%)
</picture>

**************************************************************************************************************
**************************************************************************************************************
    ANIMATION VIDEOS
**************************************************************************************************************
**************************************************************************************************************
<video 1to2>
/ items = animations
/ select = 1
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 1to2_static>
/ items = animations
/ select = 1
/ size = (30%, 30%)
</picture>

<video 1to3>
/ items = animations
/ select = 2
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 1to3_static>
/ items = animations
/ select = 2
/ size = (30%, 30%)
</picture>

<video 1to4>
/ items = animations
/ select = 3
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 1to4_static>
/ items = animations
/ select = 3
/ size = (30%, 30%)
</picture>

<video 2to1>
/ items = animations
/ select = 4
/ playthrough = true
/ size = (30%, 30%)
</video>

<video 2to3>
/ items = animations
/ select = 5
/ playthrough = true
/ size = (30%, 30%)
</video>

<video 2to4>
/ items = animations
/ select = 6
/ playthrough = true
/ size = (30%, 30%)
</video>

<video 3to1>
/ items = animations
/ select = 7
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 3to1_static>
/ items = animations
/ select = 7
/ size = (30%, 30%)
</picture>

<video 3to2>
/ items = animations
/ select = 8
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 3to2_static>
/ items = animations
/ select = 8
/ size = (30%, 30%)
</picture>

<video 3to4>
/ items = animations
/ select = 9
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 3to4_static>
/ items = animations
/ select = 9
/ size = (30%, 30%)
</picture>

<video 4to1>
/ items = animations
/ select = 10
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 4to1_static>
/ items = animations
/ select = 10
/ size = (30%, 30%)
</picture>

<video 4to2>
/ items = animations
/ select = 11
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 4to2_static>
/ items = animations
/ select = 11
/ size = (30%, 30%)
</picture>

<video 4to3>
/ items = animations
/ select = 12
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 4to3_static>
/ items = animations
/ select = 12
/ size = (30%, 30%)
</picture>

**************************************************************************************************************
**************************************************************************************************************
    SURVEYPAGE: INQUIRIES ABOUT PLAYER
**************************************************************************************************************
**************************************************************************************************************
*you label gets dynamically set during runtime in surveypage.name
<text youlabel>
/ position = (50%, 80%)
/ valign = bottom
/ erase = false
</text>

<textbox name>
/ caption = "Please enter your name"
/ required = true
/ mask = alphabetic
/ position = (30%, 45%)
/ textboxsize = (50%, 5%)
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ responsefontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
</textbox>

<surveypage name>
/ showquestionnumbers = false
/ questions = [1=name]
/ ontrialend = [text.youlabel.item = textbox.name.response]
/ showpagenumbers = false
/ navigationbuttonfontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ navigationbuttonsize = (20%, 5%)
/ nextbuttonposition = (45%, 65%)
</surveypage>

**************************************************************************************************************
**************************************************************************************************************
    MAIN TRIALS
**************************************************************************************************************
**************************************************************************************************************

Note: trial.start always "plays" player 1 - a random selection decides whether player 1 throws to
player 3, player 2 or player 4 (-> list.player1schedule)

<trial start>
/ ontrialbegin = [
    values.player = 1;
    if (parameters.showpictures == true) {
        trial.start.insertstimulusframe(picture.player1, 1);
        trial.start.insertstimulusframe(picture.player2, 1);
        trial.start.insertstimulusframe(picture.player3, 1);
        trial.start.insertstimulusframe(picture.player4, 1)
    };
    if (parameters.showlabels == true) {
        trial.start.insertstimulusframe(text.player1label, 1);
        trial.start.insertstimulusframe(text.player2label, 1);
        trial.start.insertstimulusframe(text.player3label, 1);
        trial.start.insertstimulusframe(text.player4label, 1);
    };
    if (parameters.showlabels == true) {
        trial.start.insertstimulusframe(text.player1score, 1);
        trial.start.insertstimulusframe(text.player3score, 1);
        trial.start.insertstimulusframe(text.player4score, 1);
    };
]
/ stimulusframes = [1=start]
/ validresponse = (noresponse)
/ ontrialend = [
    trial.start.resetstimulusframes();
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0;
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1;
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1;
       
    };
   
]
/ trialduration = 0
/ branch = [
    if (list.player1schedule.currentvalue == 2) {
        trial.1to2;
    } else if (list.player1schedule.currentvalue == 3) {
        trial.1to3;
    } else if (list.player1schedule.currentvalue == 4) {
        trial.1to4;
    };
]
</trial>

Note: trial.1to2 => video shows player 1 throwing the ball to player 2 after expressions.cyberdecisiontime.
Player 2 (= values.player) then has to decide where to throw the ball next (= values.recipient)
<trial 1to2>
/ ontrialbegin = [
    values.player = 2;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    if (values.ignore2_streak1 == 0)
        values.ignore2_streak1 = values.max_ignore2;
    trial.1to2.insertstimulustime(video.1to2, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to2_static]
/ validresponse = (player1, player3, player4, player1label, player3label, player4label)
/ ontrialend = [
    trial.1to2.resetstimulusframes();
    values.sumrt_player2 += trial.1to2.latency;
    if (trial.1to2.response == "player1" || trial.1to2.response == "player1label") {
        values.recipient = 1;
        values.count_player2throws += 1;
        values.count_21 += 1;
        values.sumrt_21 += trial.1to2.latency;
        values.count_121 += 1;
        values.sumrt_121 += trial.1to2.latency;
    } else if (trial.1to2.response == "player3" || trial.1to2.response == "player3label") {
        values.recipient = 3;
        values.count_player2throws += 1;
        values.count_23 += 1;
        values.sumrt_23 += trial.1to2.latency;
        values.count_123 += 1;
        values.sumrt_123 += trial.1to2.latency;
    } else if (trial.1to2.response == "player4" || trial.1to2.response == "player4label") {
        values.recipient = 4;
        values.count_player2throws += 1;
        values.count_24 += 1;
        values.sumrt_24 += trial.1to2.latency;
        values.count_124 += 1;
        values.sumrt_124 += trial.1to2.latency;
    };
]
/ branch = [
    if (values.recipient == 1) {
        trial.2to1
    } else if (values.recipient == 3) {
        trial.2to3
    } else if (values.recipient == 4) {
        trial.2to4;
    };
]
</trial>

Note: trial.1to3 => video shows player 1 throwing the ball to player 3 after expressions.cyberdecisiontime.
Player 3 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player3schedule
<trial 1to3>
/ ontrialbegin = [
    values.player = 3;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2;
    };
    trial.1to3.insertstimulustime(video.1to3, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to3_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.1to3.resetstimulusframes();
    if (list.player3schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player3throws += 1;
        values.score3 -= 1;
        values.count_31 += 1;
        values.count_ignore2 += 1;
    } else if (list.player3schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player3throws += 1;
        values.score3 -= 1;
        values.count_32 += 1;
        values.count_ignore2 = 0;
    } else if (list.player3schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player3throws += 1;
        values.score3 -= 1;
        values.count_34 += 1;
        values.count_ignore2 += 1;
    };
]

/ branch = [
    if (list.player3schedule.currentvalue == 1) {
        trial.3to1;
    } else if (list.player3schedule.currentvalue == 2) {
        trial.3to2;
    } else if (list.player3schedule.currentvalue == 4) {
        trial.3to4;
    }
]
</trial>

Note: trial.1to4 => video shows player 1 throwing the ball to player 4 after expressions.cyberdecisiontime.
Player 4 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player4schedule
<trial 1to4>
/ ontrialbegin = [
    values.player = 4;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2
    };
    trial.1to4.insertstimulustime(video.1to4, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to4_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.1to4.resetstimulusframes();
    if (list.player4schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player4throws += 1;
        values.score4 -= 1;
        values.count_41 += 1;
        values.count_ignore2 += 1;
    } else if (list.player4schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player4throws += 1;
        values.score4 -= 1;
        values.count_42 += 1;
        values.count_ignore2 = 0;
    } else if (list.player4schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player4throws += 1;
        values.score4 -= 1;
        values.count_43 += 1;
        values.count_ignore2 += 1;
    };
]
/ branch = [
    if (list.player4schedule.currentvalue == 1) {
        trial.4to1;
    } else if (list.player4schedule.currentvalue == 2) {
        trial.4to2;
    } else if (list.player4schedule.currentvalue == 3) {
        trial.4to3;
    };
]
</trial>

Note: trial.2to1 => video shows player 2 throwing the ball to player 1.
Player 1 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player1schedule
<trial 2to1>
/ ontrialbegin = [
    values.player = 1;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2;
    };
]
/ stimulusframes = [1= 2to1]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0;
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1;
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1;
    };
]

/ branch = [
    if (list.player1schedule.currentvalue == 2) {
        trial.1to2;
    } else if (list.player1schedule.currentvalue == 3) {
        trial.1to3;
    } else if (list.player1schedule.currentvalue == 4) {
        trial.1to4;
    };
]
</trial>

Note: trial.2to3 => video shows player 2 throwing the ball to player 3.
Player 3 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player3schedule
<trial 2to3>
/ ontrialbegin = [
    values.player = 3;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2;
    };
]
/ stimulusframes = [1= 2to3]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    if (list.player3schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player3throws += 1;
        values.count_31 += 1;
        values.count_ignore2 += 1;
    } else if (list.player3schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player3throws += 1;
        values.count_32 += 1;
        values.count_ignore2 = 0;
    } else if (list.player3schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player3throws += 1;
        values.count_34 += 1;
        values.count_ignore2 += 1;
    };
]
/ branch = [
    if (list.player3schedule.currentvalue == 1) {
        trial.3to1;
    } else if (list.player3schedule.currentvalue == 2) {
        trial.3to2;
    } else if (list.player3schedule.currentvalue == 4) {
        trial.3to4;
    };
]
</trial>

Note: trial.2to4 => video shows player 2 throwing the ball to player 4.
Player 4 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player4schedule
<trial 2to4>
/ ontrialbegin = [values.player = 4]
/ ontrialbegin = [
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
]
/ stimulusframes = [1= 2to4]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    if (list.player4schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player4throws += 1;
        values.count_41 += 1;
        values.count_ignore2 += 1
    } else if (list.player4schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player4throws += 1;
        values.count_42 += 1;
        values.count_ignore2 = 0
    } else if (list.player4schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player4throws += 1;
        values.count_43 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player4schedule.currentvalue == 1)
        trial.4to1;
    else if (list.player4schedule.currentvalue == 2)
        trial.4to2;
    else if (list.player4schedule.currentvalue == 3)
        trial.4to3;
]
</trial>

Note: trial.3to2 => video shows player 3 throwing the ball to player 2 after expressions.cyberdecisiontime.
Player 2 (= values.player) then has to decide where to throw the ball next (= values.recipient)
<trial 3to2>
/ ontrialbegin = [
    values.player = 2;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    if (values.ignore2_streak1 == 0)
        values.ignore2_streak1 = values.max_ignore2;
    trial.3to2.insertstimulustime(video.3to2, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 3to2_static]
/ validresponse = (player1, player3, player4, player1label, player3label, player4label)
/ ontrialend = [
    trial.3to2.resetstimulusframes();
    values.sumrt_player2 += trial.3to2.latency;
    if (trial.3to2.response == "player1" || trial.3to2.response == "player1label") {
        values.recipient = 1;
        values.count_player2throws += 1;
        values.count_21 += 1;
        values.sumrt_21 += trial.3to2.latency;
        values.count_321 += 1;
        values.sumrt_321 += trial.3to2.latency
    } else if (trial.3to2.response == "player3" || trial.3to2.response == "player3label") {
        values.recipient = 3;
        values.count_player2throws += 1;
        values.count_23 += 1;
        values.sumrt_23 += trial.3to2.latency;
        values.count_323 += 1;
        values.sumrt_323 += trial.3to2.latency
    } else if (trial.3to2.response == "player4" || trial.3to2.response == "player4label") {
        values.recipient = 4;
        values.count_player2throws += 1;
        values.count_24 += 1;
        values.sumrt_24 += trial.3to2.latency;
        values.count_324 += 1;
        values.sumrt_324 += trial.3to2.latency
    };
]
/ branch = [
    if (values.recipient == 1)
        trial.2to1
    else if (values.recipient == 3)
        trial.2to3
    else if (values.recipient == 4)
        trial.2to4
]
</trial>

Note: trial.3to1=> video shows player 3 throwing the ball to player 1 after expressions.cyberdecisiontime.
Player 1 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player1schedule
<trial 3to1>
/ ontrialbegin = [
    values.player = 1;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.3to1.insertstimulustime(video.3to1, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 3to1_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.3to1.resetstimulusframes();
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player1schedule.currentvalue == 2)
        trial.1to2
    else if (list.player1schedule.currentvalue == 3)
        trial.1to3
    else if (list.player1schedule.currentvalue == 4)
        trial.1to4
]
</trial>

Note: trial.3to4=> video shows player 3 throwing the ball to player 4 after expressions.cyberdecisiontime.
Player 4 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player4schedule
<trial 3to4>
/ ontrialbegin = [
    values.player = 4;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.3to4.insertstimulustime(video.3to4, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 3to4_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.3to4.resetstimulusframes();
    if (list.player4schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player4throws += 1;
        values.count_41 += 1;
        values.count_ignore2 += 1
    } else if (list.player4schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player4throws += 1;
        values.count_42 += 1;
        values.count_ignore2 = 0
    } else if (list.player4schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player4throws += 1;
        values.count_43 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player4schedule.currentvalue == 1)
        trial.4to1
    else if (list.player4schedule.currentvalue == 2)
        trial.4to2
    else if (list.player4schedule.currentvalue == 3)
        trial.4to3
]
</trial>

Note: trial.4to2 => video shows player 4 throwing the ball to player 2 after expressions.cyberdecisiontime.
Player 2 (= values.player) then has to decide where to throw the ball next (= values.recipient)
<trial 4to2>
/ ontrialbegin = [
    values.player = 2;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    if (values.ignore2_streak1 == 0)
        values.ignore2_streak1 = values.max_ignore2;
    trial.4to2.insertstimulustime(video.4to2, expressions.cyberdecisiontime);
]

/ stimulusframes = [1= 4to2_static]
/ validresponse = (player1, player3, player4, player1label, player3label, player4label)
/ ontrialend = [values.sumrt_player2 += trial.4to2.latency]
/ ontrialend = [
    trial.4to2.resetstimulusframes();
    if (trial.4to2.response == "player1" || trial.4to2.response == "player1label") {
        values.recipient = 1;
        values.count_player2throws += 1;
        values.count_21 += 1;
        values.sumrt_21 += trial.4to2.latency;
        values.count_421 += 1;
        values.sumrt_421 += trial.4to2.latency
    } else if (trial.4to2.response == "player3" || trial.4to2.response == "player3label") {
        values.recipient = 3;
        values.count_player2throws += 1;
        values.count_23 += 1;
        values.sumrt_23 += trial.4to2.latency;
        values.count_423 += 1;
        values.sumrt_423 += trial.4to2.latency
    } else if (trial.4to2.response == "player4" || trial.4to2.response == "player4label") {
        values.recipient = 4;
        values.count_player2throws += 1;
        values.count_24 += 1;
        values.sumrt_24 += trial.4to2.latency;
        values.count_424 += 1;
        values.sumrt_424 += trial.4to2.latency
    };
]
/ branch = [
    if (values.recipient == 1)
        trial.2to1
    else if (values.recipient == 3)
        trial.2to3
    else if (values.recipient == 4)
        trial.2to4
]
</trial>

Note: trial.4to1=> video shows player 4 throwing the ball to player 1 after expressions.cyberdecisiontime.
Player 1 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player1schedule
<trial 4to1>
/ ontrialbegin = [
    values.player = 1;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.4to1.insertstimulustime(video.4to1, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 4to1_static]
/ validresponse = (noresponse)
/ ontrialend = [
    trial.4to1.resetstimulusframes();
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1
    };
]
/ trialduration = expressions.cyberdecisiontime
/ branch = [
    if (list.player1schedule.currentvalue == 2)
        trial.1to2
    else if (list.player1schedule.currentvalue == 3)
        trial.1to3
    else if (list.player1schedule.currentvalue == 4)
        trial.1to4
]
</trial>

Note: trial.4to3=> video shows player 4 throwing the ball to player 3 after expressions.cyberdecisiontime.
Player 3 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player3schedule
<trial 4to3>
/ ontrialbegin = [
    values.player = 3;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.4to3.insertstimulustime(video.4to3, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 4to3_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.4to3.resetstimulusframes();
    if (list.player3schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player3throws += 1;
        values.count_31 += 1;
        values.count_ignore2 += 1
    } else if (list.player3schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player3throws += 1;
        values.count_32 += 1;
        values.count_ignore2 = 0
    } else if (list.player3schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player3throws += 1;
        values.count_34 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player3schedule.currentvalue == 1)
        trial.3to1
    else if (list.player3schedule.currentvalue == 2)
        trial.3to2
    else if (list.player3schedule.currentvalue == 4)
        trial.3to4
]
</trial>

**************************************************************************************************************
**************************************************************************************************************
    BLOCK
**************************************************************************************************************
**************************************************************************************************************
<block game>
/ trials = [1 = start]
/ stop = [block.game.trialcount >= parameters.max_trialcount]
</block>

**************************************************************************************************************
**************************************************************************************************************
    EXPERIMENT
**************************************************************************************************************
**************************************************************************************************************
<expt main>
/ blocks = [
    1=instructions;
    2=game;
]
/ onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************
                                        End of Script
**************************************************************************************************************

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: 12K, Visits: 98K

pn_dc5 - 7/29/2019
Hello,

I am trying to customize an existing experiment (4 person cyberball) such that the user is shown each non-human player's cumulative total number of tosses (as a score) each time the ball is passed around. I've added code to show a "score" and have created values for the score that are set to increase by 1 each time the player receives the ball (values.count_player2throws += 1, etc;). However, I can't quite figure out how to get inquisit to update the stimulus screen such that the new score is shown to them. I'm fairly new to the program and am assuming that the problem has something to do with the ontrialstart/ontrialend commands(?) I think that the value of the counter is updating correctly, but just can't figure out how to then show that updated counter after each pass of the ball on the stimulus screen.

I've looked around at other posts asking how to add a counter, how to show a clock, etc (which is how I've gotten to where I'm at now) but am otherwise stumped. Any help would be greatly appreciated!  



<usermanual>
                       
                                    Cyberball: 4 PLAYERS
SCRIPT INFO
xf
Script Author: Sean Draine, PhD
last updated:  10-25-2018 by K. Borchert (katjab@millisecond.com) for Millisecond Software, LLC

Script Copyright ©  10-25-2018 Millisecond Software


BACKGROUND INFO

                                            *Purpose*
This script implements the Cyberball paradigm based on:

Williams, K. D., Cheung, C. K. T., & Choi, W. (2000). CyberOstracism: Effects of being ignored over
the Internet. Journal of Personality and Social Psychology, 79, 748-762.

Williams, K. D., & Jarvis, B. (2006). Cyberball: A program for use in research on ostracism and interpersonal
acceptance. Behavior Research Methods, Instruments, and Computers, 38, 174-180.

see also: http://www1.psych.purdue.edu/~willia55/Announce/cyberball.htm

                                              *Task*
Participant plays ball with 3 other participants (= the computer). It can be predefined with what
probability the computer includes/excludes the participant into the ball game.


DATA FILE INFORMATION:
The default data stored in the data files are:

(1) Raw data file: '4PlayerCyberball_raw*.iqdat' (a separate file for each participant)

build:                            Inquisit build
computer.platform:                the platform the script was run on
date, time, subject, group:        date and time script was run with the current subject/groupnumber
blockcode, blocknum:            the name and number of the current block
trialcode, trialnum:             the name and number of the currently recorded trial
                                    (Note: not all trials that are run might record data)
                                Trialcode Explanation:
                                Examples:
                                    "1to2" => in this trial player 2 (participant) throws the ball AFTER getting it from player 1
                                    "1to3" => in this trial player 3 throws the ball AFTER getting it from player 1 (random selection decides whether player 3 throws to player 1)
/player:                        stores the current player
/recipient:                        stores the recipient of the current ball toss (1, 2, 3, 4)                               
response:                        the (participant's) response
latency:                         the response latency in ms (for trials in which player 1 and 3 "play", the latency
                                is the randomly selected trialduration)
/count_ignore2:                    counts how often player 2 (participant) was "ignored" before a throw (resets every time
                                player 2 gets to throw the ball)

(2) Summary data file: '4PlayerCyberball_summary*.iqdat' (a separate file for each participant)

script.startdate:                date script was run
script.starttime:                time script was started
script.subjectid:                subject id number
script.groupid:                    group id number
script.elapsedtime:                time it took to run script (in ms)
computer.platform:                the platform the script was run on
/completed:                        0 = script was not completed (prematurely aborted); 1 = script was completed (all conditions run)
/showpictures:                    true = pictures of players are onscreen (default)
                                false = no pictures are presented
/showlabels:                    true = labels of players are onscreen (default)
                                false = no labels are presented

item.player1.1-
item.player4label.1:            images and labels used for the various players

/max_trialcount:                maximum number of trials (= passes between all players) played       

/ignore2_streak1:                 the number of times player 2 (participant) was ignored before player2 (participant) gets to respond for the first time
/max_ignore2:                    the longest streak of ignoring player 2 (participant) in the game that participant experienced
                                before being able to respond

/count_player2throws:            counts the number of times that player 1 gets to throw the ball
/count_player2throws:            counts the number of times that player 3 gets to throw the ball
/count_player2throws:            counts the number of times that player 2 (participant) gets to throw the ball
/meanRT_player2:                mean latency (in ms) of player 2 (participant)

/count_12:                        counts the number of times that player 1 throws to player 2 (participant)
/perc_12:                        percentage of player 1 throws that play to player 2 (participant)
/count_21:                        counts the number of times that player 2 (participant) throws to player 1
/perc_21:                        percentage of player 2 throws (participant) that play to player 1
/meanRT_21:                        mean latency (in ms) of player 2 (participant) decisions to throw to player 1

(same for player 3 and 4)

/perc_sameplayer:                percentage of player 2 (participant) throws when player 2 throws the ball back to the player who threw the ball to participant
                                        Note: random selection -> 1/3 times of all player 2 throws
/perc_otherplayer:                percentage of player 2 (participant) throws when player 2 throws ball to the player who didn't threw the ball to participant
                                        Note: random selection -> 2/3 times of all player 2 throws
/meanRT_sameplayer:                mean latency (in ms) of trials in which player2 (participant) throws ball back to the player who threw the ball to participant
/meanRT_otherplayer:            mean latency (in ms) of trials in which player2 (participant) throws ball to a player who didn't threw the ball to participant



EXPERIMENTAL SET-UP
* Participant plays ball with 3 other players for 50 trials.
The number of trials can be edited under section EDITABLE PARAMETERS.

* By default, all players are represented by names and pictures.
Names and pictures can be edited under section EDITABLE STIMULI.
To remove names or pictures go to EDITABLE PARAMETERS.

* By default, player 1 throws the ball to participant (=player2)  with a pre-determined probability (default: 14% of the times)
as does Player 3 and 4 (default: 14% of the times). The probabilities can be edited under EDITABLE LISTS.
The player schedules can further be customized to dictate specific/fixed throw sequences for each of the
"computer player".Go to section EDITABLE LISTS for further instructions.

* Decision Times for Player 1,3 and 4 are controlled by expressions.cyberdecisiontime under
EDITABLE PARAMETERS.

STIMULI
picture examples are provided by Millisecond Software. They can easily be edited under section
Editable Stimuli

INSTRUCTIONS
can be edited under section Editable Instructions

EDITABLE CODE:
check below for (relatively) easily editable parameters, stimuli, instructions etc.
Keep in mind that you can use this script as a template and therefore always "mess" with the entire code to further customize your experiment.

The parameters you can change are:

/max_trialcount:    maximum number of trials (= passes between the players) played       
/showpictures:        true = pictures of players are onscreen (default)
                    false = no pictures are presented
/showlabels:        true = labels of players are onscreen (default)
                    false = no labels are presented
                       
NOTE: parameters.showpictures and parameters.showlabels cannot be set to false at the same time.

/ cyberdecisiontime:         selects without replacement (noreplace) one of the 4 decision times for players1,3 and 4

</usermanual>


**************************************************************************************************************
**************************************************************************************************************
    EDITABLE PARAMETERS: change editable parameters here
**************************************************************************************************************
**************************************************************************************************************

<parameters>
/ max_trialcount = 10
/ showpictures = true
/ showlabels = true
</parameters>


<expressions>
/ cyberdecisiontime = noreplace(500, 1000, 1500, 2000)
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE STIMULI: change editable stimuli here
**************************************************************************************************************
**************************************************************************************************************

***********************
Player Pictures
***********************
<item player1>
/ 1 = "cassie.jpg"
</item>

<item player2>
/ 1 = "kip.jpg"
</item>

<item player3>
/ 1 = "trevor.jpg"
</item>

<item player4>
/ 1 = "sean.jpg"
</item>
***********************
Player Labels
***********************

<item player1label>
/ 1 = "Cassie"
</item>

<item player3label>
/ 1 = "Trevor"
</item>

<item player4label>
/ 1 = "Sean"
</item>

fills in automatically:
<item player2label>
/ 1 = "<%capitalize(textbox.name.response)%>"
</item>

***********************
Animation Movies
***********************
<item animations>
/ 1 = "1to2.gif"
/ 2 = "1to3.gif"
/ 3 = "1to4.gif"
/ 4 = "2to1.gif"
/ 5 = "2to3.gif"
/ 6 = "2to4.gif"
/ 7 = "3to1.gif"
/ 8 = "3to2.gif"
/ 9 = "3to4.gif"
/ 10 = "4to1.gif"
/ 11 = "4to2.gif"
/ 12 = "4to3.gif"
</item>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE INSTRUCTIONS: change instructions here
**************************************************************************************************************
**************************************************************************************************************

<item instructions>
/ 1 = "Welcome to Cyberball, the Interactive Ball-Tossing Game Used for Mental Visualization!"

/ 2 = "In the upcoming experiment, we test the effects of practicing mental visualization on task performance. Thus, we need you to practice your mental visualization skills. We have found that the best way to do this is to have you play an on-line ball tossing game with other participants who are logged on at the same time.

In a few moments, you will be playing a ball tossing game with other students over our network. The game is very simple. When the ball is tossed to you, simply <%expressions.buttoninstruct2%> the player you want to throw it to.

What is important is not your ball tossing performance, but that you MENTALLY visualize the entire experience. Imagine what the others look like. What sort of people are they? Where are you playing? Is it warm and sunny or cold and rainy? Create in your mind a complete mental picture of what might be going on if you were playing this game in real life.

Okay, ready to begin? Please <%expressions.buttoninstruct1%> 'Start' to begin."
</item>

****************************************************************************************************
general instruction expressions: adjust the instruction text depending on device used to run script
****************************************************************************************************
<expressions>
/ buttoninstruct1 = if (computer.touch && !computer.haskeyboard) {"Touch";} else {"click";}
/ buttoninstruct2 = if (computer.touch && !computer.haskeyboard) {"touch";} else {"click on";}
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE LISTS: change editable lists here
**************************************************************************************************************
**************************************************************************************************************

Note: by default players 1, 3 and 4 throw to player 2 roughly 14% of the time (1 out 7 times)

The item lists of these schedules can be further controlled by setting a specific/fixed throw sequence:
Example Player 1:

/items = (3, 4, 2, 3, 4, 4, 3, 3, 4, 4, 4, 3, 3, 2, 3, 2, 4, 2, 3, 3, 4, 4, 3, 3, 4)
/selectionmode = sequence

(if selectionmode = sequence => it is suggested to create the list as long as (parameters.max_trialcount/2)
to ensure that the beginning of the list does NOT get repeated)

<list player1schedule>
/ items = (3, 3, 3, 3, 3, 3, 2, 4)
/ replace = false
</list>

<list player3schedule>
/ items = (1, 1, 4, 4, 2, 2)
/ replace = false
</list>

<list player4schedule>
/ items = (3, 3, 3, 3, 3, 3, 2, 1)
/ replace = false
</list>

**************************************************************************************************************
                                !!!REMAINING CODE: Customize after careful consideration only!!!
**************************************************************************************************************


**************************************************************************************************************
**************************************************************************************************************
    DEFAULTS
**************************************************************************************************************
**************************************************************************************************************
script requires Inquisit 5.0.0.0 or higher

<defaults>
/ canvasaspectratio = (4,3)
/ minimumversion = "5.0.0.0"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txbgcolor = white
/ txcolor = black
/ inputdevice = mouse
</defaults>

**************************************************************************************************************
**************************************************************************************************************
    DATA
**************************************************************************************************************
**************************************************************************************************************
*************
raw data
*************

<data>
/ separatefiles = true
/ columns = (build, computer.platform, date, time, subject, group, blockcode, blocknum, trialcode, trialnum,
            values.player, values.recipient, response, latency,
            values.count_ignore2)

</data>

*************
summary data: remove variables that are not of interest
*************

<summarydata>
/ columns = (script.startdate, script.starttime, script.subjectid, script.groupid, script.elapsedtime, computer.platform, values.completed,
            parameters.showpictures, parameters.showlabels,
            item.player1.1, item.player1label.1, item.player2.1, item.player2label.1, item.player3.1, item.player3label.1, item.player4.1, item.player4label.1,
            parameters.max_trialcount, values.ignore2_streak1, values.max_ignore2,
            values.count_player1throws, values.count_player3throws, values.count_player4throws, values.count_player2throws, expressions.meanRT_player2,
            values.count_12, expressions.perc_12, values.count_21, expressions.perc_21, expressions.meanRT_21,
            values.count_32, expressions.perc_32, values.count_23, expressions.perc_23, expressions.meanRT_23,
            values.count_42, expressions.perc_42, values.count_24, expressions.perc_24, expressions.meanRT_24,
            expressions.perc_sameplayer, expressions.perc_otherplayer, expressions.meanRT_sameplayer, expressions.meanRT_otherplayer)
/ separatefiles = true
</summarydata>

**************************************************************************************************************
**************************************************************************************************************
    AUTOMATICALLY UPDATED VALUES
**************************************************************************************************************
**************************************************************************************************************
/completed:                            0 = script was not completed; 1 = script was completed (all conditions run)

/player:                            stores the current player (1, 2, 3, 4)
/recipient:                            stores the recipient of the current ball toss (1, 2, 3, 4)

/count_player1throws:                counts the number of times that player 1 gets to throw the ball
/count_player3throws:                counts the number of times that player 3 gets to throw the ball
/count_player4throws:                counts the number of times that player 4 gets to throw the ball
/count_player2throws:                counts the number of times that player 2 (participant) gets to throw the ball

/sumrt_player2:                        sums the latencies of player2 throws (participant)
/sumrt_21:                            sums the latencies of player 2 throws (participant) to player 1
/sumrt_23:                            sums the latencies of player 2 throws (participant) to player 3
/sumrt_24:                            sums the latencies of player 2 throws (participant) to player 4

/count_ignore2:                        counts how often player 2 (participant) was "ignored" before a throw (resets every time
                                    player 2 gets to throw the ball)
/max_ignore2:                        the longest streak of ignoring player 2 in the game that participant experienced
                                    before responding
/ignore2_streak1:                     the ignorestreak before player2 (participant) gets to respond for the first time

/count_12:                            counts the number of times that player 1 throws to player 2 (participant)
/count_32:                            counts the number of times that player 3 throws to player 2 (participant)
/count_13:                            counts the number of times that player 1 throws to player 3
/count_31:                            counts the number of times that player 3 throws to player 1
/count_21:                            counts the number of times that player 2 (participant) throws to player 1
/count_23:                            counts the number of times that player 2 (participant) throws to player 3
/count_41:                            counts the number of times that player 4 throws to player 1
/count_43:                            counts the number of times that player 4 throws to player 3
/count_42:                            counts the number of times that player 4 throws to player 2 (participant)
/count_14:                            counts the number of times that player 1 throws to player 4
/count_24:                            counts the number of times that player 2 (participant) throws to player 4
/count_34:                            counts the number of times that player 3 throws to player 4

/count_121:                            counts how often player2 (participant) throws the ball back to player 1 (after getting it from player 1)
/count_323:                            counts how often player2 (participant) throws the ball back to player 3 (after getting it from player 3)
/count_424:                            counts how often player2 (participant) throws the ball back to player 4 (after getting it from player 4)

/count_123:                            counts how often player2 (participant) throws the ball to player 3 after getting it from player 1
/count_321:                            counts how often player2 (participant) throws the ball to player 1 after getting it from player 3
/count_124:                            counts how often player2 (participant) throws the ball to player 4 after getting it from player 1
/count_324:                            counts how often player2 (participant) throws the ball to player 4 after getting it from player 3
/count_421:                            counts how often player2 (participant) throws the ball to player 1 after getting it from player 4
/count_423:                            counts how often player2 (participant) throws the ball to player 3 after getting it from player 4

/sumrt_121:                            sums latencies for all trials in which player2 (participant) throws the ball back to player 1  (after getting it from player 1)
/sumrt_323:                            sums latencies for all trials in which player2 (participant) throws the ball back to player 3 (after getting it from player 3)
/sumrt_424:                            sums latencies for all trials in which player2 (participant) throws the ball back to player 4 (after getting it from player 4)
/sumrt_123:                            sums latencies for all trials in which player2 (participant) throws the ball to player 3 after getting it from player 1
/sumrt_321:                            sums latencies for all trials in which player2 (participant) throws the ball to player 1 after getting it from player 3
/sumrt_124:                            sums latencies for all trials in which player2 (participant) throws the ball to player 4 after getting it from player 1
/sumrt_324:                            sums latencies for all trials in which player2 (participant) throws the ball to player 4 after getting it from player 3
/sumrt_421:                            sums latencies for all trials in which player2 (participant) throws the ball to player 1 after getting it from player 4
/sumrt_423:                            sums latencies for all trials in which player2 (participant) throws the ball to player 3 after getting it from player 4

<values>
/ completed = 0
/ player = 0
/ recipient = 0

/ count_player1throws = 0
/ count_player3throws = 0
/ count_player4throws = 0
/ count_player2throws = 0

/score1 = 100
/score3 = 100
/score4 = 100

/ sumrt_player2 = 0
/ sumrt_21 = 0
/ sumrt_23 = 0
/ sumrt_24 = 0

/ count_ignore2 = 0
/ max_ignore2 = 0
/ ignore2_streak1 = 0

/ count_12 = 0
/ count_32 = 0
/ count_13 = 0
/ count_31 = 0
/ count_21 = 0
/ count_23 = 0
/ count_14 = 0
/ count_24 = 0
/ count_34 = 0
/ count_41 = 0
/ count_42 = 0
/ count_43 = 0

/ count_121 = 0
/ count_323 = 0
/ count_424 = 0
/ count_123 = 0
/ count_321 = 0
/ count_124 = 0
/ count_324 = 0
/ count_421 = 0
/ count_423 = 0

/ sumrt_121 = 0
/ sumrt_323 = 0
/ sumrt_424 = 0
/ sumrt_123 = 0
/ sumrt_321 = 0
/ sumrt_124 = 0
/ sumrt_324 = 0
/ sumrt_421 = 0
/ sumrt_423 = 0
</values>

**************************************************************************************************************
**************************************************************************************************************
    EXPRESSIONS
**************************************************************************************************************
**************************************************************************************************************
/meanRT_player2:            mean latency of player 2 throws (participant)
/meanRT_21:                    mean latency of player 2 (participant) decisions to throw to player 1
/meanRT_23:                    mean latency of player 2 (participant) decisions to throw to player 3
/meanRT_24:                    mean latency of player 2 (participant) decisions to throw to player 4

/perc_12:                    percentage of player 1 throws that play to player 2 (participant)
/perc_21:                    percentage of player 2 throws (participant) that play to player 1
/perc_32:                    percentage of player 3 throws that play to player 2 (participant)
/perc_23:                    percentage of player 2 throws (participant) that play to player 3
/perc_42:                    percentage of player 4 throws that play to player 2 (participant)
/perc_24:                    percentage of player 2 throws (participant) that play to player 4

/perc_sameplayer:            percentage of player 2 (participant) throws when player 2 throws the ball back to the player who threw the ball to participant
                                Note: random selection would suggest 1/3 of all player 2 throws
/perc_otherplayer:            percentage of player 2 (participant) throws when player 2 throws ball to a player who didn't threw the ball to participant
                                Note: random selection would suggest 2/3 of all player 2 throws

/meanRT_sameplayer:            mean latencies of trials in which player2 (participant) throws ball back to the player who threw the ball to participant
/meanRT_otherplayer:        mean latencies of trials in which player2 (participant) throws ball to a player who didn't threw the ball to participant


<expressions>
/ meanRT_player2 = values.sumrt_player2/values.count_player2throws
/ meanRT_21 = values.sumrt_21/values.count_21
/ meanRT_23 = values.sumrt_23/values.count_23
/ meanRT_24 = values.sumrt_24/values.count_24


/ perc_12 = (values.count_12/values.count_player1throws) * 100
/ perc_21 = (values.count_21/values.count_player2throws) * 100
/ perc_32 = (values.count_32/values.count_player3throws) * 100
/ perc_23 = (values.count_23/values.count_player2throws) * 100
/ perc_42 = (values.count_42/values.count_player4throws) * 100
/ perc_24 = (values.count_24/values.count_player2throws) * 100

/ perc_sameplayer = ((values.count_121 + values.count_323 + values.count_424)/values.count_player2throws) * 100
/ perc_otherplayer = ((values.count_123 + values.count_321 + values.count_124 + + values.count_421 + values.count_324  + values.count_423)/values.count_player2throws) * 100

/ meanRT_sameplayer = (values.sumrt_121 + values.sumrt_323 + values.sumrt_424)/(values.count_121 + values.count_323 + values.count_424)
/ meanRT_otherplayer = (values.sumrt_123 + values.sumrt_321 + values.sumrt_124 + values.sumrt_421 + values.sumrt_324  + values.sumrt_423)/(values.count_123 + values.count_321 + values.count_124 + values.count_421 + values.count_324  + values.count_423)
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    INSTRUCTIONS:
**************************************************************************************************************
**************************************************************************************************************
<text welcome>
/ items = instructions
/ select = 1
/ position = (50%, 40%)
/ fontstyle = ("Arial", 2%, true, false, false, false, 5, 0)
/ txcolor = darkblue
/ valign = top
</text>

<text instructions>
/ items = instructions
/ select = 2
/ position = (50%, 45%)
/ fontstyle = ("Arial", 1.5%)
/ size = (80%, 30%)
/ hjustify = left
/ txcolor = darkblue
/ valign = top
</text>

*************ADDITIONAL STIMULI*****************
<text startlabel>
/ items = ("Start")
/ position = (50%, 80%)
/ fontstyle = ("Arial", 3%, false, false, true, false, 5, 0)
/ txcolor = blue
</text>

<picture cyberball>
/ items = ("cyberball.gif")
/ position = (50%, 10%)
/ size = (20%, 20%)
</picture>

<picture cyberboy>
/ items = ("cyberboy.gif")
/ position = (50%, 30%)
/ size = (20%, 20%)
</picture>

<shape blankscreen>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
</shape>

*************TRIALS & BLOCKS*****************
<trial instructions>
/ stimulusframes = [1=cyberball, cyberboy, welcome, instructions, startlabel]
/ validresponse = (startlabel)
/ responsemessage = (startlabel, blankscreen, 0)
/ recorddata = false
</trial>

<block instructions>
/ trials = [1=instructions; 2=name]
</block>

**************************************************************************************************************
**************************************************************************************************************
    PLAYER STIMULI
**************************************************************************************************************
**************************************************************************************************************

<picture player1>
/ items = player1
/ position = (25%, 53%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>

<text player1label>
/ items = player1label
/ position = (25%, 53%)
/ halign = center
/ valign = top
/ erase = false
</text>

<text player1score>
/ items = ("Taka: <%values.score1 -= values.count_player1throws%>")
/ position = (25%, 58%)
/ halign = center
/ valign = center
/ erase = false
</text>

<picture player2>
/ items = player2
/ position = (50%, 73%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>

<text player2label>
/ items = player2label
/ position = (50%, 73%)
/ valign = top
/ erase = false
</text>

<picture player3>
/ items = player3
/ position = (75%, 53%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>

<text player3label>
/ items = player3label
/ position = (75%, 53%)
/ valign = top
/ erase = false
</text>

<text player3score>
/ items = ("Taka: <%values.score3 -= values.count_player3throws%>")
/ position = (75%, 58%)
/ halign = center
/ valign = center
/ erase = false
</text>

<picture player4>
/ items = player4
/ position = (50%, 30%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>


<text player4label>
/ items = player4label
/ position = (50%, 30%)
/ halign = center
/ valign = top
/ erase = false
</text>

<text player4score>
/ items = ("Taka: <%values.score4 -= values.count_player4throws%>")
/ position = (50%, 35%)
/ halign = center
/ valign = center
/ erase = false
</text>

<picture start>
/ items = ("start.gif")
/ erase = false
/ size = (30%, 32%)
</picture>

**************************************************************************************************************
**************************************************************************************************************
    ANIMATION VIDEOS
**************************************************************************************************************
**************************************************************************************************************
<video 1to2>
/ items = animations
/ select = 1
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 1to2_static>
/ items = animations
/ select = 1
/ size = (30%, 30%)
</picture>

<video 1to3>
/ items = animations
/ select = 2
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 1to3_static>
/ items = animations
/ select = 2
/ size = (30%, 30%)
</picture>

<video 1to4>
/ items = animations
/ select = 3
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 1to4_static>
/ items = animations
/ select = 3
/ size = (30%, 30%)
</picture>

<video 2to1>
/ items = animations
/ select = 4
/ playthrough = true
/ size = (30%, 30%)
</video>

<video 2to3>
/ items = animations
/ select = 5
/ playthrough = true
/ size = (30%, 30%)
</video>

<video 2to4>
/ items = animations
/ select = 6
/ playthrough = true
/ size = (30%, 30%)
</video>

<video 3to1>
/ items = animations
/ select = 7
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 3to1_static>
/ items = animations
/ select = 7
/ size = (30%, 30%)
</picture>

<video 3to2>
/ items = animations
/ select = 8
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 3to2_static>
/ items = animations
/ select = 8
/ size = (30%, 30%)
</picture>

<video 3to4>
/ items = animations
/ select = 9
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 3to4_static>
/ items = animations
/ select = 9
/ size = (30%, 30%)
</picture>

<video 4to1>
/ items = animations
/ select = 10
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 4to1_static>
/ items = animations
/ select = 10
/ size = (30%, 30%)
</picture>

<video 4to2>
/ items = animations
/ select = 11
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 4to2_static>
/ items = animations
/ select = 11
/ size = (30%, 30%)
</picture>

<video 4to3>
/ items = animations
/ select = 12
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 4to3_static>
/ items = animations
/ select = 12
/ size = (30%, 30%)
</picture>

**************************************************************************************************************
**************************************************************************************************************
    SURVEYPAGE: INQUIRIES ABOUT PLAYER
**************************************************************************************************************
**************************************************************************************************************
*you label gets dynamically set during runtime in surveypage.name
<text youlabel>
/ position = (50%, 80%)
/ valign = bottom
/ erase = false
</text>

<textbox name>
/ caption = "Please enter your name"
/ required = true
/ mask = alphabetic
/ position = (30%, 45%)
/ textboxsize = (50%, 5%)
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ responsefontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
</textbox>

<surveypage name>
/ showquestionnumbers = false
/ questions = [1=name]
/ ontrialend = [text.youlabel.item = textbox.name.response]
/ showpagenumbers = false
/ navigationbuttonfontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ navigationbuttonsize = (20%, 5%)
/ nextbuttonposition = (45%, 65%)
</surveypage>

**************************************************************************************************************
**************************************************************************************************************
    MAIN TRIALS
**************************************************************************************************************
**************************************************************************************************************

Note: trial.start always "plays" player 1 - a random selection decides whether player 1 throws to
player 3, player 2 or player 4 (-> list.player1schedule)

<trial start>
/ ontrialbegin = [
    values.player = 1;
    if (parameters.showpictures == true) {
        trial.start.insertstimulusframe(picture.player1, 1);
        trial.start.insertstimulusframe(picture.player2, 1);
        trial.start.insertstimulusframe(picture.player3, 1);
        trial.start.insertstimulusframe(picture.player4, 1)
    };
    if (parameters.showlabels == true) {
        trial.start.insertstimulusframe(text.player1label, 1);
        trial.start.insertstimulusframe(text.player2label, 1);
        trial.start.insertstimulusframe(text.player3label, 1);
        trial.start.insertstimulusframe(text.player4label, 1);
    };
    if (parameters.showlabels == true) {
        trial.start.insertstimulusframe(text.player1score, 1);
        trial.start.insertstimulusframe(text.player3score, 1);
        trial.start.insertstimulusframe(text.player4score, 1);
    };
]
/ stimulusframes = [1=start]
/ validresponse = (noresponse)
/ ontrialend = [
    trial.start.resetstimulusframes();
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0;
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1;
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1;
       
    };
   
]
/ trialduration = 0
/ branch = [
    if (list.player1schedule.currentvalue == 2) {
        trial.1to2;
    } else if (list.player1schedule.currentvalue == 3) {
        trial.1to3;
    } else if (list.player1schedule.currentvalue == 4) {
        trial.1to4;
    };
]
</trial>

Note: trial.1to2 => video shows player 1 throwing the ball to player 2 after expressions.cyberdecisiontime.
Player 2 (= values.player) then has to decide where to throw the ball next (= values.recipient)
<trial 1to2>
/ ontrialbegin = [
    values.player = 2;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    if (values.ignore2_streak1 == 0)
        values.ignore2_streak1 = values.max_ignore2;
    trial.1to2.insertstimulustime(video.1to2, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to2_static]
/ validresponse = (player1, player3, player4, player1label, player3label, player4label)
/ ontrialend = [
    trial.1to2.resetstimulusframes();
    values.sumrt_player2 += trial.1to2.latency;
    if (trial.1to2.response == "player1" || trial.1to2.response == "player1label") {
        values.recipient = 1;
        values.count_player2throws += 1;
        values.count_21 += 1;
        values.sumrt_21 += trial.1to2.latency;
        values.count_121 += 1;
        values.sumrt_121 += trial.1to2.latency;
    } else if (trial.1to2.response == "player3" || trial.1to2.response == "player3label") {
        values.recipient = 3;
        values.count_player2throws += 1;
        values.count_23 += 1;
        values.sumrt_23 += trial.1to2.latency;
        values.count_123 += 1;
        values.sumrt_123 += trial.1to2.latency;
    } else if (trial.1to2.response == "player4" || trial.1to2.response == "player4label") {
        values.recipient = 4;
        values.count_player2throws += 1;
        values.count_24 += 1;
        values.sumrt_24 += trial.1to2.latency;
        values.count_124 += 1;
        values.sumrt_124 += trial.1to2.latency;
    };
]
/ branch = [
    if (values.recipient == 1) {
        trial.2to1
    } else if (values.recipient == 3) {
        trial.2to3
    } else if (values.recipient == 4) {
        trial.2to4;
    };
]
</trial>

Note: trial.1to3 => video shows player 1 throwing the ball to player 3 after expressions.cyberdecisiontime.
Player 3 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player3schedule
<trial 1to3>
/ ontrialbegin = [
    values.player = 3;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2;
    };
    trial.1to3.insertstimulustime(video.1to3, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to3_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.1to3.resetstimulusframes();
    if (list.player3schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player3throws += 1;
        values.score3 -= 1;
        values.count_31 += 1;
        values.count_ignore2 += 1;
    } else if (list.player3schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player3throws += 1;
        values.score3 -= 1;
        values.count_32 += 1;
        values.count_ignore2 = 0;
    } else if (list.player3schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player3throws += 1;
        values.score3 -= 1;
        values.count_34 += 1;
        values.count_ignore2 += 1;
    };
]

/ branch = [
    if (list.player3schedule.currentvalue == 1) {
        trial.3to1;
    } else if (list.player3schedule.currentvalue == 2) {
        trial.3to2;
    } else if (list.player3schedule.currentvalue == 4) {
        trial.3to4;
    }
]
</trial>

Note: trial.1to4 => video shows player 1 throwing the ball to player 4 after expressions.cyberdecisiontime.
Player 4 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player4schedule
<trial 1to4>
/ ontrialbegin = [
    values.player = 4;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2
    };
    trial.1to4.insertstimulustime(video.1to4, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to4_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.1to4.resetstimulusframes();
    if (list.player4schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player4throws += 1;
        values.score4 -= 1;
        values.count_41 += 1;
        values.count_ignore2 += 1;
    } else if (list.player4schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player4throws += 1;
        values.score4 -= 1;
        values.count_42 += 1;
        values.count_ignore2 = 0;
    } else if (list.player4schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player4throws += 1;
        values.score4 -= 1;
        values.count_43 += 1;
        values.count_ignore2 += 1;
    };
]
/ branch = [
    if (list.player4schedule.currentvalue == 1) {
        trial.4to1;
    } else if (list.player4schedule.currentvalue == 2) {
        trial.4to2;
    } else if (list.player4schedule.currentvalue == 3) {
        trial.4to3;
    };
]
</trial>

Note: trial.2to1 => video shows player 2 throwing the ball to player 1.
Player 1 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player1schedule
<trial 2to1>
/ ontrialbegin = [
    values.player = 1;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2;
    };
]
/ stimulusframes = [1= 2to1]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0;
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1;
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1;
    };
]

/ branch = [
    if (list.player1schedule.currentvalue == 2) {
        trial.1to2;
    } else if (list.player1schedule.currentvalue == 3) {
        trial.1to3;
    } else if (list.player1schedule.currentvalue == 4) {
        trial.1to4;
    };
]
</trial>

Note: trial.2to3 => video shows player 2 throwing the ball to player 3.
Player 3 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player3schedule
<trial 2to3>
/ ontrialbegin = [
    values.player = 3;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2;
    };
]
/ stimulusframes = [1= 2to3]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    if (list.player3schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player3throws += 1;
        values.count_31 += 1;
        values.count_ignore2 += 1;
    } else if (list.player3schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player3throws += 1;
        values.count_32 += 1;
        values.count_ignore2 = 0;
    } else if (list.player3schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player3throws += 1;
        values.count_34 += 1;
        values.count_ignore2 += 1;
    };
]
/ branch = [
    if (list.player3schedule.currentvalue == 1) {
        trial.3to1;
    } else if (list.player3schedule.currentvalue == 2) {
        trial.3to2;
    } else if (list.player3schedule.currentvalue == 4) {
        trial.3to4;
    };
]
</trial>

Note: trial.2to4 => video shows player 2 throwing the ball to player 4.
Player 4 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player4schedule
<trial 2to4>
/ ontrialbegin = [values.player = 4]
/ ontrialbegin = [
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
]
/ stimulusframes = [1= 2to4]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    if (list.player4schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player4throws += 1;
        values.count_41 += 1;
        values.count_ignore2 += 1
    } else if (list.player4schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player4throws += 1;
        values.count_42 += 1;
        values.count_ignore2 = 0
    } else if (list.player4schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player4throws += 1;
        values.count_43 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player4schedule.currentvalue == 1)
        trial.4to1;
    else if (list.player4schedule.currentvalue == 2)
        trial.4to2;
    else if (list.player4schedule.currentvalue == 3)
        trial.4to3;
]
</trial>

Note: trial.3to2 => video shows player 3 throwing the ball to player 2 after expressions.cyberdecisiontime.
Player 2 (= values.player) then has to decide where to throw the ball next (= values.recipient)
<trial 3to2>
/ ontrialbegin = [
    values.player = 2;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    if (values.ignore2_streak1 == 0)
        values.ignore2_streak1 = values.max_ignore2;
    trial.3to2.insertstimulustime(video.3to2, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 3to2_static]
/ validresponse = (player1, player3, player4, player1label, player3label, player4label)
/ ontrialend = [
    trial.3to2.resetstimulusframes();
    values.sumrt_player2 += trial.3to2.latency;
    if (trial.3to2.response == "player1" || trial.3to2.response == "player1label") {
        values.recipient = 1;
        values.count_player2throws += 1;
        values.count_21 += 1;
        values.sumrt_21 += trial.3to2.latency;
        values.count_321 += 1;
        values.sumrt_321 += trial.3to2.latency
    } else if (trial.3to2.response == "player3" || trial.3to2.response == "player3label") {
        values.recipient = 3;
        values.count_player2throws += 1;
        values.count_23 += 1;
        values.sumrt_23 += trial.3to2.latency;
        values.count_323 += 1;
        values.sumrt_323 += trial.3to2.latency
    } else if (trial.3to2.response == "player4" || trial.3to2.response == "player4label") {
        values.recipient = 4;
        values.count_player2throws += 1;
        values.count_24 += 1;
        values.sumrt_24 += trial.3to2.latency;
        values.count_324 += 1;
        values.sumrt_324 += trial.3to2.latency
    };
]
/ branch = [
    if (values.recipient == 1)
        trial.2to1
    else if (values.recipient == 3)
        trial.2to3
    else if (values.recipient == 4)
        trial.2to4
]
</trial>

Note: trial.3to1=> video shows player 3 throwing the ball to player 1 after expressions.cyberdecisiontime.
Player 1 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player1schedule
<trial 3to1>
/ ontrialbegin = [
    values.player = 1;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.3to1.insertstimulustime(video.3to1, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 3to1_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.3to1.resetstimulusframes();
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player1schedule.currentvalue == 2)
        trial.1to2
    else if (list.player1schedule.currentvalue == 3)
        trial.1to3
    else if (list.player1schedule.currentvalue == 4)
        trial.1to4
]
</trial>

Note: trial.3to4=> video shows player 3 throwing the ball to player 4 after expressions.cyberdecisiontime.
Player 4 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player4schedule
<trial 3to4>
/ ontrialbegin = [
    values.player = 4;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.3to4.insertstimulustime(video.3to4, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 3to4_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.3to4.resetstimulusframes();
    if (list.player4schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player4throws += 1;
        values.count_41 += 1;
        values.count_ignore2 += 1
    } else if (list.player4schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player4throws += 1;
        values.count_42 += 1;
        values.count_ignore2 = 0
    } else if (list.player4schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player4throws += 1;
        values.count_43 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player4schedule.currentvalue == 1)
        trial.4to1
    else if (list.player4schedule.currentvalue == 2)
        trial.4to2
    else if (list.player4schedule.currentvalue == 3)
        trial.4to3
]
</trial>

Note: trial.4to2 => video shows player 4 throwing the ball to player 2 after expressions.cyberdecisiontime.
Player 2 (= values.player) then has to decide where to throw the ball next (= values.recipient)
<trial 4to2>
/ ontrialbegin = [
    values.player = 2;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    if (values.ignore2_streak1 == 0)
        values.ignore2_streak1 = values.max_ignore2;
    trial.4to2.insertstimulustime(video.4to2, expressions.cyberdecisiontime);
]

/ stimulusframes = [1= 4to2_static]
/ validresponse = (player1, player3, player4, player1label, player3label, player4label)
/ ontrialend = [values.sumrt_player2 += trial.4to2.latency]
/ ontrialend = [
    trial.4to2.resetstimulusframes();
    if (trial.4to2.response == "player1" || trial.4to2.response == "player1label") {
        values.recipient = 1;
        values.count_player2throws += 1;
        values.count_21 += 1;
        values.sumrt_21 += trial.4to2.latency;
        values.count_421 += 1;
        values.sumrt_421 += trial.4to2.latency
    } else if (trial.4to2.response == "player3" || trial.4to2.response == "player3label") {
        values.recipient = 3;
        values.count_player2throws += 1;
        values.count_23 += 1;
        values.sumrt_23 += trial.4to2.latency;
        values.count_423 += 1;
        values.sumrt_423 += trial.4to2.latency
    } else if (trial.4to2.response == "player4" || trial.4to2.response == "player4label") {
        values.recipient = 4;
        values.count_player2throws += 1;
        values.count_24 += 1;
        values.sumrt_24 += trial.4to2.latency;
        values.count_424 += 1;
        values.sumrt_424 += trial.4to2.latency
    };
]
/ branch = [
    if (values.recipient == 1)
        trial.2to1
    else if (values.recipient == 3)
        trial.2to3
    else if (values.recipient == 4)
        trial.2to4
]
</trial>

Note: trial.4to1=> video shows player 4 throwing the ball to player 1 after expressions.cyberdecisiontime.
Player 1 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player1schedule
<trial 4to1>
/ ontrialbegin = [
    values.player = 1;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.4to1.insertstimulustime(video.4to1, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 4to1_static]
/ validresponse = (noresponse)
/ ontrialend = [
    trial.4to1.resetstimulusframes();
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1
    };
]
/ trialduration = expressions.cyberdecisiontime
/ branch = [
    if (list.player1schedule.currentvalue == 2)
        trial.1to2
    else if (list.player1schedule.currentvalue == 3)
        trial.1to3
    else if (list.player1schedule.currentvalue == 4)
        trial.1to4
]
</trial>

Note: trial.4to3=> video shows player 4 throwing the ball to player 3 after expressions.cyberdecisiontime.
Player 3 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player3schedule
<trial 4to3>
/ ontrialbegin = [
    values.player = 3;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.4to3.insertstimulustime(video.4to3, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 4to3_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.4to3.resetstimulusframes();
    if (list.player3schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player3throws += 1;
        values.count_31 += 1;
        values.count_ignore2 += 1
    } else if (list.player3schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player3throws += 1;
        values.count_32 += 1;
        values.count_ignore2 = 0
    } else if (list.player3schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player3throws += 1;
        values.count_34 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player3schedule.currentvalue == 1)
        trial.3to1
    else if (list.player3schedule.currentvalue == 2)
        trial.3to2
    else if (list.player3schedule.currentvalue == 4)
        trial.3to4
]
</trial>

**************************************************************************************************************
**************************************************************************************************************
    BLOCK
**************************************************************************************************************
**************************************************************************************************************
<block game>
/ trials = [1 = start]
/ stop = [block.game.trialcount >= parameters.max_trialcount]
</block>

**************************************************************************************************************
**************************************************************************************************************
    EXPERIMENT
**************************************************************************************************************
**************************************************************************************************************
<expt main>
/ blocks = [
    1=instructions;
    2=game;
]
/ onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************
                                        End of Script
**************************************************************************************************************

You need to display the score <text> elements via all your <trial> elements' /stimulusframes.

<trial 1to2>
/ ontrialbegin = [
  values.player = 2;
  if (values.count_ignore2 > values.max_ignore2)
   values.max_ignore2 = values.count_ignore2;
  if (values.ignore2_streak1 == 0)
   values.ignore2_streak1 = values.max_ignore2;
  trial.1to2.insertstimulustime(video.1to2, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to2_static, player1score, player3score, player4score]
...
</trial>

Further, the calculation is not correct. You'll want to integrate updating values.score1 to values.score3 in your <trial>s' existing /ontrialend logic. Then simply reference the value in the <text> element's /items, instead of applying another inline expression there.

<text player1score>
/ items = ("Taka: <%values.score1%>")
/ position = (25%, 58%)
/ halign = center
/ valign = center
/ erase = false
</text>

Finally, please don't paste entire scripts into a forum post. Instead please attach the script file and also always include any and all external files (images, etc..) the script requires to run. Put everything in a ZIP file and then attach the ZIP archive by clicking +Insert -> Add File.


pn_dc5
pn_dc5
Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)Associate Member (123 reputation)
Group: Forum Members
Posts: 2, Visits: 7
Dave - 7/29/2019

pn_dc5 - 7/29/2019
Hello,

I am trying to customize an existing experiment (4 person cyberball) such that the user is shown each non-human player's cumulative total number of tosses (as a score) each time the ball is passed around. I've added code to show a "score" and have created values for the score that are set to increase by 1 each time the player receives the ball (values.count_player2throws += 1, etc;). However, I can't quite figure out how to get inquisit to update the stimulus screen such that the new score is shown to them. I'm fairly new to the program and am assuming that the problem has something to do with the ontrialstart/ontrialend commands(?) I think that the value of the counter is updating correctly, but just can't figure out how to then show that updated counter after each pass of the ball on the stimulus screen.

I've looked around at other posts asking how to add a counter, how to show a clock, etc (which is how I've gotten to where I'm at now) but am otherwise stumped. Any help would be greatly appreciated!  



<usermanual>
                       
                                    Cyberball: 4 PLAYERS
SCRIPT INFO
xf
Script Author: Sean Draine, PhD
last updated:  10-25-2018 by K. Borchert (katjab@millisecond.com) for Millisecond Software, LLC

Script Copyright ©  10-25-2018 Millisecond Software


BACKGROUND INFO

                                            *Purpose*
This script implements the Cyberball paradigm based on:

Williams, K. D., Cheung, C. K. T., & Choi, W. (2000). CyberOstracism: Effects of being ignored over
the Internet. Journal of Personality and Social Psychology, 79, 748-762.

Williams, K. D., & Jarvis, B. (2006). Cyberball: A program for use in research on ostracism and interpersonal
acceptance. Behavior Research Methods, Instruments, and Computers, 38, 174-180.

see also: http://www1.psych.purdue.edu/~willia55/Announce/cyberball.htm

                                              *Task*
Participant plays ball with 3 other participants (= the computer). It can be predefined with what
probability the computer includes/excludes the participant into the ball game.


DATA FILE INFORMATION:
The default data stored in the data files are:

(1) Raw data file: '4PlayerCyberball_raw*.iqdat' (a separate file for each participant)

build:                            Inquisit build
computer.platform:                the platform the script was run on
date, time, subject, group:        date and time script was run with the current subject/groupnumber
blockcode, blocknum:            the name and number of the current block
trialcode, trialnum:             the name and number of the currently recorded trial
                                    (Note: not all trials that are run might record data)
                                Trialcode Explanation:
                                Examples:
                                    "1to2" => in this trial player 2 (participant) throws the ball AFTER getting it from player 1
                                    "1to3" => in this trial player 3 throws the ball AFTER getting it from player 1 (random selection decides whether player 3 throws to player 1)
/player:                        stores the current player
/recipient:                        stores the recipient of the current ball toss (1, 2, 3, 4)                               
response:                        the (participant's) response
latency:                         the response latency in ms (for trials in which player 1 and 3 "play", the latency
                                is the randomly selected trialduration)
/count_ignore2:                    counts how often player 2 (participant) was "ignored" before a throw (resets every time
                                player 2 gets to throw the ball)

(2) Summary data file: '4PlayerCyberball_summary*.iqdat' (a separate file for each participant)

script.startdate:                date script was run
script.starttime:                time script was started
script.subjectid:                subject id number
script.groupid:                    group id number
script.elapsedtime:                time it took to run script (in ms)
computer.platform:                the platform the script was run on
/completed:                        0 = script was not completed (prematurely aborted); 1 = script was completed (all conditions run)
/showpictures:                    true = pictures of players are onscreen (default)
                                false = no pictures are presented
/showlabels:                    true = labels of players are onscreen (default)
                                false = no labels are presented

item.player1.1-
item.player4label.1:            images and labels used for the various players

/max_trialcount:                maximum number of trials (= passes between all players) played       

/ignore2_streak1:                 the number of times player 2 (participant) was ignored before player2 (participant) gets to respond for the first time
/max_ignore2:                    the longest streak of ignoring player 2 (participant) in the game that participant experienced
                                before being able to respond

/count_player2throws:            counts the number of times that player 1 gets to throw the ball
/count_player2throws:            counts the number of times that player 3 gets to throw the ball
/count_player2throws:            counts the number of times that player 2 (participant) gets to throw the ball
/meanRT_player2:                mean latency (in ms) of player 2 (participant)

/count_12:                        counts the number of times that player 1 throws to player 2 (participant)
/perc_12:                        percentage of player 1 throws that play to player 2 (participant)
/count_21:                        counts the number of times that player 2 (participant) throws to player 1
/perc_21:                        percentage of player 2 throws (participant) that play to player 1
/meanRT_21:                        mean latency (in ms) of player 2 (participant) decisions to throw to player 1

(same for player 3 and 4)

/perc_sameplayer:                percentage of player 2 (participant) throws when player 2 throws the ball back to the player who threw the ball to participant
                                        Note: random selection -> 1/3 times of all player 2 throws
/perc_otherplayer:                percentage of player 2 (participant) throws when player 2 throws ball to the player who didn't threw the ball to participant
                                        Note: random selection -> 2/3 times of all player 2 throws
/meanRT_sameplayer:                mean latency (in ms) of trials in which player2 (participant) throws ball back to the player who threw the ball to participant
/meanRT_otherplayer:            mean latency (in ms) of trials in which player2 (participant) throws ball to a player who didn't threw the ball to participant



EXPERIMENTAL SET-UP
* Participant plays ball with 3 other players for 50 trials.
The number of trials can be edited under section EDITABLE PARAMETERS.

* By default, all players are represented by names and pictures.
Names and pictures can be edited under section EDITABLE STIMULI.
To remove names or pictures go to EDITABLE PARAMETERS.

* By default, player 1 throws the ball to participant (=player2)  with a pre-determined probability (default: 14% of the times)
as does Player 3 and 4 (default: 14% of the times). The probabilities can be edited under EDITABLE LISTS.
The player schedules can further be customized to dictate specific/fixed throw sequences for each of the
"computer player".Go to section EDITABLE LISTS for further instructions.

* Decision Times for Player 1,3 and 4 are controlled by expressions.cyberdecisiontime under
EDITABLE PARAMETERS.

STIMULI
picture examples are provided by Millisecond Software. They can easily be edited under section
Editable Stimuli

INSTRUCTIONS
can be edited under section Editable Instructions

EDITABLE CODE:
check below for (relatively) easily editable parameters, stimuli, instructions etc.
Keep in mind that you can use this script as a template and therefore always "mess" with the entire code to further customize your experiment.

The parameters you can change are:

/max_trialcount:    maximum number of trials (= passes between the players) played       
/showpictures:        true = pictures of players are onscreen (default)
                    false = no pictures are presented
/showlabels:        true = labels of players are onscreen (default)
                    false = no labels are presented
                       
NOTE: parameters.showpictures and parameters.showlabels cannot be set to false at the same time.

/ cyberdecisiontime:         selects without replacement (noreplace) one of the 4 decision times for players1,3 and 4

</usermanual>


**************************************************************************************************************
**************************************************************************************************************
    EDITABLE PARAMETERS: change editable parameters here
**************************************************************************************************************
**************************************************************************************************************

<parameters>
/ max_trialcount = 10
/ showpictures = true
/ showlabels = true
</parameters>


<expressions>
/ cyberdecisiontime = noreplace(500, 1000, 1500, 2000)
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE STIMULI: change editable stimuli here
**************************************************************************************************************
**************************************************************************************************************

***********************
Player Pictures
***********************
<item player1>
/ 1 = "cassie.jpg"
</item>

<item player2>
/ 1 = "kip.jpg"
</item>

<item player3>
/ 1 = "trevor.jpg"
</item>

<item player4>
/ 1 = "sean.jpg"
</item>
***********************
Player Labels
***********************

<item player1label>
/ 1 = "Cassie"
</item>

<item player3label>
/ 1 = "Trevor"
</item>

<item player4label>
/ 1 = "Sean"
</item>

fills in automatically:
<item player2label>
/ 1 = "<%capitalize(textbox.name.response)%>"
</item>

***********************
Animation Movies
***********************
<item animations>
/ 1 = "1to2.gif"
/ 2 = "1to3.gif"
/ 3 = "1to4.gif"
/ 4 = "2to1.gif"
/ 5 = "2to3.gif"
/ 6 = "2to4.gif"
/ 7 = "3to1.gif"
/ 8 = "3to2.gif"
/ 9 = "3to4.gif"
/ 10 = "4to1.gif"
/ 11 = "4to2.gif"
/ 12 = "4to3.gif"
</item>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE INSTRUCTIONS: change instructions here
**************************************************************************************************************
**************************************************************************************************************

<item instructions>
/ 1 = "Welcome to Cyberball, the Interactive Ball-Tossing Game Used for Mental Visualization!"

/ 2 = "In the upcoming experiment, we test the effects of practicing mental visualization on task performance. Thus, we need you to practice your mental visualization skills. We have found that the best way to do this is to have you play an on-line ball tossing game with other participants who are logged on at the same time.

In a few moments, you will be playing a ball tossing game with other students over our network. The game is very simple. When the ball is tossed to you, simply <%expressions.buttoninstruct2%> the player you want to throw it to.

What is important is not your ball tossing performance, but that you MENTALLY visualize the entire experience. Imagine what the others look like. What sort of people are they? Where are you playing? Is it warm and sunny or cold and rainy? Create in your mind a complete mental picture of what might be going on if you were playing this game in real life.

Okay, ready to begin? Please <%expressions.buttoninstruct1%> 'Start' to begin."
</item>

****************************************************************************************************
general instruction expressions: adjust the instruction text depending on device used to run script
****************************************************************************************************
<expressions>
/ buttoninstruct1 = if (computer.touch && !computer.haskeyboard) {"Touch";} else {"click";}
/ buttoninstruct2 = if (computer.touch && !computer.haskeyboard) {"touch";} else {"click on";}
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE LISTS: change editable lists here
**************************************************************************************************************
**************************************************************************************************************

Note: by default players 1, 3 and 4 throw to player 2 roughly 14% of the time (1 out 7 times)

The item lists of these schedules can be further controlled by setting a specific/fixed throw sequence:
Example Player 1:

/items = (3, 4, 2, 3, 4, 4, 3, 3, 4, 4, 4, 3, 3, 2, 3, 2, 4, 2, 3, 3, 4, 4, 3, 3, 4)
/selectionmode = sequence

(if selectionmode = sequence => it is suggested to create the list as long as (parameters.max_trialcount/2)
to ensure that the beginning of the list does NOT get repeated)

<list player1schedule>
/ items = (3, 3, 3, 3, 3, 3, 2, 4)
/ replace = false
</list>

<list player3schedule>
/ items = (1, 1, 4, 4, 2, 2)
/ replace = false
</list>

<list player4schedule>
/ items = (3, 3, 3, 3, 3, 3, 2, 1)
/ replace = false
</list>

**************************************************************************************************************
                                !!!REMAINING CODE: Customize after careful consideration only!!!
**************************************************************************************************************


**************************************************************************************************************
**************************************************************************************************************
    DEFAULTS
**************************************************************************************************************
**************************************************************************************************************
script requires Inquisit 5.0.0.0 or higher

<defaults>
/ canvasaspectratio = (4,3)
/ minimumversion = "5.0.0.0"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txbgcolor = white
/ txcolor = black
/ inputdevice = mouse
</defaults>

**************************************************************************************************************
**************************************************************************************************************
    DATA
**************************************************************************************************************
**************************************************************************************************************
*************
raw data
*************

<data>
/ separatefiles = true
/ columns = (build, computer.platform, date, time, subject, group, blockcode, blocknum, trialcode, trialnum,
            values.player, values.recipient, response, latency,
            values.count_ignore2)

</data>

*************
summary data: remove variables that are not of interest
*************

<summarydata>
/ columns = (script.startdate, script.starttime, script.subjectid, script.groupid, script.elapsedtime, computer.platform, values.completed,
            parameters.showpictures, parameters.showlabels,
            item.player1.1, item.player1label.1, item.player2.1, item.player2label.1, item.player3.1, item.player3label.1, item.player4.1, item.player4label.1,
            parameters.max_trialcount, values.ignore2_streak1, values.max_ignore2,
            values.count_player1throws, values.count_player3throws, values.count_player4throws, values.count_player2throws, expressions.meanRT_player2,
            values.count_12, expressions.perc_12, values.count_21, expressions.perc_21, expressions.meanRT_21,
            values.count_32, expressions.perc_32, values.count_23, expressions.perc_23, expressions.meanRT_23,
            values.count_42, expressions.perc_42, values.count_24, expressions.perc_24, expressions.meanRT_24,
            expressions.perc_sameplayer, expressions.perc_otherplayer, expressions.meanRT_sameplayer, expressions.meanRT_otherplayer)
/ separatefiles = true
</summarydata>

**************************************************************************************************************
**************************************************************************************************************
    AUTOMATICALLY UPDATED VALUES
**************************************************************************************************************
**************************************************************************************************************
/completed:                            0 = script was not completed; 1 = script was completed (all conditions run)

/player:                            stores the current player (1, 2, 3, 4)
/recipient:                            stores the recipient of the current ball toss (1, 2, 3, 4)

/count_player1throws:                counts the number of times that player 1 gets to throw the ball
/count_player3throws:                counts the number of times that player 3 gets to throw the ball
/count_player4throws:                counts the number of times that player 4 gets to throw the ball
/count_player2throws:                counts the number of times that player 2 (participant) gets to throw the ball

/sumrt_player2:                        sums the latencies of player2 throws (participant)
/sumrt_21:                            sums the latencies of player 2 throws (participant) to player 1
/sumrt_23:                            sums the latencies of player 2 throws (participant) to player 3
/sumrt_24:                            sums the latencies of player 2 throws (participant) to player 4

/count_ignore2:                        counts how often player 2 (participant) was "ignored" before a throw (resets every time
                                    player 2 gets to throw the ball)
/max_ignore2:                        the longest streak of ignoring player 2 in the game that participant experienced
                                    before responding
/ignore2_streak1:                     the ignorestreak before player2 (participant) gets to respond for the first time

/count_12:                            counts the number of times that player 1 throws to player 2 (participant)
/count_32:                            counts the number of times that player 3 throws to player 2 (participant)
/count_13:                            counts the number of times that player 1 throws to player 3
/count_31:                            counts the number of times that player 3 throws to player 1
/count_21:                            counts the number of times that player 2 (participant) throws to player 1
/count_23:                            counts the number of times that player 2 (participant) throws to player 3
/count_41:                            counts the number of times that player 4 throws to player 1
/count_43:                            counts the number of times that player 4 throws to player 3
/count_42:                            counts the number of times that player 4 throws to player 2 (participant)
/count_14:                            counts the number of times that player 1 throws to player 4
/count_24:                            counts the number of times that player 2 (participant) throws to player 4
/count_34:                            counts the number of times that player 3 throws to player 4

/count_121:                            counts how often player2 (participant) throws the ball back to player 1 (after getting it from player 1)
/count_323:                            counts how often player2 (participant) throws the ball back to player 3 (after getting it from player 3)
/count_424:                            counts how often player2 (participant) throws the ball back to player 4 (after getting it from player 4)

/count_123:                            counts how often player2 (participant) throws the ball to player 3 after getting it from player 1
/count_321:                            counts how often player2 (participant) throws the ball to player 1 after getting it from player 3
/count_124:                            counts how often player2 (participant) throws the ball to player 4 after getting it from player 1
/count_324:                            counts how often player2 (participant) throws the ball to player 4 after getting it from player 3
/count_421:                            counts how often player2 (participant) throws the ball to player 1 after getting it from player 4
/count_423:                            counts how often player2 (participant) throws the ball to player 3 after getting it from player 4

/sumrt_121:                            sums latencies for all trials in which player2 (participant) throws the ball back to player 1  (after getting it from player 1)
/sumrt_323:                            sums latencies for all trials in which player2 (participant) throws the ball back to player 3 (after getting it from player 3)
/sumrt_424:                            sums latencies for all trials in which player2 (participant) throws the ball back to player 4 (after getting it from player 4)
/sumrt_123:                            sums latencies for all trials in which player2 (participant) throws the ball to player 3 after getting it from player 1
/sumrt_321:                            sums latencies for all trials in which player2 (participant) throws the ball to player 1 after getting it from player 3
/sumrt_124:                            sums latencies for all trials in which player2 (participant) throws the ball to player 4 after getting it from player 1
/sumrt_324:                            sums latencies for all trials in which player2 (participant) throws the ball to player 4 after getting it from player 3
/sumrt_421:                            sums latencies for all trials in which player2 (participant) throws the ball to player 1 after getting it from player 4
/sumrt_423:                            sums latencies for all trials in which player2 (participant) throws the ball to player 3 after getting it from player 4

<values>
/ completed = 0
/ player = 0
/ recipient = 0

/ count_player1throws = 0
/ count_player3throws = 0
/ count_player4throws = 0
/ count_player2throws = 0

/score1 = 100
/score3 = 100
/score4 = 100

/ sumrt_player2 = 0
/ sumrt_21 = 0
/ sumrt_23 = 0
/ sumrt_24 = 0

/ count_ignore2 = 0
/ max_ignore2 = 0
/ ignore2_streak1 = 0

/ count_12 = 0
/ count_32 = 0
/ count_13 = 0
/ count_31 = 0
/ count_21 = 0
/ count_23 = 0
/ count_14 = 0
/ count_24 = 0
/ count_34 = 0
/ count_41 = 0
/ count_42 = 0
/ count_43 = 0

/ count_121 = 0
/ count_323 = 0
/ count_424 = 0
/ count_123 = 0
/ count_321 = 0
/ count_124 = 0
/ count_324 = 0
/ count_421 = 0
/ count_423 = 0

/ sumrt_121 = 0
/ sumrt_323 = 0
/ sumrt_424 = 0
/ sumrt_123 = 0
/ sumrt_321 = 0
/ sumrt_124 = 0
/ sumrt_324 = 0
/ sumrt_421 = 0
/ sumrt_423 = 0
</values>

**************************************************************************************************************
**************************************************************************************************************
    EXPRESSIONS
**************************************************************************************************************
**************************************************************************************************************
/meanRT_player2:            mean latency of player 2 throws (participant)
/meanRT_21:                    mean latency of player 2 (participant) decisions to throw to player 1
/meanRT_23:                    mean latency of player 2 (participant) decisions to throw to player 3
/meanRT_24:                    mean latency of player 2 (participant) decisions to throw to player 4

/perc_12:                    percentage of player 1 throws that play to player 2 (participant)
/perc_21:                    percentage of player 2 throws (participant) that play to player 1
/perc_32:                    percentage of player 3 throws that play to player 2 (participant)
/perc_23:                    percentage of player 2 throws (participant) that play to player 3
/perc_42:                    percentage of player 4 throws that play to player 2 (participant)
/perc_24:                    percentage of player 2 throws (participant) that play to player 4

/perc_sameplayer:            percentage of player 2 (participant) throws when player 2 throws the ball back to the player who threw the ball to participant
                                Note: random selection would suggest 1/3 of all player 2 throws
/perc_otherplayer:            percentage of player 2 (participant) throws when player 2 throws ball to a player who didn't threw the ball to participant
                                Note: random selection would suggest 2/3 of all player 2 throws

/meanRT_sameplayer:            mean latencies of trials in which player2 (participant) throws ball back to the player who threw the ball to participant
/meanRT_otherplayer:        mean latencies of trials in which player2 (participant) throws ball to a player who didn't threw the ball to participant


<expressions>
/ meanRT_player2 = values.sumrt_player2/values.count_player2throws
/ meanRT_21 = values.sumrt_21/values.count_21
/ meanRT_23 = values.sumrt_23/values.count_23
/ meanRT_24 = values.sumrt_24/values.count_24


/ perc_12 = (values.count_12/values.count_player1throws) * 100
/ perc_21 = (values.count_21/values.count_player2throws) * 100
/ perc_32 = (values.count_32/values.count_player3throws) * 100
/ perc_23 = (values.count_23/values.count_player2throws) * 100
/ perc_42 = (values.count_42/values.count_player4throws) * 100
/ perc_24 = (values.count_24/values.count_player2throws) * 100

/ perc_sameplayer = ((values.count_121 + values.count_323 + values.count_424)/values.count_player2throws) * 100
/ perc_otherplayer = ((values.count_123 + values.count_321 + values.count_124 + + values.count_421 + values.count_324  + values.count_423)/values.count_player2throws) * 100

/ meanRT_sameplayer = (values.sumrt_121 + values.sumrt_323 + values.sumrt_424)/(values.count_121 + values.count_323 + values.count_424)
/ meanRT_otherplayer = (values.sumrt_123 + values.sumrt_321 + values.sumrt_124 + values.sumrt_421 + values.sumrt_324  + values.sumrt_423)/(values.count_123 + values.count_321 + values.count_124 + values.count_421 + values.count_324  + values.count_423)
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    INSTRUCTIONS:
**************************************************************************************************************
**************************************************************************************************************
<text welcome>
/ items = instructions
/ select = 1
/ position = (50%, 40%)
/ fontstyle = ("Arial", 2%, true, false, false, false, 5, 0)
/ txcolor = darkblue
/ valign = top
</text>

<text instructions>
/ items = instructions
/ select = 2
/ position = (50%, 45%)
/ fontstyle = ("Arial", 1.5%)
/ size = (80%, 30%)
/ hjustify = left
/ txcolor = darkblue
/ valign = top
</text>

*************ADDITIONAL STIMULI*****************
<text startlabel>
/ items = ("Start")
/ position = (50%, 80%)
/ fontstyle = ("Arial", 3%, false, false, true, false, 5, 0)
/ txcolor = blue
</text>

<picture cyberball>
/ items = ("cyberball.gif")
/ position = (50%, 10%)
/ size = (20%, 20%)
</picture>

<picture cyberboy>
/ items = ("cyberboy.gif")
/ position = (50%, 30%)
/ size = (20%, 20%)
</picture>

<shape blankscreen>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
</shape>

*************TRIALS & BLOCKS*****************
<trial instructions>
/ stimulusframes = [1=cyberball, cyberboy, welcome, instructions, startlabel]
/ validresponse = (startlabel)
/ responsemessage = (startlabel, blankscreen, 0)
/ recorddata = false
</trial>

<block instructions>
/ trials = [1=instructions; 2=name]
</block>

**************************************************************************************************************
**************************************************************************************************************
    PLAYER STIMULI
**************************************************************************************************************
**************************************************************************************************************

<picture player1>
/ items = player1
/ position = (25%, 53%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>

<text player1label>
/ items = player1label
/ position = (25%, 53%)
/ halign = center
/ valign = top
/ erase = false
</text>

<text player1score>
/ items = ("Taka: <%values.score1 -= values.count_player1throws%>")
/ position = (25%, 58%)
/ halign = center
/ valign = center
/ erase = false
</text>

<picture player2>
/ items = player2
/ position = (50%, 73%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>

<text player2label>
/ items = player2label
/ position = (50%, 73%)
/ valign = top
/ erase = false
</text>

<picture player3>
/ items = player3
/ position = (75%, 53%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>

<text player3label>
/ items = player3label
/ position = (75%, 53%)
/ valign = top
/ erase = false
</text>

<text player3score>
/ items = ("Taka: <%values.score3 -= values.count_player3throws%>")
/ position = (75%, 58%)
/ halign = center
/ valign = center
/ erase = false
</text>

<picture player4>
/ items = player4
/ position = (50%, 30%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>


<text player4label>
/ items = player4label
/ position = (50%, 30%)
/ halign = center
/ valign = top
/ erase = false
</text>

<text player4score>
/ items = ("Taka: <%values.score4 -= values.count_player4throws%>")
/ position = (50%, 35%)
/ halign = center
/ valign = center
/ erase = false
</text>

<picture start>
/ items = ("start.gif")
/ erase = false
/ size = (30%, 32%)
</picture>

**************************************************************************************************************
**************************************************************************************************************
    ANIMATION VIDEOS
**************************************************************************************************************
**************************************************************************************************************
<video 1to2>
/ items = animations
/ select = 1
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 1to2_static>
/ items = animations
/ select = 1
/ size = (30%, 30%)
</picture>

<video 1to3>
/ items = animations
/ select = 2
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 1to3_static>
/ items = animations
/ select = 2
/ size = (30%, 30%)
</picture>

<video 1to4>
/ items = animations
/ select = 3
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 1to4_static>
/ items = animations
/ select = 3
/ size = (30%, 30%)
</picture>

<video 2to1>
/ items = animations
/ select = 4
/ playthrough = true
/ size = (30%, 30%)
</video>

<video 2to3>
/ items = animations
/ select = 5
/ playthrough = true
/ size = (30%, 30%)
</video>

<video 2to4>
/ items = animations
/ select = 6
/ playthrough = true
/ size = (30%, 30%)
</video>

<video 3to1>
/ items = animations
/ select = 7
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 3to1_static>
/ items = animations
/ select = 7
/ size = (30%, 30%)
</picture>

<video 3to2>
/ items = animations
/ select = 8
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 3to2_static>
/ items = animations
/ select = 8
/ size = (30%, 30%)
</picture>

<video 3to4>
/ items = animations
/ select = 9
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 3to4_static>
/ items = animations
/ select = 9
/ size = (30%, 30%)
</picture>

<video 4to1>
/ items = animations
/ select = 10
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 4to1_static>
/ items = animations
/ select = 10
/ size = (30%, 30%)
</picture>

<video 4to2>
/ items = animations
/ select = 11
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 4to2_static>
/ items = animations
/ select = 11
/ size = (30%, 30%)
</picture>

<video 4to3>
/ items = animations
/ select = 12
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 4to3_static>
/ items = animations
/ select = 12
/ size = (30%, 30%)
</picture>

**************************************************************************************************************
**************************************************************************************************************
    SURVEYPAGE: INQUIRIES ABOUT PLAYER
**************************************************************************************************************
**************************************************************************************************************
*you label gets dynamically set during runtime in surveypage.name
<text youlabel>
/ position = (50%, 80%)
/ valign = bottom
/ erase = false
</text>

<textbox name>
/ caption = "Please enter your name"
/ required = true
/ mask = alphabetic
/ position = (30%, 45%)
/ textboxsize = (50%, 5%)
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ responsefontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
</textbox>

<surveypage name>
/ showquestionnumbers = false
/ questions = [1=name]
/ ontrialend = [text.youlabel.item = textbox.name.response]
/ showpagenumbers = false
/ navigationbuttonfontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ navigationbuttonsize = (20%, 5%)
/ nextbuttonposition = (45%, 65%)
</surveypage>

**************************************************************************************************************
**************************************************************************************************************
    MAIN TRIALS
**************************************************************************************************************
**************************************************************************************************************

Note: trial.start always "plays" player 1 - a random selection decides whether player 1 throws to
player 3, player 2 or player 4 (-> list.player1schedule)

<trial start>
/ ontrialbegin = [
    values.player = 1;
    if (parameters.showpictures == true) {
        trial.start.insertstimulusframe(picture.player1, 1);
        trial.start.insertstimulusframe(picture.player2, 1);
        trial.start.insertstimulusframe(picture.player3, 1);
        trial.start.insertstimulusframe(picture.player4, 1)
    };
    if (parameters.showlabels == true) {
        trial.start.insertstimulusframe(text.player1label, 1);
        trial.start.insertstimulusframe(text.player2label, 1);
        trial.start.insertstimulusframe(text.player3label, 1);
        trial.start.insertstimulusframe(text.player4label, 1);
    };
    if (parameters.showlabels == true) {
        trial.start.insertstimulusframe(text.player1score, 1);
        trial.start.insertstimulusframe(text.player3score, 1);
        trial.start.insertstimulusframe(text.player4score, 1);
    };
]
/ stimulusframes = [1=start]
/ validresponse = (noresponse)
/ ontrialend = [
    trial.start.resetstimulusframes();
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0;
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1;
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1;
       
    };
   
]
/ trialduration = 0
/ branch = [
    if (list.player1schedule.currentvalue == 2) {
        trial.1to2;
    } else if (list.player1schedule.currentvalue == 3) {
        trial.1to3;
    } else if (list.player1schedule.currentvalue == 4) {
        trial.1to4;
    };
]
</trial>

Note: trial.1to2 => video shows player 1 throwing the ball to player 2 after expressions.cyberdecisiontime.
Player 2 (= values.player) then has to decide where to throw the ball next (= values.recipient)
<trial 1to2>
/ ontrialbegin = [
    values.player = 2;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    if (values.ignore2_streak1 == 0)
        values.ignore2_streak1 = values.max_ignore2;
    trial.1to2.insertstimulustime(video.1to2, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to2_static]
/ validresponse = (player1, player3, player4, player1label, player3label, player4label)
/ ontrialend = [
    trial.1to2.resetstimulusframes();
    values.sumrt_player2 += trial.1to2.latency;
    if (trial.1to2.response == "player1" || trial.1to2.response == "player1label") {
        values.recipient = 1;
        values.count_player2throws += 1;
        values.count_21 += 1;
        values.sumrt_21 += trial.1to2.latency;
        values.count_121 += 1;
        values.sumrt_121 += trial.1to2.latency;
    } else if (trial.1to2.response == "player3" || trial.1to2.response == "player3label") {
        values.recipient = 3;
        values.count_player2throws += 1;
        values.count_23 += 1;
        values.sumrt_23 += trial.1to2.latency;
        values.count_123 += 1;
        values.sumrt_123 += trial.1to2.latency;
    } else if (trial.1to2.response == "player4" || trial.1to2.response == "player4label") {
        values.recipient = 4;
        values.count_player2throws += 1;
        values.count_24 += 1;
        values.sumrt_24 += trial.1to2.latency;
        values.count_124 += 1;
        values.sumrt_124 += trial.1to2.latency;
    };
]
/ branch = [
    if (values.recipient == 1) {
        trial.2to1
    } else if (values.recipient == 3) {
        trial.2to3
    } else if (values.recipient == 4) {
        trial.2to4;
    };
]
</trial>

Note: trial.1to3 => video shows player 1 throwing the ball to player 3 after expressions.cyberdecisiontime.
Player 3 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player3schedule
<trial 1to3>
/ ontrialbegin = [
    values.player = 3;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2;
    };
    trial.1to3.insertstimulustime(video.1to3, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to3_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.1to3.resetstimulusframes();
    if (list.player3schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player3throws += 1;
        values.score3 -= 1;
        values.count_31 += 1;
        values.count_ignore2 += 1;
    } else if (list.player3schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player3throws += 1;
        values.score3 -= 1;
        values.count_32 += 1;
        values.count_ignore2 = 0;
    } else if (list.player3schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player3throws += 1;
        values.score3 -= 1;
        values.count_34 += 1;
        values.count_ignore2 += 1;
    };
]

/ branch = [
    if (list.player3schedule.currentvalue == 1) {
        trial.3to1;
    } else if (list.player3schedule.currentvalue == 2) {
        trial.3to2;
    } else if (list.player3schedule.currentvalue == 4) {
        trial.3to4;
    }
]
</trial>

Note: trial.1to4 => video shows player 1 throwing the ball to player 4 after expressions.cyberdecisiontime.
Player 4 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player4schedule
<trial 1to4>
/ ontrialbegin = [
    values.player = 4;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2
    };
    trial.1to4.insertstimulustime(video.1to4, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to4_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.1to4.resetstimulusframes();
    if (list.player4schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player4throws += 1;
        values.score4 -= 1;
        values.count_41 += 1;
        values.count_ignore2 += 1;
    } else if (list.player4schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player4throws += 1;
        values.score4 -= 1;
        values.count_42 += 1;
        values.count_ignore2 = 0;
    } else if (list.player4schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player4throws += 1;
        values.score4 -= 1;
        values.count_43 += 1;
        values.count_ignore2 += 1;
    };
]
/ branch = [
    if (list.player4schedule.currentvalue == 1) {
        trial.4to1;
    } else if (list.player4schedule.currentvalue == 2) {
        trial.4to2;
    } else if (list.player4schedule.currentvalue == 3) {
        trial.4to3;
    };
]
</trial>

Note: trial.2to1 => video shows player 2 throwing the ball to player 1.
Player 1 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player1schedule
<trial 2to1>
/ ontrialbegin = [
    values.player = 1;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2;
    };
]
/ stimulusframes = [1= 2to1]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0;
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1;
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1;
    };
]

/ branch = [
    if (list.player1schedule.currentvalue == 2) {
        trial.1to2;
    } else if (list.player1schedule.currentvalue == 3) {
        trial.1to3;
    } else if (list.player1schedule.currentvalue == 4) {
        trial.1to4;
    };
]
</trial>

Note: trial.2to3 => video shows player 2 throwing the ball to player 3.
Player 3 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player3schedule
<trial 2to3>
/ ontrialbegin = [
    values.player = 3;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2;
    };
]
/ stimulusframes = [1= 2to3]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    if (list.player3schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player3throws += 1;
        values.count_31 += 1;
        values.count_ignore2 += 1;
    } else if (list.player3schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player3throws += 1;
        values.count_32 += 1;
        values.count_ignore2 = 0;
    } else if (list.player3schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player3throws += 1;
        values.count_34 += 1;
        values.count_ignore2 += 1;
    };
]
/ branch = [
    if (list.player3schedule.currentvalue == 1) {
        trial.3to1;
    } else if (list.player3schedule.currentvalue == 2) {
        trial.3to2;
    } else if (list.player3schedule.currentvalue == 4) {
        trial.3to4;
    };
]
</trial>

Note: trial.2to4 => video shows player 2 throwing the ball to player 4.
Player 4 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player4schedule
<trial 2to4>
/ ontrialbegin = [values.player = 4]
/ ontrialbegin = [
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
]
/ stimulusframes = [1= 2to4]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    if (list.player4schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player4throws += 1;
        values.count_41 += 1;
        values.count_ignore2 += 1
    } else if (list.player4schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player4throws += 1;
        values.count_42 += 1;
        values.count_ignore2 = 0
    } else if (list.player4schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player4throws += 1;
        values.count_43 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player4schedule.currentvalue == 1)
        trial.4to1;
    else if (list.player4schedule.currentvalue == 2)
        trial.4to2;
    else if (list.player4schedule.currentvalue == 3)
        trial.4to3;
]
</trial>

Note: trial.3to2 => video shows player 3 throwing the ball to player 2 after expressions.cyberdecisiontime.
Player 2 (= values.player) then has to decide where to throw the ball next (= values.recipient)
<trial 3to2>
/ ontrialbegin = [
    values.player = 2;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    if (values.ignore2_streak1 == 0)
        values.ignore2_streak1 = values.max_ignore2;
    trial.3to2.insertstimulustime(video.3to2, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 3to2_static]
/ validresponse = (player1, player3, player4, player1label, player3label, player4label)
/ ontrialend = [
    trial.3to2.resetstimulusframes();
    values.sumrt_player2 += trial.3to2.latency;
    if (trial.3to2.response == "player1" || trial.3to2.response == "player1label") {
        values.recipient = 1;
        values.count_player2throws += 1;
        values.count_21 += 1;
        values.sumrt_21 += trial.3to2.latency;
        values.count_321 += 1;
        values.sumrt_321 += trial.3to2.latency
    } else if (trial.3to2.response == "player3" || trial.3to2.response == "player3label") {
        values.recipient = 3;
        values.count_player2throws += 1;
        values.count_23 += 1;
        values.sumrt_23 += trial.3to2.latency;
        values.count_323 += 1;
        values.sumrt_323 += trial.3to2.latency
    } else if (trial.3to2.response == "player4" || trial.3to2.response == "player4label") {
        values.recipient = 4;
        values.count_player2throws += 1;
        values.count_24 += 1;
        values.sumrt_24 += trial.3to2.latency;
        values.count_324 += 1;
        values.sumrt_324 += trial.3to2.latency
    };
]
/ branch = [
    if (values.recipient == 1)
        trial.2to1
    else if (values.recipient == 3)
        trial.2to3
    else if (values.recipient == 4)
        trial.2to4
]
</trial>

Note: trial.3to1=> video shows player 3 throwing the ball to player 1 after expressions.cyberdecisiontime.
Player 1 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player1schedule
<trial 3to1>
/ ontrialbegin = [
    values.player = 1;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.3to1.insertstimulustime(video.3to1, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 3to1_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.3to1.resetstimulusframes();
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player1schedule.currentvalue == 2)
        trial.1to2
    else if (list.player1schedule.currentvalue == 3)
        trial.1to3
    else if (list.player1schedule.currentvalue == 4)
        trial.1to4
]
</trial>

Note: trial.3to4=> video shows player 3 throwing the ball to player 4 after expressions.cyberdecisiontime.
Player 4 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player4schedule
<trial 3to4>
/ ontrialbegin = [
    values.player = 4;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.3to4.insertstimulustime(video.3to4, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 3to4_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.3to4.resetstimulusframes();
    if (list.player4schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player4throws += 1;
        values.count_41 += 1;
        values.count_ignore2 += 1
    } else if (list.player4schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player4throws += 1;
        values.count_42 += 1;
        values.count_ignore2 = 0
    } else if (list.player4schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player4throws += 1;
        values.count_43 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player4schedule.currentvalue == 1)
        trial.4to1
    else if (list.player4schedule.currentvalue == 2)
        trial.4to2
    else if (list.player4schedule.currentvalue == 3)
        trial.4to3
]
</trial>

Note: trial.4to2 => video shows player 4 throwing the ball to player 2 after expressions.cyberdecisiontime.
Player 2 (= values.player) then has to decide where to throw the ball next (= values.recipient)
<trial 4to2>
/ ontrialbegin = [
    values.player = 2;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    if (values.ignore2_streak1 == 0)
        values.ignore2_streak1 = values.max_ignore2;
    trial.4to2.insertstimulustime(video.4to2, expressions.cyberdecisiontime);
]

/ stimulusframes = [1= 4to2_static]
/ validresponse = (player1, player3, player4, player1label, player3label, player4label)
/ ontrialend = [values.sumrt_player2 += trial.4to2.latency]
/ ontrialend = [
    trial.4to2.resetstimulusframes();
    if (trial.4to2.response == "player1" || trial.4to2.response == "player1label") {
        values.recipient = 1;
        values.count_player2throws += 1;
        values.count_21 += 1;
        values.sumrt_21 += trial.4to2.latency;
        values.count_421 += 1;
        values.sumrt_421 += trial.4to2.latency
    } else if (trial.4to2.response == "player3" || trial.4to2.response == "player3label") {
        values.recipient = 3;
        values.count_player2throws += 1;
        values.count_23 += 1;
        values.sumrt_23 += trial.4to2.latency;
        values.count_423 += 1;
        values.sumrt_423 += trial.4to2.latency
    } else if (trial.4to2.response == "player4" || trial.4to2.response == "player4label") {
        values.recipient = 4;
        values.count_player2throws += 1;
        values.count_24 += 1;
        values.sumrt_24 += trial.4to2.latency;
        values.count_424 += 1;
        values.sumrt_424 += trial.4to2.latency
    };
]
/ branch = [
    if (values.recipient == 1)
        trial.2to1
    else if (values.recipient == 3)
        trial.2to3
    else if (values.recipient == 4)
        trial.2to4
]
</trial>

Note: trial.4to1=> video shows player 4 throwing the ball to player 1 after expressions.cyberdecisiontime.
Player 1 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player1schedule
<trial 4to1>
/ ontrialbegin = [
    values.player = 1;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.4to1.insertstimulustime(video.4to1, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 4to1_static]
/ validresponse = (noresponse)
/ ontrialend = [
    trial.4to1.resetstimulusframes();
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1
    };
]
/ trialduration = expressions.cyberdecisiontime
/ branch = [
    if (list.player1schedule.currentvalue == 2)
        trial.1to2
    else if (list.player1schedule.currentvalue == 3)
        trial.1to3
    else if (list.player1schedule.currentvalue == 4)
        trial.1to4
]
</trial>

Note: trial.4to3=> video shows player 4 throwing the ball to player 3 after expressions.cyberdecisiontime.
Player 3 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player3schedule
<trial 4to3>
/ ontrialbegin = [
    values.player = 3;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.4to3.insertstimulustime(video.4to3, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 4to3_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.4to3.resetstimulusframes();
    if (list.player3schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player3throws += 1;
        values.count_31 += 1;
        values.count_ignore2 += 1
    } else if (list.player3schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player3throws += 1;
        values.count_32 += 1;
        values.count_ignore2 = 0
    } else if (list.player3schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player3throws += 1;
        values.count_34 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player3schedule.currentvalue == 1)
        trial.3to1
    else if (list.player3schedule.currentvalue == 2)
        trial.3to2
    else if (list.player3schedule.currentvalue == 4)
        trial.3to4
]
</trial>

**************************************************************************************************************
**************************************************************************************************************
    BLOCK
**************************************************************************************************************
**************************************************************************************************************
<block game>
/ trials = [1 = start]
/ stop = [block.game.trialcount >= parameters.max_trialcount]
</block>

**************************************************************************************************************
**************************************************************************************************************
    EXPERIMENT
**************************************************************************************************************
**************************************************************************************************************
<expt main>
/ blocks = [
    1=instructions;
    2=game;
]
/ onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************
                                        End of Script
**************************************************************************************************************

You need to display the score <text> elements via all your <trial> elements' /stimulusframes.

<trial 1to2>
/ ontrialbegin = [
  values.player = 2;
  if (values.count_ignore2 > values.max_ignore2)
   values.max_ignore2 = values.count_ignore2;
  if (values.ignore2_streak1 == 0)
   values.ignore2_streak1 = values.max_ignore2;
  trial.1to2.insertstimulustime(video.1to2, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to2_static, player1score, player3score, player4score]
...
</trial>

Further, the calculation is not correct. You'll want to integrate updating values.score1 to values.score3 in your <trial>s' existing /ontrialend logic. Then simply reference the value in the <text> element's /items, instead of applying another inline expression there.

<text player1score>
/ items = ("Taka: <%values.score1%>")
/ position = (25%, 58%)
/ halign = center
/ valign = center
/ erase = false
</text>

Finally, please don't paste entire scripts into a forum post. Instead please attach the script file and also always include any and all external files (images, etc..) the script requires to run. Put everything in a ZIP file and then attach the ZIP archive by clicking +Insert -> Add File.


Thank you! This was very helpful. As a brief follow-up question, how do I delay the timing for the updated stimulus frame such that the score updates only after the ball pass animation? I have it working now, but the score updates instantly upon next player's turn (instead of after the short video). Thanks again!

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: 12K, Visits: 98K
pn_dc5 - 7/29/2019
Dave - 7/29/2019

pn_dc5 - 7/29/2019
Hello,

I am trying to customize an existing experiment (4 person cyberball) such that the user is shown each non-human player's cumulative total number of tosses (as a score) each time the ball is passed around. I've added code to show a "score" and have created values for the score that are set to increase by 1 each time the player receives the ball (values.count_player2throws += 1, etc;). However, I can't quite figure out how to get inquisit to update the stimulus screen such that the new score is shown to them. I'm fairly new to the program and am assuming that the problem has something to do with the ontrialstart/ontrialend commands(?) I think that the value of the counter is updating correctly, but just can't figure out how to then show that updated counter after each pass of the ball on the stimulus screen.

I've looked around at other posts asking how to add a counter, how to show a clock, etc (which is how I've gotten to where I'm at now) but am otherwise stumped. Any help would be greatly appreciated!  



<usermanual>
                       
                                    Cyberball: 4 PLAYERS
SCRIPT INFO
xf
Script Author: Sean Draine, PhD
last updated:  10-25-2018 by K. Borchert (katjab@millisecond.com) for Millisecond Software, LLC

Script Copyright ©  10-25-2018 Millisecond Software


BACKGROUND INFO

                                            *Purpose*
This script implements the Cyberball paradigm based on:

Williams, K. D., Cheung, C. K. T., & Choi, W. (2000). CyberOstracism: Effects of being ignored over
the Internet. Journal of Personality and Social Psychology, 79, 748-762.

Williams, K. D., & Jarvis, B. (2006). Cyberball: A program for use in research on ostracism and interpersonal
acceptance. Behavior Research Methods, Instruments, and Computers, 38, 174-180.

see also: http://www1.psych.purdue.edu/~willia55/Announce/cyberball.htm

                                              *Task*
Participant plays ball with 3 other participants (= the computer). It can be predefined with what
probability the computer includes/excludes the participant into the ball game.


DATA FILE INFORMATION:
The default data stored in the data files are:

(1) Raw data file: '4PlayerCyberball_raw*.iqdat' (a separate file for each participant)

build:                            Inquisit build
computer.platform:                the platform the script was run on
date, time, subject, group:        date and time script was run with the current subject/groupnumber
blockcode, blocknum:            the name and number of the current block
trialcode, trialnum:             the name and number of the currently recorded trial
                                    (Note: not all trials that are run might record data)
                                Trialcode Explanation:
                                Examples:
                                    "1to2" => in this trial player 2 (participant) throws the ball AFTER getting it from player 1
                                    "1to3" => in this trial player 3 throws the ball AFTER getting it from player 1 (random selection decides whether player 3 throws to player 1)
/player:                        stores the current player
/recipient:                        stores the recipient of the current ball toss (1, 2, 3, 4)                               
response:                        the (participant's) response
latency:                         the response latency in ms (for trials in which player 1 and 3 "play", the latency
                                is the randomly selected trialduration)
/count_ignore2:                    counts how often player 2 (participant) was "ignored" before a throw (resets every time
                                player 2 gets to throw the ball)

(2) Summary data file: '4PlayerCyberball_summary*.iqdat' (a separate file for each participant)

script.startdate:                date script was run
script.starttime:                time script was started
script.subjectid:                subject id number
script.groupid:                    group id number
script.elapsedtime:                time it took to run script (in ms)
computer.platform:                the platform the script was run on
/completed:                        0 = script was not completed (prematurely aborted); 1 = script was completed (all conditions run)
/showpictures:                    true = pictures of players are onscreen (default)
                                false = no pictures are presented
/showlabels:                    true = labels of players are onscreen (default)
                                false = no labels are presented

item.player1.1-
item.player4label.1:            images and labels used for the various players

/max_trialcount:                maximum number of trials (= passes between all players) played       

/ignore2_streak1:                 the number of times player 2 (participant) was ignored before player2 (participant) gets to respond for the first time
/max_ignore2:                    the longest streak of ignoring player 2 (participant) in the game that participant experienced
                                before being able to respond

/count_player2throws:            counts the number of times that player 1 gets to throw the ball
/count_player2throws:            counts the number of times that player 3 gets to throw the ball
/count_player2throws:            counts the number of times that player 2 (participant) gets to throw the ball
/meanRT_player2:                mean latency (in ms) of player 2 (participant)

/count_12:                        counts the number of times that player 1 throws to player 2 (participant)
/perc_12:                        percentage of player 1 throws that play to player 2 (participant)
/count_21:                        counts the number of times that player 2 (participant) throws to player 1
/perc_21:                        percentage of player 2 throws (participant) that play to player 1
/meanRT_21:                        mean latency (in ms) of player 2 (participant) decisions to throw to player 1

(same for player 3 and 4)

/perc_sameplayer:                percentage of player 2 (participant) throws when player 2 throws the ball back to the player who threw the ball to participant
                                        Note: random selection -> 1/3 times of all player 2 throws
/perc_otherplayer:                percentage of player 2 (participant) throws when player 2 throws ball to the player who didn't threw the ball to participant
                                        Note: random selection -> 2/3 times of all player 2 throws
/meanRT_sameplayer:                mean latency (in ms) of trials in which player2 (participant) throws ball back to the player who threw the ball to participant
/meanRT_otherplayer:            mean latency (in ms) of trials in which player2 (participant) throws ball to a player who didn't threw the ball to participant



EXPERIMENTAL SET-UP
* Participant plays ball with 3 other players for 50 trials.
The number of trials can be edited under section EDITABLE PARAMETERS.

* By default, all players are represented by names and pictures.
Names and pictures can be edited under section EDITABLE STIMULI.
To remove names or pictures go to EDITABLE PARAMETERS.

* By default, player 1 throws the ball to participant (=player2)  with a pre-determined probability (default: 14% of the times)
as does Player 3 and 4 (default: 14% of the times). The probabilities can be edited under EDITABLE LISTS.
The player schedules can further be customized to dictate specific/fixed throw sequences for each of the
"computer player".Go to section EDITABLE LISTS for further instructions.

* Decision Times for Player 1,3 and 4 are controlled by expressions.cyberdecisiontime under
EDITABLE PARAMETERS.

STIMULI
picture examples are provided by Millisecond Software. They can easily be edited under section
Editable Stimuli

INSTRUCTIONS
can be edited under section Editable Instructions

EDITABLE CODE:
check below for (relatively) easily editable parameters, stimuli, instructions etc.
Keep in mind that you can use this script as a template and therefore always "mess" with the entire code to further customize your experiment.

The parameters you can change are:

/max_trialcount:    maximum number of trials (= passes between the players) played       
/showpictures:        true = pictures of players are onscreen (default)
                    false = no pictures are presented
/showlabels:        true = labels of players are onscreen (default)
                    false = no labels are presented
                       
NOTE: parameters.showpictures and parameters.showlabels cannot be set to false at the same time.

/ cyberdecisiontime:         selects without replacement (noreplace) one of the 4 decision times for players1,3 and 4

</usermanual>


**************************************************************************************************************
**************************************************************************************************************
    EDITABLE PARAMETERS: change editable parameters here
**************************************************************************************************************
**************************************************************************************************************

<parameters>
/ max_trialcount = 10
/ showpictures = true
/ showlabels = true
</parameters>


<expressions>
/ cyberdecisiontime = noreplace(500, 1000, 1500, 2000)
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE STIMULI: change editable stimuli here
**************************************************************************************************************
**************************************************************************************************************

***********************
Player Pictures
***********************
<item player1>
/ 1 = "cassie.jpg"
</item>

<item player2>
/ 1 = "kip.jpg"
</item>

<item player3>
/ 1 = "trevor.jpg"
</item>

<item player4>
/ 1 = "sean.jpg"
</item>
***********************
Player Labels
***********************

<item player1label>
/ 1 = "Cassie"
</item>

<item player3label>
/ 1 = "Trevor"
</item>

<item player4label>
/ 1 = "Sean"
</item>

fills in automatically:
<item player2label>
/ 1 = "<%capitalize(textbox.name.response)%>"
</item>

***********************
Animation Movies
***********************
<item animations>
/ 1 = "1to2.gif"
/ 2 = "1to3.gif"
/ 3 = "1to4.gif"
/ 4 = "2to1.gif"
/ 5 = "2to3.gif"
/ 6 = "2to4.gif"
/ 7 = "3to1.gif"
/ 8 = "3to2.gif"
/ 9 = "3to4.gif"
/ 10 = "4to1.gif"
/ 11 = "4to2.gif"
/ 12 = "4to3.gif"
</item>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE INSTRUCTIONS: change instructions here
**************************************************************************************************************
**************************************************************************************************************

<item instructions>
/ 1 = "Welcome to Cyberball, the Interactive Ball-Tossing Game Used for Mental Visualization!"

/ 2 = "In the upcoming experiment, we test the effects of practicing mental visualization on task performance. Thus, we need you to practice your mental visualization skills. We have found that the best way to do this is to have you play an on-line ball tossing game with other participants who are logged on at the same time.

In a few moments, you will be playing a ball tossing game with other students over our network. The game is very simple. When the ball is tossed to you, simply <%expressions.buttoninstruct2%> the player you want to throw it to.

What is important is not your ball tossing performance, but that you MENTALLY visualize the entire experience. Imagine what the others look like. What sort of people are they? Where are you playing? Is it warm and sunny or cold and rainy? Create in your mind a complete mental picture of what might be going on if you were playing this game in real life.

Okay, ready to begin? Please <%expressions.buttoninstruct1%> 'Start' to begin."
</item>

****************************************************************************************************
general instruction expressions: adjust the instruction text depending on device used to run script
****************************************************************************************************
<expressions>
/ buttoninstruct1 = if (computer.touch && !computer.haskeyboard) {"Touch";} else {"click";}
/ buttoninstruct2 = if (computer.touch && !computer.haskeyboard) {"touch";} else {"click on";}
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE LISTS: change editable lists here
**************************************************************************************************************
**************************************************************************************************************

Note: by default players 1, 3 and 4 throw to player 2 roughly 14% of the time (1 out 7 times)

The item lists of these schedules can be further controlled by setting a specific/fixed throw sequence:
Example Player 1:

/items = (3, 4, 2, 3, 4, 4, 3, 3, 4, 4, 4, 3, 3, 2, 3, 2, 4, 2, 3, 3, 4, 4, 3, 3, 4)
/selectionmode = sequence

(if selectionmode = sequence => it is suggested to create the list as long as (parameters.max_trialcount/2)
to ensure that the beginning of the list does NOT get repeated)

<list player1schedule>
/ items = (3, 3, 3, 3, 3, 3, 2, 4)
/ replace = false
</list>

<list player3schedule>
/ items = (1, 1, 4, 4, 2, 2)
/ replace = false
</list>

<list player4schedule>
/ items = (3, 3, 3, 3, 3, 3, 2, 1)
/ replace = false
</list>

**************************************************************************************************************
                                !!!REMAINING CODE: Customize after careful consideration only!!!
**************************************************************************************************************


**************************************************************************************************************
**************************************************************************************************************
    DEFAULTS
**************************************************************************************************************
**************************************************************************************************************
script requires Inquisit 5.0.0.0 or higher

<defaults>
/ canvasaspectratio = (4,3)
/ minimumversion = "5.0.0.0"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ txbgcolor = white
/ txcolor = black
/ inputdevice = mouse
</defaults>

**************************************************************************************************************
**************************************************************************************************************
    DATA
**************************************************************************************************************
**************************************************************************************************************
*************
raw data
*************

<data>
/ separatefiles = true
/ columns = (build, computer.platform, date, time, subject, group, blockcode, blocknum, trialcode, trialnum,
            values.player, values.recipient, response, latency,
            values.count_ignore2)

</data>

*************
summary data: remove variables that are not of interest
*************

<summarydata>
/ columns = (script.startdate, script.starttime, script.subjectid, script.groupid, script.elapsedtime, computer.platform, values.completed,
            parameters.showpictures, parameters.showlabels,
            item.player1.1, item.player1label.1, item.player2.1, item.player2label.1, item.player3.1, item.player3label.1, item.player4.1, item.player4label.1,
            parameters.max_trialcount, values.ignore2_streak1, values.max_ignore2,
            values.count_player1throws, values.count_player3throws, values.count_player4throws, values.count_player2throws, expressions.meanRT_player2,
            values.count_12, expressions.perc_12, values.count_21, expressions.perc_21, expressions.meanRT_21,
            values.count_32, expressions.perc_32, values.count_23, expressions.perc_23, expressions.meanRT_23,
            values.count_42, expressions.perc_42, values.count_24, expressions.perc_24, expressions.meanRT_24,
            expressions.perc_sameplayer, expressions.perc_otherplayer, expressions.meanRT_sameplayer, expressions.meanRT_otherplayer)
/ separatefiles = true
</summarydata>

**************************************************************************************************************
**************************************************************************************************************
    AUTOMATICALLY UPDATED VALUES
**************************************************************************************************************
**************************************************************************************************************
/completed:                            0 = script was not completed; 1 = script was completed (all conditions run)

/player:                            stores the current player (1, 2, 3, 4)
/recipient:                            stores the recipient of the current ball toss (1, 2, 3, 4)

/count_player1throws:                counts the number of times that player 1 gets to throw the ball
/count_player3throws:                counts the number of times that player 3 gets to throw the ball
/count_player4throws:                counts the number of times that player 4 gets to throw the ball
/count_player2throws:                counts the number of times that player 2 (participant) gets to throw the ball

/sumrt_player2:                        sums the latencies of player2 throws (participant)
/sumrt_21:                            sums the latencies of player 2 throws (participant) to player 1
/sumrt_23:                            sums the latencies of player 2 throws (participant) to player 3
/sumrt_24:                            sums the latencies of player 2 throws (participant) to player 4

/count_ignore2:                        counts how often player 2 (participant) was "ignored" before a throw (resets every time
                                    player 2 gets to throw the ball)
/max_ignore2:                        the longest streak of ignoring player 2 in the game that participant experienced
                                    before responding
/ignore2_streak1:                     the ignorestreak before player2 (participant) gets to respond for the first time

/count_12:                            counts the number of times that player 1 throws to player 2 (participant)
/count_32:                            counts the number of times that player 3 throws to player 2 (participant)
/count_13:                            counts the number of times that player 1 throws to player 3
/count_31:                            counts the number of times that player 3 throws to player 1
/count_21:                            counts the number of times that player 2 (participant) throws to player 1
/count_23:                            counts the number of times that player 2 (participant) throws to player 3
/count_41:                            counts the number of times that player 4 throws to player 1
/count_43:                            counts the number of times that player 4 throws to player 3
/count_42:                            counts the number of times that player 4 throws to player 2 (participant)
/count_14:                            counts the number of times that player 1 throws to player 4
/count_24:                            counts the number of times that player 2 (participant) throws to player 4
/count_34:                            counts the number of times that player 3 throws to player 4

/count_121:                            counts how often player2 (participant) throws the ball back to player 1 (after getting it from player 1)
/count_323:                            counts how often player2 (participant) throws the ball back to player 3 (after getting it from player 3)
/count_424:                            counts how often player2 (participant) throws the ball back to player 4 (after getting it from player 4)

/count_123:                            counts how often player2 (participant) throws the ball to player 3 after getting it from player 1
/count_321:                            counts how often player2 (participant) throws the ball to player 1 after getting it from player 3
/count_124:                            counts how often player2 (participant) throws the ball to player 4 after getting it from player 1
/count_324:                            counts how often player2 (participant) throws the ball to player 4 after getting it from player 3
/count_421:                            counts how often player2 (participant) throws the ball to player 1 after getting it from player 4
/count_423:                            counts how often player2 (participant) throws the ball to player 3 after getting it from player 4

/sumrt_121:                            sums latencies for all trials in which player2 (participant) throws the ball back to player 1  (after getting it from player 1)
/sumrt_323:                            sums latencies for all trials in which player2 (participant) throws the ball back to player 3 (after getting it from player 3)
/sumrt_424:                            sums latencies for all trials in which player2 (participant) throws the ball back to player 4 (after getting it from player 4)
/sumrt_123:                            sums latencies for all trials in which player2 (participant) throws the ball to player 3 after getting it from player 1
/sumrt_321:                            sums latencies for all trials in which player2 (participant) throws the ball to player 1 after getting it from player 3
/sumrt_124:                            sums latencies for all trials in which player2 (participant) throws the ball to player 4 after getting it from player 1
/sumrt_324:                            sums latencies for all trials in which player2 (participant) throws the ball to player 4 after getting it from player 3
/sumrt_421:                            sums latencies for all trials in which player2 (participant) throws the ball to player 1 after getting it from player 4
/sumrt_423:                            sums latencies for all trials in which player2 (participant) throws the ball to player 3 after getting it from player 4

<values>
/ completed = 0
/ player = 0
/ recipient = 0

/ count_player1throws = 0
/ count_player3throws = 0
/ count_player4throws = 0
/ count_player2throws = 0

/score1 = 100
/score3 = 100
/score4 = 100

/ sumrt_player2 = 0
/ sumrt_21 = 0
/ sumrt_23 = 0
/ sumrt_24 = 0

/ count_ignore2 = 0
/ max_ignore2 = 0
/ ignore2_streak1 = 0

/ count_12 = 0
/ count_32 = 0
/ count_13 = 0
/ count_31 = 0
/ count_21 = 0
/ count_23 = 0
/ count_14 = 0
/ count_24 = 0
/ count_34 = 0
/ count_41 = 0
/ count_42 = 0
/ count_43 = 0

/ count_121 = 0
/ count_323 = 0
/ count_424 = 0
/ count_123 = 0
/ count_321 = 0
/ count_124 = 0
/ count_324 = 0
/ count_421 = 0
/ count_423 = 0

/ sumrt_121 = 0
/ sumrt_323 = 0
/ sumrt_424 = 0
/ sumrt_123 = 0
/ sumrt_321 = 0
/ sumrt_124 = 0
/ sumrt_324 = 0
/ sumrt_421 = 0
/ sumrt_423 = 0
</values>

**************************************************************************************************************
**************************************************************************************************************
    EXPRESSIONS
**************************************************************************************************************
**************************************************************************************************************
/meanRT_player2:            mean latency of player 2 throws (participant)
/meanRT_21:                    mean latency of player 2 (participant) decisions to throw to player 1
/meanRT_23:                    mean latency of player 2 (participant) decisions to throw to player 3
/meanRT_24:                    mean latency of player 2 (participant) decisions to throw to player 4

/perc_12:                    percentage of player 1 throws that play to player 2 (participant)
/perc_21:                    percentage of player 2 throws (participant) that play to player 1
/perc_32:                    percentage of player 3 throws that play to player 2 (participant)
/perc_23:                    percentage of player 2 throws (participant) that play to player 3
/perc_42:                    percentage of player 4 throws that play to player 2 (participant)
/perc_24:                    percentage of player 2 throws (participant) that play to player 4

/perc_sameplayer:            percentage of player 2 (participant) throws when player 2 throws the ball back to the player who threw the ball to participant
                                Note: random selection would suggest 1/3 of all player 2 throws
/perc_otherplayer:            percentage of player 2 (participant) throws when player 2 throws ball to a player who didn't threw the ball to participant
                                Note: random selection would suggest 2/3 of all player 2 throws

/meanRT_sameplayer:            mean latencies of trials in which player2 (participant) throws ball back to the player who threw the ball to participant
/meanRT_otherplayer:        mean latencies of trials in which player2 (participant) throws ball to a player who didn't threw the ball to participant


<expressions>
/ meanRT_player2 = values.sumrt_player2/values.count_player2throws
/ meanRT_21 = values.sumrt_21/values.count_21
/ meanRT_23 = values.sumrt_23/values.count_23
/ meanRT_24 = values.sumrt_24/values.count_24


/ perc_12 = (values.count_12/values.count_player1throws) * 100
/ perc_21 = (values.count_21/values.count_player2throws) * 100
/ perc_32 = (values.count_32/values.count_player3throws) * 100
/ perc_23 = (values.count_23/values.count_player2throws) * 100
/ perc_42 = (values.count_42/values.count_player4throws) * 100
/ perc_24 = (values.count_24/values.count_player2throws) * 100

/ perc_sameplayer = ((values.count_121 + values.count_323 + values.count_424)/values.count_player2throws) * 100
/ perc_otherplayer = ((values.count_123 + values.count_321 + values.count_124 + + values.count_421 + values.count_324  + values.count_423)/values.count_player2throws) * 100

/ meanRT_sameplayer = (values.sumrt_121 + values.sumrt_323 + values.sumrt_424)/(values.count_121 + values.count_323 + values.count_424)
/ meanRT_otherplayer = (values.sumrt_123 + values.sumrt_321 + values.sumrt_124 + values.sumrt_421 + values.sumrt_324  + values.sumrt_423)/(values.count_123 + values.count_321 + values.count_124 + values.count_421 + values.count_324  + values.count_423)
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    INSTRUCTIONS:
**************************************************************************************************************
**************************************************************************************************************
<text welcome>
/ items = instructions
/ select = 1
/ position = (50%, 40%)
/ fontstyle = ("Arial", 2%, true, false, false, false, 5, 0)
/ txcolor = darkblue
/ valign = top
</text>

<text instructions>
/ items = instructions
/ select = 2
/ position = (50%, 45%)
/ fontstyle = ("Arial", 1.5%)
/ size = (80%, 30%)
/ hjustify = left
/ txcolor = darkblue
/ valign = top
</text>

*************ADDITIONAL STIMULI*****************
<text startlabel>
/ items = ("Start")
/ position = (50%, 80%)
/ fontstyle = ("Arial", 3%, false, false, true, false, 5, 0)
/ txcolor = blue
</text>

<picture cyberball>
/ items = ("cyberball.gif")
/ position = (50%, 10%)
/ size = (20%, 20%)
</picture>

<picture cyberboy>
/ items = ("cyberboy.gif")
/ position = (50%, 30%)
/ size = (20%, 20%)
</picture>

<shape blankscreen>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
</shape>

*************TRIALS & BLOCKS*****************
<trial instructions>
/ stimulusframes = [1=cyberball, cyberboy, welcome, instructions, startlabel]
/ validresponse = (startlabel)
/ responsemessage = (startlabel, blankscreen, 0)
/ recorddata = false
</trial>

<block instructions>
/ trials = [1=instructions; 2=name]
</block>

**************************************************************************************************************
**************************************************************************************************************
    PLAYER STIMULI
**************************************************************************************************************
**************************************************************************************************************

<picture player1>
/ items = player1
/ position = (25%, 53%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>

<text player1label>
/ items = player1label
/ position = (25%, 53%)
/ halign = center
/ valign = top
/ erase = false
</text>

<text player1score>
/ items = ("Taka: <%values.score1 -= values.count_player1throws%>")
/ position = (25%, 58%)
/ halign = center
/ valign = center
/ erase = false
</text>

<picture player2>
/ items = player2
/ position = (50%, 73%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>

<text player2label>
/ items = player2label
/ position = (50%, 73%)
/ valign = top
/ erase = false
</text>

<picture player3>
/ items = player3
/ position = (75%, 53%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>

<text player3label>
/ items = player3label
/ position = (75%, 53%)
/ valign = top
/ erase = false
</text>

<text player3score>
/ items = ("Taka: <%values.score3 -= values.count_player3throws%>")
/ position = (75%, 58%)
/ halign = center
/ valign = center
/ erase = false
</text>

<picture player4>
/ items = player4
/ position = (50%, 30%)
/ valign = bottom
/ erase = false
/ size = (10%, 10%)
</picture>


<text player4label>
/ items = player4label
/ position = (50%, 30%)
/ halign = center
/ valign = top
/ erase = false
</text>

<text player4score>
/ items = ("Taka: <%values.score4 -= values.count_player4throws%>")
/ position = (50%, 35%)
/ halign = center
/ valign = center
/ erase = false
</text>

<picture start>
/ items = ("start.gif")
/ erase = false
/ size = (30%, 32%)
</picture>

**************************************************************************************************************
**************************************************************************************************************
    ANIMATION VIDEOS
**************************************************************************************************************
**************************************************************************************************************
<video 1to2>
/ items = animations
/ select = 1
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 1to2_static>
/ items = animations
/ select = 1
/ size = (30%, 30%)
</picture>

<video 1to3>
/ items = animations
/ select = 2
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 1to3_static>
/ items = animations
/ select = 2
/ size = (30%, 30%)
</picture>

<video 1to4>
/ items = animations
/ select = 3
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 1to4_static>
/ items = animations
/ select = 3
/ size = (30%, 30%)
</picture>

<video 2to1>
/ items = animations
/ select = 4
/ playthrough = true
/ size = (30%, 30%)
</video>

<video 2to3>
/ items = animations
/ select = 5
/ playthrough = true
/ size = (30%, 30%)
</video>

<video 2to4>
/ items = animations
/ select = 6
/ playthrough = true
/ size = (30%, 30%)
</video>

<video 3to1>
/ items = animations
/ select = 7
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 3to1_static>
/ items = animations
/ select = 7
/ size = (30%, 30%)
</picture>

<video 3to2>
/ items = animations
/ select = 8
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 3to2_static>
/ items = animations
/ select = 8
/ size = (30%, 30%)
</picture>

<video 3to4>
/ items = animations
/ select = 9
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 3to4_static>
/ items = animations
/ select = 9
/ size = (30%, 30%)
</picture>

<video 4to1>
/ items = animations
/ select = 10
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 4to1_static>
/ items = animations
/ select = 10
/ size = (30%, 30%)
</picture>

<video 4to2>
/ items = animations
/ select = 11
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 4to2_static>
/ items = animations
/ select = 11
/ size = (30%, 30%)
</picture>

<video 4to3>
/ items = animations
/ select = 12
/ playthrough = true
/ size = (30%, 30%)
</video>

<picture 4to3_static>
/ items = animations
/ select = 12
/ size = (30%, 30%)
</picture>

**************************************************************************************************************
**************************************************************************************************************
    SURVEYPAGE: INQUIRIES ABOUT PLAYER
**************************************************************************************************************
**************************************************************************************************************
*you label gets dynamically set during runtime in surveypage.name
<text youlabel>
/ position = (50%, 80%)
/ valign = bottom
/ erase = false
</text>

<textbox name>
/ caption = "Please enter your name"
/ required = true
/ mask = alphabetic
/ position = (30%, 45%)
/ textboxsize = (50%, 5%)
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ responsefontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
</textbox>

<surveypage name>
/ showquestionnumbers = false
/ questions = [1=name]
/ ontrialend = [text.youlabel.item = textbox.name.response]
/ showpagenumbers = false
/ navigationbuttonfontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ navigationbuttonsize = (20%, 5%)
/ nextbuttonposition = (45%, 65%)
</surveypage>

**************************************************************************************************************
**************************************************************************************************************
    MAIN TRIALS
**************************************************************************************************************
**************************************************************************************************************

Note: trial.start always "plays" player 1 - a random selection decides whether player 1 throws to
player 3, player 2 or player 4 (-> list.player1schedule)

<trial start>
/ ontrialbegin = [
    values.player = 1;
    if (parameters.showpictures == true) {
        trial.start.insertstimulusframe(picture.player1, 1);
        trial.start.insertstimulusframe(picture.player2, 1);
        trial.start.insertstimulusframe(picture.player3, 1);
        trial.start.insertstimulusframe(picture.player4, 1)
    };
    if (parameters.showlabels == true) {
        trial.start.insertstimulusframe(text.player1label, 1);
        trial.start.insertstimulusframe(text.player2label, 1);
        trial.start.insertstimulusframe(text.player3label, 1);
        trial.start.insertstimulusframe(text.player4label, 1);
    };
    if (parameters.showlabels == true) {
        trial.start.insertstimulusframe(text.player1score, 1);
        trial.start.insertstimulusframe(text.player3score, 1);
        trial.start.insertstimulusframe(text.player4score, 1);
    };
]
/ stimulusframes = [1=start]
/ validresponse = (noresponse)
/ ontrialend = [
    trial.start.resetstimulusframes();
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0;
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1;
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1;
       
    };
   
]
/ trialduration = 0
/ branch = [
    if (list.player1schedule.currentvalue == 2) {
        trial.1to2;
    } else if (list.player1schedule.currentvalue == 3) {
        trial.1to3;
    } else if (list.player1schedule.currentvalue == 4) {
        trial.1to4;
    };
]
</trial>

Note: trial.1to2 => video shows player 1 throwing the ball to player 2 after expressions.cyberdecisiontime.
Player 2 (= values.player) then has to decide where to throw the ball next (= values.recipient)
<trial 1to2>
/ ontrialbegin = [
    values.player = 2;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    if (values.ignore2_streak1 == 0)
        values.ignore2_streak1 = values.max_ignore2;
    trial.1to2.insertstimulustime(video.1to2, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to2_static]
/ validresponse = (player1, player3, player4, player1label, player3label, player4label)
/ ontrialend = [
    trial.1to2.resetstimulusframes();
    values.sumrt_player2 += trial.1to2.latency;
    if (trial.1to2.response == "player1" || trial.1to2.response == "player1label") {
        values.recipient = 1;
        values.count_player2throws += 1;
        values.count_21 += 1;
        values.sumrt_21 += trial.1to2.latency;
        values.count_121 += 1;
        values.sumrt_121 += trial.1to2.latency;
    } else if (trial.1to2.response == "player3" || trial.1to2.response == "player3label") {
        values.recipient = 3;
        values.count_player2throws += 1;
        values.count_23 += 1;
        values.sumrt_23 += trial.1to2.latency;
        values.count_123 += 1;
        values.sumrt_123 += trial.1to2.latency;
    } else if (trial.1to2.response == "player4" || trial.1to2.response == "player4label") {
        values.recipient = 4;
        values.count_player2throws += 1;
        values.count_24 += 1;
        values.sumrt_24 += trial.1to2.latency;
        values.count_124 += 1;
        values.sumrt_124 += trial.1to2.latency;
    };
]
/ branch = [
    if (values.recipient == 1) {
        trial.2to1
    } else if (values.recipient == 3) {
        trial.2to3
    } else if (values.recipient == 4) {
        trial.2to4;
    };
]
</trial>

Note: trial.1to3 => video shows player 1 throwing the ball to player 3 after expressions.cyberdecisiontime.
Player 3 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player3schedule
<trial 1to3>
/ ontrialbegin = [
    values.player = 3;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2;
    };
    trial.1to3.insertstimulustime(video.1to3, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to3_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.1to3.resetstimulusframes();
    if (list.player3schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player3throws += 1;
        values.score3 -= 1;
        values.count_31 += 1;
        values.count_ignore2 += 1;
    } else if (list.player3schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player3throws += 1;
        values.score3 -= 1;
        values.count_32 += 1;
        values.count_ignore2 = 0;
    } else if (list.player3schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player3throws += 1;
        values.score3 -= 1;
        values.count_34 += 1;
        values.count_ignore2 += 1;
    };
]

/ branch = [
    if (list.player3schedule.currentvalue == 1) {
        trial.3to1;
    } else if (list.player3schedule.currentvalue == 2) {
        trial.3to2;
    } else if (list.player3schedule.currentvalue == 4) {
        trial.3to4;
    }
]
</trial>

Note: trial.1to4 => video shows player 1 throwing the ball to player 4 after expressions.cyberdecisiontime.
Player 4 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player4schedule
<trial 1to4>
/ ontrialbegin = [
    values.player = 4;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2
    };
    trial.1to4.insertstimulustime(video.1to4, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to4_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.1to4.resetstimulusframes();
    if (list.player4schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player4throws += 1;
        values.score4 -= 1;
        values.count_41 += 1;
        values.count_ignore2 += 1;
    } else if (list.player4schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player4throws += 1;
        values.score4 -= 1;
        values.count_42 += 1;
        values.count_ignore2 = 0;
    } else if (list.player4schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player4throws += 1;
        values.score4 -= 1;
        values.count_43 += 1;
        values.count_ignore2 += 1;
    };
]
/ branch = [
    if (list.player4schedule.currentvalue == 1) {
        trial.4to1;
    } else if (list.player4schedule.currentvalue == 2) {
        trial.4to2;
    } else if (list.player4schedule.currentvalue == 3) {
        trial.4to3;
    };
]
</trial>

Note: trial.2to1 => video shows player 2 throwing the ball to player 1.
Player 1 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player1schedule
<trial 2to1>
/ ontrialbegin = [
    values.player = 1;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2;
    };
]
/ stimulusframes = [1= 2to1]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0;
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1;
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1;
    };
]

/ branch = [
    if (list.player1schedule.currentvalue == 2) {
        trial.1to2;
    } else if (list.player1schedule.currentvalue == 3) {
        trial.1to3;
    } else if (list.player1schedule.currentvalue == 4) {
        trial.1to4;
    };
]
</trial>

Note: trial.2to3 => video shows player 2 throwing the ball to player 3.
Player 3 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player3schedule
<trial 2to3>
/ ontrialbegin = [
    values.player = 3;
    if (values.count_ignore2 > values.max_ignore2) {
        values.max_ignore2 = values.count_ignore2;
    };
]
/ stimulusframes = [1= 2to3]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    if (list.player3schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player3throws += 1;
        values.count_31 += 1;
        values.count_ignore2 += 1;
    } else if (list.player3schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player3throws += 1;
        values.count_32 += 1;
        values.count_ignore2 = 0;
    } else if (list.player3schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player3throws += 1;
        values.count_34 += 1;
        values.count_ignore2 += 1;
    };
]
/ branch = [
    if (list.player3schedule.currentvalue == 1) {
        trial.3to1;
    } else if (list.player3schedule.currentvalue == 2) {
        trial.3to2;
    } else if (list.player3schedule.currentvalue == 4) {
        trial.3to4;
    };
]
</trial>

Note: trial.2to4 => video shows player 2 throwing the ball to player 4.
Player 4 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player4schedule
<trial 2to4>
/ ontrialbegin = [values.player = 4]
/ ontrialbegin = [
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
]
/ stimulusframes = [1= 2to4]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    if (list.player4schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player4throws += 1;
        values.count_41 += 1;
        values.count_ignore2 += 1
    } else if (list.player4schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player4throws += 1;
        values.count_42 += 1;
        values.count_ignore2 = 0
    } else if (list.player4schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player4throws += 1;
        values.count_43 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player4schedule.currentvalue == 1)
        trial.4to1;
    else if (list.player4schedule.currentvalue == 2)
        trial.4to2;
    else if (list.player4schedule.currentvalue == 3)
        trial.4to3;
]
</trial>

Note: trial.3to2 => video shows player 3 throwing the ball to player 2 after expressions.cyberdecisiontime.
Player 2 (= values.player) then has to decide where to throw the ball next (= values.recipient)
<trial 3to2>
/ ontrialbegin = [
    values.player = 2;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    if (values.ignore2_streak1 == 0)
        values.ignore2_streak1 = values.max_ignore2;
    trial.3to2.insertstimulustime(video.3to2, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 3to2_static]
/ validresponse = (player1, player3, player4, player1label, player3label, player4label)
/ ontrialend = [
    trial.3to2.resetstimulusframes();
    values.sumrt_player2 += trial.3to2.latency;
    if (trial.3to2.response == "player1" || trial.3to2.response == "player1label") {
        values.recipient = 1;
        values.count_player2throws += 1;
        values.count_21 += 1;
        values.sumrt_21 += trial.3to2.latency;
        values.count_321 += 1;
        values.sumrt_321 += trial.3to2.latency
    } else if (trial.3to2.response == "player3" || trial.3to2.response == "player3label") {
        values.recipient = 3;
        values.count_player2throws += 1;
        values.count_23 += 1;
        values.sumrt_23 += trial.3to2.latency;
        values.count_323 += 1;
        values.sumrt_323 += trial.3to2.latency
    } else if (trial.3to2.response == "player4" || trial.3to2.response == "player4label") {
        values.recipient = 4;
        values.count_player2throws += 1;
        values.count_24 += 1;
        values.sumrt_24 += trial.3to2.latency;
        values.count_324 += 1;
        values.sumrt_324 += trial.3to2.latency
    };
]
/ branch = [
    if (values.recipient == 1)
        trial.2to1
    else if (values.recipient == 3)
        trial.2to3
    else if (values.recipient == 4)
        trial.2to4
]
</trial>

Note: trial.3to1=> video shows player 3 throwing the ball to player 1 after expressions.cyberdecisiontime.
Player 1 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player1schedule
<trial 3to1>
/ ontrialbegin = [
    values.player = 1;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.3to1.insertstimulustime(video.3to1, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 3to1_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.3to1.resetstimulusframes();
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player1schedule.currentvalue == 2)
        trial.1to2
    else if (list.player1schedule.currentvalue == 3)
        trial.1to3
    else if (list.player1schedule.currentvalue == 4)
        trial.1to4
]
</trial>

Note: trial.3to4=> video shows player 3 throwing the ball to player 4 after expressions.cyberdecisiontime.
Player 4 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player4schedule
<trial 3to4>
/ ontrialbegin = [
    values.player = 4;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.3to4.insertstimulustime(video.3to4, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 3to4_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.3to4.resetstimulusframes();
    if (list.player4schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player4throws += 1;
        values.count_41 += 1;
        values.count_ignore2 += 1
    } else if (list.player4schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player4throws += 1;
        values.count_42 += 1;
        values.count_ignore2 = 0
    } else if (list.player4schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player4throws += 1;
        values.count_43 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player4schedule.currentvalue == 1)
        trial.4to1
    else if (list.player4schedule.currentvalue == 2)
        trial.4to2
    else if (list.player4schedule.currentvalue == 3)
        trial.4to3
]
</trial>

Note: trial.4to2 => video shows player 4 throwing the ball to player 2 after expressions.cyberdecisiontime.
Player 2 (= values.player) then has to decide where to throw the ball next (= values.recipient)
<trial 4to2>
/ ontrialbegin = [
    values.player = 2;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    if (values.ignore2_streak1 == 0)
        values.ignore2_streak1 = values.max_ignore2;
    trial.4to2.insertstimulustime(video.4to2, expressions.cyberdecisiontime);
]

/ stimulusframes = [1= 4to2_static]
/ validresponse = (player1, player3, player4, player1label, player3label, player4label)
/ ontrialend = [values.sumrt_player2 += trial.4to2.latency]
/ ontrialend = [
    trial.4to2.resetstimulusframes();
    if (trial.4to2.response == "player1" || trial.4to2.response == "player1label") {
        values.recipient = 1;
        values.count_player2throws += 1;
        values.count_21 += 1;
        values.sumrt_21 += trial.4to2.latency;
        values.count_421 += 1;
        values.sumrt_421 += trial.4to2.latency
    } else if (trial.4to2.response == "player3" || trial.4to2.response == "player3label") {
        values.recipient = 3;
        values.count_player2throws += 1;
        values.count_23 += 1;
        values.sumrt_23 += trial.4to2.latency;
        values.count_423 += 1;
        values.sumrt_423 += trial.4to2.latency
    } else if (trial.4to2.response == "player4" || trial.4to2.response == "player4label") {
        values.recipient = 4;
        values.count_player2throws += 1;
        values.count_24 += 1;
        values.sumrt_24 += trial.4to2.latency;
        values.count_424 += 1;
        values.sumrt_424 += trial.4to2.latency
    };
]
/ branch = [
    if (values.recipient == 1)
        trial.2to1
    else if (values.recipient == 3)
        trial.2to3
    else if (values.recipient == 4)
        trial.2to4
]
</trial>

Note: trial.4to1=> video shows player 4 throwing the ball to player 1 after expressions.cyberdecisiontime.
Player 1 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player1schedule
<trial 4to1>
/ ontrialbegin = [
    values.player = 1;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.4to1.insertstimulustime(video.4to1, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 4to1_static]
/ validresponse = (noresponse)
/ ontrialend = [
    trial.4to1.resetstimulusframes();
    if (list.player1schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player1throws += 1;
        values.count_12 += 1;
        values.count_ignore2 = 0
    } else if (list.player1schedule.nextvalue == 3) {
        values.recipient = 3;
        values.count_player1throws += 1;
        values.count_13 += 1;
        values.count_ignore2 += 1
    } else if (list.player1schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player1throws += 1;
        values.count_14 += 1;
        values.count_ignore2 += 1
    };
]
/ trialduration = expressions.cyberdecisiontime
/ branch = [
    if (list.player1schedule.currentvalue == 2)
        trial.1to2
    else if (list.player1schedule.currentvalue == 3)
        trial.1to3
    else if (list.player1schedule.currentvalue == 4)
        trial.1to4
]
</trial>

Note: trial.4to3=> video shows player 4 throwing the ball to player 3 after expressions.cyberdecisiontime.
Player 3 (= values.player) then has to 'decide' where to throw the ball next (= values.recipient) based on
list.player3schedule
<trial 4to3>
/ ontrialbegin = [
    values.player = 3;
    if (values.count_ignore2 > values.max_ignore2)
        values.max_ignore2 = values.count_ignore2;
    trial.4to3.insertstimulustime(video.4to3, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 4to3_static]
/ validresponse = (noresponse)
/ trialduration = 0
/ ontrialend = [
    trial.4to3.resetstimulusframes();
    if (list.player3schedule.nextvalue == 1) {
        values.recipient = 1;
        values.count_player3throws += 1;
        values.count_31 += 1;
        values.count_ignore2 += 1
    } else if (list.player3schedule.nextvalue == 2) {
        values.recipient = 2;
        values.count_player3throws += 1;
        values.count_32 += 1;
        values.count_ignore2 = 0
    } else if (list.player3schedule.nextvalue == 4) {
        values.recipient = 4;
        values.count_player3throws += 1;
        values.count_34 += 1;
        values.count_ignore2 += 1
    };
]
/ branch = [
    if (list.player3schedule.currentvalue == 1)
        trial.3to1
    else if (list.player3schedule.currentvalue == 2)
        trial.3to2
    else if (list.player3schedule.currentvalue == 4)
        trial.3to4
]
</trial>

**************************************************************************************************************
**************************************************************************************************************
    BLOCK
**************************************************************************************************************
**************************************************************************************************************
<block game>
/ trials = [1 = start]
/ stop = [block.game.trialcount >= parameters.max_trialcount]
</block>

**************************************************************************************************************
**************************************************************************************************************
    EXPERIMENT
**************************************************************************************************************
**************************************************************************************************************
<expt main>
/ blocks = [
    1=instructions;
    2=game;
]
/ onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************
                                        End of Script
**************************************************************************************************************

You need to display the score <text> elements via all your <trial> elements' /stimulusframes.

<trial 1to2>
/ ontrialbegin = [
  values.player = 2;
  if (values.count_ignore2 > values.max_ignore2)
   values.max_ignore2 = values.count_ignore2;
  if (values.ignore2_streak1 == 0)
   values.ignore2_streak1 = values.max_ignore2;
  trial.1to2.insertstimulustime(video.1to2, expressions.cyberdecisiontime);
]
/ stimulusframes = [1= 1to2_static, player1score, player3score, player4score]
...
</trial>

Further, the calculation is not correct. You'll want to integrate updating values.score1 to values.score3 in your <trial>s' existing /ontrialend logic. Then simply reference the value in the <text> element's /items, instead of applying another inline expression there.

<text player1score>
/ items = ("Taka: <%values.score1%>")
/ position = (25%, 58%)
/ halign = center
/ valign = center
/ erase = false
</text>

Finally, please don't paste entire scripts into a forum post. Instead please attach the script file and also always include any and all external files (images, etc..) the script requires to run. Put everything in a ZIP file and then attach the ZIP archive by clicking +Insert -> Add File.


Thank you! This was very helpful. As a brief follow-up question, how do I delay the timing for the updated stimulus frame such that the score updates only after the ball pass animation? I have it working now, but the score updates instantly upon next player's turn (instead of after the short video). Thanks again!

Display the text element in a later frame then, either using /stimulusframes

/ stimulusframes = [1= 1to2_static; 100 = player1score, player3score, player4score]

or use /stimulustimes instead of /stimulusframes throughout

/ stimulustimes = [0= 1to2_static; 1000= player1score, player3score, player4score]

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search