config.overlay_screens actions

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
Mirrodin
Regular
Posts: 114
Joined: Sun Mar 19, 2017 2:56 pm
Contact:

config.overlay_screens actions

#1 Post by Mirrodin »

Hi,

I have a screen named "gold_overlay";

I add on my label like this :

Code: Select all

config.overlay_screens.append('gold_overlay')
it work fine.

Sometime i want to delete the overlay, the doc say its a list so i try "remove"

Code: Select all

$ config.overlay_screens.remove('gold_overlay')
didnt work at all, what is the specific action to do it.

The ambition behind this is to actualize the screen.
For text and object it actualize auto yes but for picture its not the case.

Code: Select all

screen gold_overlay():

     add "interface.png" align (0.5, 0) 
     add "credit.png" zoom 0.3 align (0.13, 0.02)
     text '{color=#000000}[inventaire_joueur.credit]{/color}' align (0.18, 0.03) 
     hbox:
         xsize 120+joueur.pm_max/4 ysize 30
         
         add "mana.png" zoom 0.15
         bar value AnimatedValue(joueur.pm_actu, range=joueur.pm_max) ysize 15 
         align (0.25, 0.045)
     hbox:
         xsize 120+joueur.pv_max/4 ysize 30
         add "hp.png" zoom 0.15
         bar value AnimatedValue(joueur.pv_actu, range=joueur.pv_max) ysize 15
         align (0.25, 0.022)         
         
     text '[joueur.pm_actu]/[joueur.pm_max]' align (0.28, 0.045) size 14
     text '[joueur.pv_actu]/[joueur.pv_max]' align (0.28, 0.022) size 14
     
     if inventaire_ok: 
        textbutton "Inventaire" style "lilbutton" text_style "lilbutton_text" action Jump("inventaire") align (0.45, 0.03)
     
     if inventaire_avance:
        textbutton "zzz"  action Jump("dormir") align (0.52, 0.03)
        if calendrier.statut == 'jour':
            textbutton "attendre la nuit"  action Jump("attendre_nuit") align (0.61, 0.03)
     
        text calendrier.affichage_cal(lang) align (0.80, 0.03)
        text '[calendrier.statut]' align (0.71, 0) 

     zorder 100
i have the if statement for example,
by default they dont actualize.

Is the remove/append on config.overlay, the good choice ?

Thanks,
just for the record (and i guess you notified this, english is not my first langage)

philat
Eileen-Class Veteran
Posts: 1912
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: config.overlay_screens actions

#2 Post by philat »

config variables are not supposed to be changed -- they are checked once at startup and then do not change. You can technically change them, but generally you shouldn't.

Frankly, in most instances, simply showing/hiding the overlay screen should suffice.

User avatar
Mirrodin
Regular
Posts: 114
Joined: Sun Mar 19, 2017 2:56 pm
Contact:

Re: config.overlay_screens actions

#3 Post by Mirrodin »

Yeap, its what i do after the non response.
i m glad its the good solution here.
Thanks Philat.

sg27digital
Newbie
Posts: 3
Joined: Sun Nov 06, 2022 6:22 pm
Contact:

Re: config.overlay_screens actions

#4 Post by sg27digital »

I was looking for an answer to this question, because it's really easier for me to have a screen added in config like that.
For a part of my game the screen I added like this was interfering with the gameplay, so my solution to hiding it is making sure that the screen you're adding has a zorder property, so you can add a different screen with a larger zorder property on top of it.

If the screen has buttons you don't want to be able to be used behind your other screen, you can make your new screen modal true, or you can set buttonsensitive data on the always-on screen, and control it that way.

Hope this helps anyone else looking into this.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]