Ren'Py Change UI text after a delay

obsessionau

Member
Game Developer
Sep 27, 2018
270
376
I am hoping someone with a bit more knowledge of RenPy can help.

I call a screen which updates the interface:
Code:
text "[clock.weekday] (Day: [clock.day])"
However what I would like to happen is for it to display the location the player has just gone to for x seconds and then replace that text with the date/time info.
This doesn't need to repeat.
I'm guessing there should be some way to encapsulate it in an image and then add that image to a animation?

335912
 

obsessionau

Member
Game Developer
Sep 27, 2018
270
376
Thank you!
My first attempt:

Code:
screen interface:
    zorder 100

    image "gui/interface/bar.png":
        ypos 674
    hbox:
        xpos 16 ypos 695
        text status_info
        timer 3.0 action Call("update_info")
    hbox:
        xpos 165 ypos 696
        image "[clock.time]"

label update_info:
    $ status_info = "{size=-8}{color=#AA3366}[clock.weekday]{/color} {/size}{size=-12}{color=#006666}(Day: [clock.day])"
This works, sort of. The problem I found was that whenever it hits the timer amount, the call also appears to progress the game.

So thanks Aon your page also helped! I had tried a few ways to set the variable straight from the timer action but it didn't work and resorted to the above as that was the only action examples seemed to give.
But SetVariable seems to be what I was after:
Code:
        timer 3.0 action SetVariable( "status_info", "{size=-8}{color=#AA3366}[clock.weekday]{/color} {/size}{size=-12}{color=#006666}(Day: [clock.day])" )
After all this I will probably have the location appear in a much larger font in the top left of the screen and then fade away, but I'll probably need the timer for that anyway so it was good to play around with!
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,228
This works, sort of. The problem I found was that whenever it hits the timer amount, the call also appears to progress the game.
Because Call isn't at all the right action choice for this particular case. You don't want to branch somewhere, just to update what is displayed. For this you can either change the value of a variable, like you ended doing it. You can also have a double display for the page itself ; something like this by example :

Code:
default locationName = ""

screen interface:

    zorder 100

    # Which variation of the screen to use.
    default locationVisible = True
    # After 3 seconds, fallback to the default display.
    timer 3.0 action SetScreenVariable( "locationVisible", False )

    image "gui/interface/bar.png":
        ypos 674

    hbox:
        xpos 16 ypos 695
        # Alternate display showing the location name
        if locationVisible is True:
            text "[locationName]"
        # Default display showing the day.
        else:
            text "{size=-8}{color=#AA3366}[clock.weekday]{/color} {/size}{size=-12}{color=#006666}(Day: [clock.day])"

    hbox:
        xpos 165 ypos 696
        image "[clock.time]"

label whatever:
    $ locationName = "somewhere"
    show screen interface
    "blablabla"