#1 by js8773420
Hi all, I am new to oTree and have been playing around to try to see if I can only show certain pages/text to certain participants. I have been attempting to use the def is_displayed function, but it appears to not be working properly when I try to show a certain page to multiple participants. For example, in my code, I wanted to show the nudge page to players 2 and 4 but it is only showing to P4. Also, I wanted to show the instruction_optimal page to players 3 and 4 but it is only showing to P4. And, I wanted to show the instruction_standard page to players 1 and 2, but it is only showing to P2. I assume this has something to do with otree not recognising the first def is_displayed function, but can someone please help to explain why, or how I can fix it? I have attached my _init_.py file if that helps. Thanks, JS
#2 by BonnEconLab
Hi, You’re right: There should be a single def is_displayed(player: Player), not multiple ones. Try replacing @staticmethod def is_displayed(player: Player): return player.id_in_group == 1 @staticmethod def is_displayed(player: Player): return player.id_in_group == 2 by @staticmethod def is_displayed(player: Player): return player.id_in_group in [1, 2] and so on. Best, Holger
#3 by js8773420
Thanks Holger!!