How to set up EEG triggers for Cyberball task.


Author
Message
S.T
S.T
S.T
posted Last Year HOT
Associate Member (229 reputation)Associate Member (229 reputation)Associate Member (229 reputation)Associate Member (229 reputation)Associate Member (229 reputation)Associate Member (229 reputation)Associate Member (229 reputation)Associate Member (229 reputation)Associate Member (229 reputation)
Group: Forum Members
Posts: 17, Visits: 81
Dear all,
Hello,

I hope this message finds you well.
I have a question about the EEG triggers.
I’m creating a Cyberball task for use in ERP experiment.

The task consists of 4 players (1 participant and 3 non-participants).
I want to create two main types of Triggers.
⓵When each player throws a pass
➁When a participant (P2) is choosing who to throw a pass to.

I am currently struggling with ⓵.
In ⓵, I want to change the type of trigger depending on who throws the pass and to whom.
(For example, "P1 (or P4) threw a pass to P3" is one type.)

Therefore, I coded the following, but it does not work.

<trial npctrial>
/ ontrialbegin = [
    values.received_from = values.ball_at;
    values.ball_at = values.throw_to;
    if (values.ball_at == 2) {
        values.player2received += 1;
    };
    expressions.set_offsets;
    
    values.player1state = (values.ball_at == 1) + 1;
    values.player2state = (values.ball_at == 2) + 1;
    values.player3state = (values.ball_at == 3) + 1;
    values.player4state = (values.ball_at == 4) + 1;
    values.player5state = (values.ball_at == 5) + 1;
    values.player6state = (values.ball_at == 6) + 1;
    values.player7state = (values.ball_at == 7) + 1;
    values.player8state = (values.ball_at == 8) + 1;
    values.player9state = (values.ball_at == 9) + 1;
    
    values.throw_to = list.throwschedule.nextvalue;
    values.delay = list.delayschedule.nextvalue;
    if (values.throw_to == 0){
    values.throw_to = list.npcs.nextindex;
    values.delay = round(rand(1, 4)) * 1000;
    };
    while (values.throw_to == values.ball_at){
        values.deprecated +=1;
        values.throw_to = list.throwschedule.nextvalue;
        values.delay = list.delayschedule.nextvalue;
    };
]

/ ontrialend = [
    values.realizedThrowSchedule = concat(values.realizedThrowSchedule, values.throw_to);
    values.throwcount += 1;
    if (values.ball_at == 2) {
        values.player2thrown += 1;
    };
    if (values.ball_at == 1) {
        values.player1thrown += 1;
    };
    if (values.ball_at == 3) {
        values.player3thrown += 1;
    };
    if (values.ball_at ==4) {
        values.player4thrown += 1;
    };
    
    if (values.ball_at == 1 && values.throw_to == 3) {
      port.p1p4top3(values.latncy);
        port.allbitstolow(values.latency+50);
    };
    if (values.ball_at == 1 && values.throw_to == 4) {
      port.p1p4top1p4(values.latncy);
        port.allbitstolow(values.latency+50);
    };
    if (values.ball_at == 3 && values.throw_to == 1) {
      port.p3top1p4(values.latncy);
        port.allbitstolow(values.latency+50);
    };
    if (values.ball_at == 3 && values.throw_to == 4) {
      port.p3top1p4(values.latncy);
        port.allbitstolow(values.latency+50);
    };
    if (values.ball_at == 4 && values.throw_to == 1) {
      port.p1p4top1p4(values.latncy);
        port.allbitstolow(values.latency+50);
    };
    if (values.ball_at == 4 && values.throw_to == 3) {
      port.p1p4top3(values.latncy);
        port.allbitstolow(values.latency+50);
    };
]

/ stimulusframes = [1=clearscreen, player1, player2, player3, player4, player5, player6, player7, player8, player9,
    player1label, player2label, player3label, player4label, player5label, player6label, player7label, player8label, player9label,
    player1avatar, player2avatar, player3avatar, player4avatar, player5avatar, player6avatar, player7avatar, player8avatar, player9avatar,
    stats2, stats1, stats3, stats4]

/ inputdevice = keyboard
/ showmousecursor = false
/ validresponse = (0)
/ trialduration = values.delay
/ branch = [
    return trial.throw;
]
</trial>

// handles the human player
<trial choicetime>
/ ontrialbegin = [
    values.received_from = values.ball_at;
    expressions.set_offsets;
    
    values.player2received += 1;
    
    values.player1state = 1;
    //catch
    values.player2state = 2;
    values.player3state = 1;
    values.player4state = 1;
    values.player5state = 1;
    values.player6state = 1;
    values.player7state = 1;
    values.player8state = 1;
    values.player9state = 1;
    
    values.ball_at = 2;
    values.throw_to = list.throwschedule.nextvalue;
    values.delay = list.delayschedule.nextvalue;
    
]
/ trialduration = 3000
/ stimulusframes = [1=clearscreen, player1, player2, player3, player4, player5, player6, player7, player8, player9,
    player1label, player2label, player3label, player4label, player5label, player6label, player7label, player8label, player9label,
    player1avatar, player2avatar, player3avatar, player4avatar, player5avatar, player6avatar, player7avatar, player8avatar, player9avatar,
    stats2, stats1, stats3, stats4, choicetime]
/ inputdevice = keyboard
/ branch = [
    return trial.player2;
]
</trial>


<trial player2>
/ ontrialbegin = [
    values.received_from = values.ball_at;
    expressions.set_offsets;
    
    values.player2received += 1;
    
    values.player1state = 1;
    //catch
    values.player2state = 2;
    values.player3state = 1;
    values.player4state = 1;
    values.player5state = 1;
    values.player6state = 1;
    values.player7state = 1;
    values.player8state = 1;
    values.player9state = 1;
    
    values.ball_at = 2;
    values.throw_to = list.throwschedule.nextvalue;
    values.delay = list.delayschedule.nextvalue;
    
]

/ ontrialend = [
    values.throw_to = substring(trial.player2.response, length(trial.player2.response)-1, 1);
    values.realizedThrowSchedule = concat(values.realizedThrowSchedule, values.throw_to);
    values.player2thrown += 1;
    values.throwcount += 1;
    if (trial.player2.response == 79) {
      port.p2top1p4(values.latncy);
        port.allbitstolow(values.latency+50);
    };
    if (trial.player2.response == 81) {
      port.p2top3(values.latncy);
        port.allbitstolow(values.latency+50);
    };
    if (trial.player2.response == 80) {
      port.p2top1p4(values.latncy);
        port.allbitstolow(values.latency+50);
    };
]

/ stimulusframes = [1=clearscreen, player1, player2, player3, player4, player5, player6, player7, player8, player9,
    player1label, player2label, player3label, player4label, player5label, player6label, player7label, player8label, player9label,
    player1avatar, player2avatar, player3avatar, player4avatar, player5avatar, player6avatar, player7avatar, player8avatar, player9avatar,
    stats2, stats1, stats3, stats4]

/ validresponse = ("1", "3", "2", player5, player6, player7, player8, player9)
/ responsemessage = ("1", player1click, 100)
/ responsemessage = ("3", player3click, 100)
/ responsemessage = ("2", player4click, 100)
/ responsemessage = (player5, player5click, 100)
/ responsemessage = (player6, player6click, 100)
/ responsemessage = (player7, player7click, 100)
/ responsemessage = (player8, player8click, 100)
/ responsemessage = (player9, player9click, 100)
/ inputdevice = keyboard
/ branch = [
  if (trial.player2.response == 79) {
      values.throw_to = 1; // use assignment operator, separate statements properly
   return trial.throw;
    };
]
/ branch = [
  if (trial.player2.response == 81) {
        values.throw_to = 3; // use assignment operator, separate statements properly
   return trial.throw;
    };
]
/ branch = [
  if (trial.player2.response == 80) {
        values.throw_to = 4; // use assignment operator, separate statements properly
   return trial.throw;
    };
]
</trial>

<port p2top1p4>
/ items = ("10010010")
/ port = LPT1
/ subport = data
</port>

<port p3toP1P4>
/ items = ("10010100")
/ port = LPT1
/ subport = data
</port>

<port p2top3>
/ items = ("01000010")
/ port = LPT1
/ subport = data
</port>

<port p3top2>
/ items = ("00100100")
/ port = LPT1
/ subport = data
</port>

<port p1p4top1p4>
/ items = ("10011001")
/ port = LPT1
/ subport = data
</port>

<port p1p4top2>
/ items = ("00101001")
/ port = LPT1
/ subport = data
</port>

<port p1p4top3>
/ items = ("01001001")
/ port = LPT1
/ subport = data
</port>


<port choicetime>
/ items = ("11111111")
/ port = LPT1
/ subport = data
</port>

<port allbitstolow>
/ items = ("00000000")
/ port = LPT1
/ subport = data
</port>

Does anyone know why and how to resolve this?
Thank you so much!

Best,
S.T

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
S.T - Last Year
Dave - Last Year
S.T - Last Year
Dave - Last Year
S.T - Last Year
S.T - Last Year
                         Most USB-to-parallel cables won't work. The drviers don't implement...
Dave - Last Year
                             Dear Dave, Thanks for the reply. I understand. Is there a way in...
S.T - Last Year
                                 No. Either get a suitable parallel port add-on card that provides a...
Dave - Last Year
                                     Dear Dave, OK, I understand. Thank you for your reply. Best, S.T
S.T - Last Year

Reading This Topic

Explore
Messages
Mentions
Search