#1 by otree
Hi all, I'm coding a game that has four participants. There is a lottery through which I create couples of two players that will continue to play the game together. I want to inform each player about their lottery outcome and the lottery outcome of the other players. Given that the lottery is based on colors and not on numbers (I have four different colours), I would like to show the lottery outcomes by showing the label of the variable and not the value of the variable. My color lottery variable is stored in models as a integer variable. I have 1 (green) 2 (red) 3 (blue) 4 (black). I would like to tell each player: You picked green. Participant two picked red. Etc. How can I do this? I have this code that allows me to store the values for each player, but I would like to store the labels as well. def js_vars(self): return dict( #self attributes self_id = self.player.id_in_group, self_male = self.player.male, self_color_lottery = self.player.color_lottery, #all player attributes p1_color_lottery = self.group.get_player_by_id(1).color_lottery, p1_male = self.group.get_player_by_id(1).male, p2_color_lottery=self.group.get_player_by_id(2).color_lottery, p2_male=self.group.get_player_by_id(2).male, etc... ) Thanks so much for your help!