[Solved] Displaying consecutive notifications

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
JustaHelpfulLurker
Newbie
Posts: 6
Joined: Sun Jan 14, 2018 8:42 pm
Contact:

[Solved] Displaying consecutive notifications

#1 Post by JustaHelpfulLurker »

I’m trying to display several notifications consecutively, without using renpy.pause (since that delays everything, not just notifications).

This is the code I have now:

Code: Select all

    $ renpy.notify("Message 1")
    $ ui.timer(3.25, Notify("Message 2"))
Unfortunately, it seems clicking interrupts the timer, preventing the second notification from displaying. Is there a way to keep this from happening? Or perhaps a better way to do what I'm trying to do?
Last edited by JustaHelpfulLurker on Mon Jan 15, 2018 4:09 pm, edited 1 time in total.

ReDZiX
Regular
Posts: 32
Joined: Thu Jan 04, 2018 12:42 pm
Contact:

Re: Displaying consecutive notifications

#2 Post by ReDZiX »

Don't know if it's what you're looking for but the code here might be of use:

viewtopic.php?f=8&t=47025&p=472212#p472212

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Displaying consecutive notifications

#3 Post by xavimat »

Try this (not tested):

Code: Select all

screen my_notify(messages):
    
    for n, i in enumerate(messages):        
        timer n*4 action Notify(i)
        
label start:
    
    show my_notify(["This is the first message", "This is the second Message", "This is the third message"])
    
    pause
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

JustaHelpfulLurker
Newbie
Posts: 6
Joined: Sun Jan 14, 2018 8:42 pm
Contact:

Re: Displaying consecutive notifications

#4 Post by JustaHelpfulLurker »

xavimat wrote: Mon Jan 15, 2018 11:49 am Try this (not tested):

Code: Select all

screen my_notify(messages):
    
    for n, i in enumerate(messages):        
        timer n*4 action Notify(i)
        
label start:
    
    show my_notify(["This is the first message", "This is the second Message", "This is the third message"])
    
    pause
Thank you! It worked after a couple changes. This is what it looks like now:

Code: Select all

screen my_notify(messages):
    
    for n, i in enumerate(messages):        
        timer max(0.01,n*4) action Notify(i)
    timer len(messages)*4 action Hide('my_notify')
        
label start:
    
    show screen my_notify(["This is the first message", "This is the second message", "This is the third message"])
    
    pause
The extra 0.01 seconds were added because the timer has to be >0.

EDIT 1: It only works the first set of notifications. Trying to show the screen again later doesn't work for some reason.

EDIT 2: The screen just needs to hide once all the notifications have displayed. Updated the code.

Post Reply

Who is online

Users browsing this forum: No registered users