Multiple timed menus

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
DesertSkald
Newbie
Posts: 10
Joined: Sat Jun 14, 2014 6:55 pm
Location: the desert
Contact:

Multiple timed menus

#1 Post by DesertSkald »

Note: it's 2 in the morning so I hope this is readable..

Context: I'm trying to code an argument where the player has the option to speak up but the other characters continue speaking if the player keeps quiet.

What I'm looking for: I want the timer bar to show the player how much time is left in the argument before they lose their chance to speak up, not how much time is left until the other character starts talking.

What I think would work: a timed menu where the displayed 'timer' time is separate from the 'real' time that's used to advance dialogue OR
A way to auto-advance text after a set time that doesn't default to the first menu option.

I can add some basic code if that's what's needed, but the only difference from the cookbook is multiple 'menu1' labels and $ timer_jump jumps to the next one after $ time runs out, with a final jump after the argument ($ timer_range?) is over. I think I need to change the time in screen countdown (timer? bar? both?) or in the labels themselves, but this is where I'm hitting dead ends. If someone could help me with this, it'd be greatly appreciated

User avatar
78909087
Veteran
Posts: 277
Joined: Sat Aug 16, 2014 2:33 pm
Completed: Dungeons and Don't Do It, Wake Up
Projects: Lethe
IRC Nick: Pacermist
Contact:

Re: Multiple timed menus

#2 Post by 78909087 »

Interesting idea.
When you say that the others will continue talking if the user doesn't choose, would it be a better option to perhaps make smaller timers? Like in reality, where you only have so long to reply before your answer is irrelevant anyway, and they move on, so you have new options.
I am not friends with the sun.
Image

User avatar
Marionette
Regular
Posts: 128
Joined: Thu Apr 21, 2011 12:04 pm
Completed: https://marionette.itch.io/
Projects: Get Meowt of Here
Deviantart: rexx9224
itch: marionette
Location: Ireland
Discord: Marionette#2995
Contact:

Re: Multiple timed menus

#3 Post by Marionette »

You probably need another variable to control the choice made. so rather than having different jumps, your choice sets the variable and all options jump to a single point which uses the variable to decide where to go, that way you should be able to have a default value that gets chosen if the user doesn't pick anything, ie defaults to nothing happens.

I'm not sure how this works with your code, as if the first option still gets picked it may set the variable anyway, making the rest of the idea moot.

Might be better to do it with image button options that pop up and disappear independent of the main conversation thread rather than using a standard menu to avoid that. So when clicked they jump to the appropiate point, but if not clicked the story should continue as if they had never been there.

DesertSkald
Newbie
Posts: 10
Joined: Sat Jun 14, 2014 6:55 pm
Location: the desert
Contact:

Re: Multiple timed menus

#4 Post by DesertSkald »

78909087 wrote:Interesting idea.
When you say that the others will continue talking if the user doesn't choose, would it be a better option to perhaps make smaller timers? Like in reality, where you only have so long to reply before your answer is irrelevant anyway, and they move on, so you have new options.
I am currently using smaller timers, but I want to use a longer timer. I don't want the player to think they only have 2 seconds to make a choice when they actually have 6.
Marionette wrote:You probably need another variable to control the choice made. so rather than having different jumps, your choice sets the variable and all options jump to a single point which uses the variable to decide where to go, that way you should be able to have a default value that gets chosen if the user doesn't pick anything, ie defaults to nothing happens.

I'm not sure how this works with your code, as if the first option still gets picked it may set the variable anyway, making the rest of the idea moot.

Might be better to do it with image button options that pop up and disappear independent of the main conversation thread rather than using a standard menu to avoid that. So when clicked they jump to the appropiate point, but if not clicked the story should continue as if they had never been there.
Er, no. No, that's not what I'm trying to do (if I'm understanding you correctly). The menus and jumps work the way they're supposed to. It's the timer (well, I suppose the 'timer' part of the the menus too) that I'm trying to fix.

DesertSkald
Newbie
Posts: 10
Joined: Sat Jun 14, 2014 6:55 pm
Location: the desert
Contact:

Re: Multiple timed menus

#5 Post by DesertSkald »

Code: Select all

# You can place the script of your game in this file.

# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"

# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8")

transform alpha_dissolve:
    alpha 0.0
    linear 0.5 alpha 1.0
    on hide:
        linear 0.5 alpha 0
# This is to fade the bar in and out, and is only required once in your script

screen countdown:
    timer 0.01 repeat True action If(time > 0, true=SetVariable('time', time - 0.01), false=[Hide('countdown'), Jump(timer_jump)])
    bar value time range timerange xalign 0.5 yalign 0.1 xmaximum 300 at alpha_dissolve # This is the timer bar.

# The game starts here.
label start:
    "Lucy" "This is all your fault, Eileen. Cheating on the exam, what nerve.."

label timed_1:
    $ timerange = 6             #total time for the 'argument'
    $ time = 2                  #time for Eileen/Lucy to talk
    $ timer_jump = 'timed_2'    #label to jump to when time runs out
    show screen countdown
    menu: 
        e "You're the one that stole the exam answers."
        "Lie":
            jump lie
        "Truth":
            jump truth

label timed_2:
    $ time = 2
    $ timer_jump = 'timed_3'
    show screen countdown
    menu: 
        "Lucy" "I never cheat! You must have taken them!"
        "Lie":
            jump lie
        "Truth":
            jump truth

label timed_3:
    $ time = 2
    $ timer_jump = 'silent'
    show screen countdown
    menu: 
        e "I didn't steal the answer sheet!"
        "Lie":
            jump lie
        "Truth":
            jump truth

label silent:
    hide screen countdown
    "Lucy" "Yes you did! I saw it in your desk."
    return

label truth:
    hide screen countdown
    "-Lucy took the answer sheet, Mr. Richardson."
    return

label lie:
    hide screen countdown
    "-Eileen must have taken the answer sheet, Mr. Richardson. I trust Lucy."
return
Added the code in so other people can tinker with it or maybe understand what I'm trying to do better. It's a visual thing and I don't think I'm explaining it very well. :oops:

What I want the code to do is for the timer bar to start at 6 and count down, but for the text to jump to the next line of dialogue when the player's had enough time to read the current dialogue (the 2 second mark, 4 second mark, etc.), if the player hasn't made a choice before then. This code has the 'jump in 2s if player hasn't made a choice' part, but not the '6 and count down' part.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Kocker