[SOLVED] How to show updating text box

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
lxknvlk
Newbie
Posts: 4
Joined: Wed Feb 14, 2018 3:00 pm
Contact:

[SOLVED] How to show updating text box

#1 Post by lxknvlk »

So i have a day parameter in my game. I want it to be shown at the top left corner of my game.

Here is my game screen:
Image

I made the day counter appear like this:

$ui.frame(xpos=0, ypos=0)
$ui.text("Day [day]")

But how do i change its style? I havent found any documentation on this ui.frame. And if there is another way, how to do it?

Please help.
Last edited by lxknvlk on Wed Feb 14, 2018 5:15 pm, edited 1 time in total.

irredeemable
Regular
Posts: 78
Joined: Thu Feb 08, 2018 7:57 am
Contact:

Re: How to show updating text box

#2 Post by irredeemable »

Well, it is documented that it shouldn't be used. You should create a screen using screen language and display the information that way.

Code: Select all

screen hud():
    frame:
        text "Day [day]"

label start:
    $ day = "Monday"
    show screen hud
    "This should stay on the screen."
    $ day = "Tuesday"
    "Yep, it does."
    return

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: How to show updating text box

#3 Post by Imperf3kt »

It is not advised to use any variables that have not been defaulted.
It may be better to use it like this:

Code: Select all

screen hud():
    frame:
        text "Day [day]"

default day = 'Monday' # or any day of your choosing

label start:
    $ day = "Monday"

    show screen hud
    "This should stay on the screen."
    $ day = "Tuesday"
    "Yep, it does."
    return
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

lxknvlk
Newbie
Posts: 4
Joined: Wed Feb 14, 2018 3:00 pm
Contact:

Re: How to show updating text box

#4 Post by lxknvlk »

Thanks! It is working.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]