Page 1 of 1

Notify screen question : how to notify more than once

Posted: Mon Dec 11, 2017 9:01 am
by Doogy
Hi,
I am searching for a way to display more than one notify screen at the same time, like a stack of notify.
Does anyone have an idea how to do that ?

Re: Notify screen question : how to notify more than once

Posted: Fri Dec 15, 2017 2:07 am
by PyTom
Sorry, but that's not really a function of the notify screen. It's mostly meant for Ren'Py, showing things like fact that a screenshot is created, one at a time.

If you want to change the behavior, you'll have to make your own screen.

Re: Notify screen question : how to notify more than once

Posted: Sat Dec 16, 2017 7:06 am
by xavimat
Give this a try:

Code: Select all

default notices = []

label start:
    scene bg room
    show eileen happy
    
    $ notices.append("Hi! I'm a message!")
    $ notices.append("I'm a message too!")
    $ notices.append("Me too! Me too!")
    $ notices.append("Hey! This is kind of crowded!")
    $ notices.append("Give way! I'm an important message!")
    $ notify_me("Hey, don't push! We were here before!")
    
    "You've created a new Ren'Py game."
    
    $ notify_me("Phew... finally alone...")
    
    "Once you add a story, pictures, and music, you can release it to the world!"
    return

init python:

    def notify_me(m=""):
        global notices
        if m:
            notices.append(m)
        if notices:
            renpy.show_screen('notify_plus', notices=notices)
            notices = []

screen notify_plus(notices):

    zorder 100
    style_prefix "notify"

    for dd, i in enumerate(notices):
        frame at notify_plus_appear(dd*3.5):
            text i

    timer 4.25+(dd*3.5) action Hide('notify_plus')

transform notify_plus_appear(dd=0):
    on show:
        yoffset dd*7
        alpha 0 xanchor 1.0 xpos 0.0
        pause dd
        linear .25 alpha 1.0 xalign 0.0
        pause 3.25
        linear .5 alpha 0.0
Note that it doesn't adapts to new notices incoming in the middle of the stack, a new "notify_me()" function will overwrite the remaining stack and present the new one (as the current renpy.notify() does).
The stack is created with $ notices.append("Message"), but it's only shown when the function $notify_me("Message") is called. It passes the stack to the screen and empties it for new messages.