#1 by PatrickT
I am coding a gift exchange experiment and was looking for some guidance on live pages. Each player is either a worker or a firm. Firms make wage offers and workers accept wage offers. When a worker accepts an offer, they input the bid number. The issue I am having is that the live_method is a player level function, so, when the worker accepts a bid, the only way I have figured out how to have a function execute for the respective firm is by having the live_method return a message to the JS page, and then to have the firm’s JS page send a new live_send. So, I have 2 cycles of my live_method and liveRecv going back and forth. I feel like there has to be a more efficient way to do this. Is there a way to have my live_method execute a group level function? Or, to have my player level live_method access another player’s variables? Thank you for any guidance you may provide
#2 by PatrickT
Hi all, I figured it out! I put the following code in my live_method(): temp_group=player.get_others_in_group() for p in temp_group: if p.bid_number==data["offer_number"]: firm=p if firm.firms_offer_accepted==False: ... I hope this helps anyone in the future that may need to access another player's variables in a player function!