Text Overlays

Sep 12, 2019
85
780
I’m probably stupid and missing something obvious, but I’ve scoured the documentation and Googled, but can't find an answer.

I want to have some information about the current state of the game displayed in the upper left hand corner of my game (or thereabouts). For example, the current day and time of day. My game is 2.35:1 letterboxed (for cinematic effect), so I don’t need a background image for the text. Just something to indicate that it’s March 20: Afternoon, that I can change without much fuss.

Is there an easy way to do this?
 

CrimsonAxisStudio

Member
Game Developer
Nov 7, 2017
271
1,585
Code:
screen myUI:
    frame:
        xalign 1.0
        yalign 0.0

        vbox:
            text "Today is [dayOfWeek]"
            text "You have [money]"

default dayOfWeek = "Monday"
default money = 100

label start:
    show screen myUI

Hello again!

Is it possible to display something like this at all times? Or do you need to "show screen myUI" after each label starts?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,964
16,211
Is it possible to display something like this at all times? Or do you need to "show screen myUI" after each label starts?
A shown screen will stay display as long as it's not explicitly hidden, or the whole display isn't totally reset. Therefore, normally just one show screen whatever is enough.
 
  • Like
Reactions: CrimsonAxisStudio

CrimsonAxisStudio

Member
Game Developer
Nov 7, 2017
271
1,585
Thank you! I ended up using $ modal = True to show the UI in other screens. Not sure this is the best way to go about it, but it does give me the ability to show information during gameplay.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,256
Thank you! I ended up using $ modal = True to show the UI in other screens. Not sure this is the best way to go about it, but it does give me the ability to show information during gameplay.
modal is usually for a UI element you want to be the ONLY focus while displayed.

By which I mean, all other elements on the screen become inactive - except for the new modal element.
Imagine a "Do you want to quit?" popup panel. You show it, but don't want the player clicking on anything else while it is on screen... that's modal.

There are exceptions to every rule... and if it's working for you - then don't worry about it.

That said, modal is usually part of the screen definition. Whereas you have said you've used $ modal = True. If I'm reading that right, you've just set a new variable called "modal" to True - and unless that is what you intended... you've effectively done nothing that would impact your game.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,964
16,211
If I'm reading that right, you've just set a new variable called "modal" to True - and unless that is what you intended... you've effectively done nothing that would impact your game.
You're reading it right. Even if the screen property was expecting an equal sign, the leading $ tell Ren'py that the line should be seen as inline Python code, and so be an assignation.