Timeout Depending on Rounds

33 views
Skip to first unread message

Nanyin Yang

unread,
Sep 13, 2021, 11:58:26 AM9/13/21
to oTree help & discussion
Hi!

Is there a way to build the timeout depending on the round number? I want the timeout to be 180 seconds for round 1, and 90 seconds for the rest of the rounds. 

Thank you for any help in advance!

Nanyin

Chris @ oTree

unread,
Sep 13, 2021, 12:33:32 PM9/13/21
to Nanyin Yang, oTree help & discussion
get_timeout_seconds

Sent from my phone

On Sep 13, 2021, at 11:58 AM, Nanyin Yang <yangn...@tamu.edu> wrote:

Hi!

Is there a way to build the timeout depending on the round number? I want the timeout to be 180 seconds for round 1, and 90 seconds for the rest of the rounds. 

Thank you for any help in advance!

Nanyin

--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/1e454885-8ce1-4056-8270-11851bb1bf23n%40googlegroups.com.

Nanyin Yang

unread,
Sep 13, 2021, 1:10:54 PM9/13/21
to oTree help & discussion
Hi Chris,

Thank you for your reply! Could you specify how you would use this function under the page class? I read the tutorial but still cannot solve the problem.

This is what I did:
class communication(Page):
@staticmethod
def get_timeout_seconds(player):
if player.round_number == 1:
timeout_seconds = 180
else:
timeout_seconds = 90

And this is the error message I received:
get_timeout_seconds() missing 1 required positional argument: 'player'

Thank you!

Nanyin

Chris @ oTree

unread,
Sep 13, 2021, 1:17:42 PM9/13/21
to oTree help & discussion
Are you using oTree 5 and the new no-self format? (That code you wrote is for the new format.) See the note at the top of each documentation page.

Nanyin Yang

unread,
Sep 13, 2021, 1:24:10 PM9/13/21
to Chris @ oTree, oTree help & discussion
I guess that mine is an old version otree. I am not sure where to see the oTree version, but I installed this version maybe 2 years ago.

You received this message because you are subscribed to a topic in the Google Groups "oTree help & discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/otree/JjzePSCSs5g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/ebc8bed7-3917-4e71-b944-e2baf65eeb8an%40googlegroups.com.

Nanyin Yang

unread,
Sep 13, 2021, 4:00:25 PM9/13/21
to oTree help & discussion
Hi Chris,

Problem solved! The following code works:

def get_timeout_seconds(self):
if self.round_number == 1:
return 180
else:
return 90

Thank you!

Nanyin

Reply all
Reply to author
Forward
0 new messages