Timed choice bar not appearing?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
malakme
Newbie
Posts: 12
Joined: Fri Apr 26, 2019 6:34 pm
Contact:

Timed choice bar not appearing?

#1 Post by malakme » Fri Apr 26, 2019 7:22 pm

Hi! I'm testing out timed choices and having trouble, so I figured I'd ask for help.

The problem has been that my timed choices aren't activating. They aren't appearing in the launched game and they aren't timing out after the allotted time. I've tried these two methods shown in these links:

First I tried: https://www.renpy.org/wiki/renpy/doc/co ... imed_menus
(I'm assuming this one is outdated, like the page says. It gave me a lot of error messages, so I erased all the coding I tried for this link.)

Then I tried: https://patreon.renpy.org/timed-choice-menus.html
(This approach gave me no error messages, but it also didn't work. The timer bar didn't appear and there was no timeout when I didn't choose an option.)

It would be great if you could tell me what I did wrong and how to correct this.

For Reference

This is the script section that I'm trying to time (based on the second link above):

label continue5:
k "If someone attacks, it's best that you...?"
jump dodge1

label dodge1:

$ timeout_label = "attack_hit"

menu:
"Dodge!":
k "Yes, exactly! Looks like the code is working and everything! And using this script, timd codes should be easy to replicate in the future"
k "Prety handy, huh?"
jump continue6

"Dog!":
k "Well... not quite. Most people would dodge..."
k "Let's try this again."
jump continue5

"Dab!":
k "Haha!"
k "While that WOULD be an interesting reaction, I don't think it's the smartest thing to do in a fight!"
k "Let's try this again."
jump continue5

label nochoice1:
k "You didn't choose an option... Boo..."
k "Let's try this again."
jump continue5

This is the screen section that I changed starting on line #207:

screen choice(items):

# How long the player has to make a choice in timeout seconds.
default timeout = 5.0

# The label the player is sent to if they fail to make a choice in the time
# allotted. If None, the timeout is disabled.
default timeout_label = None

# A preference that enables or disables timed choices.
default persistent.timed_choices = True

screen choice(items):
style_prefix "choice"

vbox:
for i in items:
textbutton i.caption action i.action

if (timeout_label is not None) and persistent.timed_choices:

bar:
xalign 0.5
ypos 400
xsize 740
value AnimatedValue(old_value=1.0, value=0.0, range=1.0, delay=timeout)

timer timeout action Jump(timeout_label)

This is a pic of the launched game on the menu (that should be timed). The menu appears but not the timer.
https://docs.google.com/presentation/d/ ... slide=id.p

Thanks in advance for any help you can offer! :)

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Timed choice bar not appearing?

#2 Post by Alex » Sat Apr 27, 2019 6:10 am

In your code you have choice screen defined twice: the first time with just a number of variables and the second - actual screen with choices. So the second definition overwrites the first.

You shouldn't put timer variables inside a screen - delete the first 'screen choice(items):' line. The code should look exactly like in PyTom's sample.

User avatar
malakme
Newbie
Posts: 12
Joined: Fri Apr 26, 2019 6:34 pm
Contact:

Re: Timed choice bar not appearing?

#3 Post by malakme » Mon Apr 29, 2019 2:46 am

Thanks for you help, Alex! The problem is solved. :)

Post Reply

Who is online

Users browsing this forum: Google [Bot]