Trying to call data but get "array" instead of correct data

20 views
Skip to first unread message

Isabel Ford

unread,
Dec 5, 2024, 9:03:37 AM12/5/24
to LIONESS Lab help and discussion

Hello,

I am trying to seek help with Lioness. I have created a two-person game that repeats for three rounds.  After the loop is done, I have a few stages after for participants to complete individually.  The last screen is the conclusion screen.  This is where my issue is.  I need to get the number of points each player earned for round 1, 2 and 3 as one of the rounds is randomly selected for a bonus payment. I use the following code and get the correct data for the BlueOutcomes but get the term “array” instead of the points back for the GreenOutcomes: 


var BlueOutcome1 = getValue('decisions', 'playerNr='+playerNr+' and period=1', 'EndOfRoundPtsBlue');
var BlueOutcome2 = getValue('decisions', 'playerNr='+playerNr+' and period=2', 'EndOfRoundPtsBlue');
var BlueOutcome3 = getValue('decisions', 'playerNr='+playerNr+' and period=3', 'EndOfRoundPtsBlue');
record('BlueOutcome1',BlueOutcome1);
record('BlueOutcome2',BlueOutcome2);
record('BlueOutcome3',BlueOutcome3);
var GreenOutcome1 = getValue('decisions', 'playerNr='+playerNr+' and period=1', 'EndOfRoundPtsGreen1');
var GreenOutcome2 = getValue('decisions', 'playerNr='+playerNr+' and period=2', 'EndOfRoundPtsGreen1');
var GreenOutcome3 = getValue('decisions', 'playerNr='+playerNr+' and period=3', 'EndOfRoundPtsGreen1');
record('GreenOutcome1',GreenOutcome1);
record('GreenOutcome2',GreenOutcome2);
record('GreenOutcome3',GreenOutcome3);

Any guidance you can provide on this is greatly appreciated. 

 

Also, is there a way to call decisions from another player from a different period (i.e. can I call data  during period 4 for player one from player 2 from period 1)? 


Thank you for your help and have a great day. 







Lucas Molleman

unread,
Dec 5, 2024, 10:11:35 AM12/5/24
to Isabel Ford, LIONESS Lab help and discussion
Hi Isabel,

This might happen when "EndOfRoundPtsGreen1" is an array. Could you check how the values for that variable are saved in the decisions table?

Cheers, Lucas

--
You received this message because you are subscribed to the Google Groups "LIONESS Lab help and discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lioness-lab...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/lioness-lab/578e11e9-6d38-4c90-8667-40385d75b6f3n%40googlegroups.com.

Isabel Ford

unread,
Dec 5, 2024, 9:19:14 PM12/5/24
to LIONESS Lab help and discussion
Lucas  - thanks for the quick response.  However, I am uncertain how to tell if a variable in the decision table is saved as an array.  I simply see all the variables listed in the decision table.  Can you provide any guidance on how to determine if it is an array variable?  

I used the following code below to create the variable being discussed - perhaps this will provide some insight: 

         var OtherEndOfRoundPtsGreen = getValuesOthers('EndOfRoundPtsGreen');
          record('OtherEndOfRoundPtsGreen',OtherEndOfRoundPtsGreen);

          var EndOfRoundPtsGreen1 = OtherEndOfRoundPtsGreen;
          record('EndOfRoundPtsGreen1', EndOfRoundPtsGreen1);

Thank you for your assistance and enjoy the day. 
Best, 
Isabel 

in...@lioness-lab.org

unread,
Dec 6, 2024, 7:45:48 AM12/6/24
to Isabel Ford, LIONESS Lab help and discussion

Hi Isabel,

 

You initially retrieve it with getValuesOthers() which will presumably create an array of the values from other players in a group. If this is just a single other player, you could save it as OtherEndOfRoundPtsGreen[0], i.e. the first element in the array.

 

Cheers, Lucas

--

You received this message because you are subscribed to the Google Groups "LIONESS Lab help and discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lioness-lab...@googlegroups.com.

Isabel Ford

unread,
Dec 10, 2024, 10:09:12 AM12/10/24
to LIONESS Lab help and discussion
Thank you for your help.  Got it working the way I needed.  Have a great week and a Merry Christmas.  

Kindly, 
Isabel 

Reply all
Reply to author
Forward
0 new messages