custom notify screen help[solved]

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
Scribbles
Miko-Class Veteran
Posts: 636
Joined: Wed Sep 21, 2016 4:15 pm
Completed: Pinewood Island, As We Know It
Projects: In Blood
Organization: Jaime Scribbles Games
Deviantart: breakfastdoodles
itch: scribbles
Location: Ohio
Contact:

custom notify screen help[solved]

#1 Post by Scribbles » Sun Jul 30, 2017 12:46 pm

I'm trying to adjust the notify screen under certain circumstances and it's not working?

Code: Select all

screen notify(message):
    
    if message == ach_string:
        zorder 100
        style_prefix "not_ach"
        frame at truecenter:
            text ach_string style "not_ach" 
        
    else:

        zorder 100
        style_prefix "notify"

        frame at notify_appear:
            text message color "000000"

    timer 3.25 action Hide('notify')


transform notify_appear:
    on show:
        alpha 0
        linear .25 alpha 1.0
    on hide:
        linear .5 alpha 0.0


style notify_frame is empty
style notify_text is gui_text

style notify_frame:
    ypos gui.notify_ypos

    background Frame("gui/notify.png", gui.notify_frame_borders, tile=gui.frame_tile)
    padding gui.notify_frame_borders.padding

style notify_text:
    properties gui.text_properties("notify")
it just ignores the if statement and maintains the other notify styles

the notify is part of my achievements image map, so that when a player clicks on the achievement image they get a definition of what the achievement was for, and I just wanted to have a different style for that instance and not fully change all the notify messages -_-

Code: Select all

if persistent.ach01:
            $ ach_string = "Placeholder Text!"
            hotspot (114, 295, 185, 170) action Notify(ach_string)      
        else:
            pass
I define the style in a seperate .rpy file:

Code: Select all

init python:
    style.not_ach = Style(style.default)
    style.not_ach.color = "000000"
    style.not_ach.size = 50
    
Ideally I would like for a simple message to appear at true center and then fade away after a few seconds > < I'm sorry I'm not great at programming so I'm not sure why it's not working
Last edited by Scribbles on Sun Jul 30, 2017 3:19 pm, edited 1 time in total.
Image - Image -Image

User avatar
shin.e.d
Newbie
Posts: 22
Joined: Sat Jan 10, 2015 10:50 am
Projects: Data Lion and an unnamed bxb game with dinosaurs!
Contact:

Re: custom notify screen help

#2 Post by shin.e.d » Sun Jul 30, 2017 2:37 pm

Hey how about this? This worked in my test game when I tested it, so hopefully you can get it to work too.

switch notify example:

Code: Select all

screen testing_notify:
    tag menu
    use navigation

    ## sets the variable thats used in the notify screen's new if statement.
    on "replace" action SetVariable("switch_notify",True)
    on "show" action SetVariable("switch_notify",True)
    on "hide" action SetVariable("switch_notify",False)
    on "replaced" action SetVariable("switch_notify",False)

    ## example button that uses the different Notify in this screen.
    textbutton "test" action Notify("message here")

## define the variables. default saves itself on save/load so its not reset.
default switch_notify=False
style not_ach is default:
    color "#000"
    size 50

## Notify screen ###############################################################

screen notify(message):
    if switch_notify:
        zorder 100
        style_prefix "not_ach"
        frame at switch_notify_appear:
            text message style "not_ach" 
        
    else:
        zorder 100
        style_prefix "notify"
        frame at notify_appear:
            text message color "000000"

    timer 3.25 action Hide('notify')

transform switch_notify_appear:
    xalign 0.5 yalign 0.5
    on show:
        alpha 0
        linear .25 alpha 1.0
    on hide:
        linear .5 alpha 0.0

transform notify_appear:
    on show:
        alpha 0
        linear .25 alpha 1.0
    on hide:
        linear .5 alpha 0.0


User avatar
Scribbles
Miko-Class Veteran
Posts: 636
Joined: Wed Sep 21, 2016 4:15 pm
Completed: Pinewood Island, As We Know It
Projects: In Blood
Organization: Jaime Scribbles Games
Deviantart: breakfastdoodles
itch: scribbles
Location: Ohio
Contact:

Re: custom notify screen help

#3 Post by Scribbles » Sun Jul 30, 2017 3:23 pm

shin.e.d wrote:
Sun Jul 30, 2017 2:37 pm
Hey how about this? This worked in my test game when I tested it, so hopefully you can get it to work too.

switch notify example:

Code: Select all

screen testing_notify:
    tag menu
    use navigation

    ## sets the variable thats used in the notify screen's new if statement.
    on "replace" action SetVariable("switch_notify",True)
    on "show" action SetVariable("switch_notify",True)
    on "hide" action SetVariable("switch_notify",False)
    on "replaced" action SetVariable("switch_notify",False)

    ## example button that uses the different Notify in this screen.
    textbutton "test" action Notify("message here")

## define the variables. default saves itself on save/load so its not reset.
default switch_notify=False
style not_ach is default:
    color "#000"
    size 50

## Notify screen ###############################################################

screen notify(message):
    if switch_notify:
        zorder 100
        style_prefix "not_ach"
        frame at switch_notify_appear:
            text message style "not_ach" 
        
    else:
        zorder 100
        style_prefix "notify"
        frame at notify_appear:
            text message color "000000"

    timer 3.25 action Hide('notify')

transform switch_notify_appear:
    xalign 0.5 yalign 0.5
    on show:
        alpha 0
        linear .25 alpha 1.0
    on hide:
        linear .5 alpha 0.0

transform notify_appear:
    on show:
        alpha 0
        linear .25 alpha 1.0
    on hide:
        linear .5 alpha 0.0

Thank you! I managed to do what I wanted by creating a new screen, but I'll glance over your code too. :)
Image - Image -Image

Post Reply

Who is online

Users browsing this forum: Google [Bot]