Multiple text displayables at once

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
csky
Regular
Posts: 93
Joined: Sun Sep 14, 2014 3:46 pm
Completed: Perceptions of the Dead, Embers of Magic
Projects: Various Commissioned Artwork
Contact:

Multiple text displayables at once

#1 Post by csky »

I'm trying to display two instances of the same text on different parts of the screen. I've gotten it to work exactly how I want with a single instance, but whenever I try to display two instances the text is overridden and will only display the second call
In the end I want to be able to display 7 different instances of displayable text on the screen at once, with different texts.

Here is the except of code:

Code: Select all

        $word2 = word
        show text "{nw=0.75}[word]" at group1pos
        show text "{nw=0.75}[word]" at group2pos
        pause 0.5
(The context of this is it is in a loop, every round it displays a new word)

In this case I want to display the same text at both positions. However it only displays it at group2pos.
I have read the entire section on text displayable https://www.renpy.org/doc/html/text.html, from this here are the following things I have tried.
1. I've tried defining a ParameterizedText() as text2. However this text remained static on the screen in a spot I didn't want it, and didn't vanish how it was supposed to afterward like the other text did.
2. defining stuff using Text() in various ways. Unfortunately in the documentation there are no examples of this in code so I'm not sure exactly what it does or how to implement it/make it work. For example trying to define text2 = Text('') brings up an error. Trying image text2 = Text("") brings up missing image. Trying show Text("") brings up the grey sprite silhouette
3. Tried defining a new word as "word2"
4. Showing 'as'
The closest thing I've gotten was doing this:

Code: Select all

define text2 = Text("{nw=0.75}[word]")
......
        $word2 = word
        show text "{nw=0.75}[word]" at group1pos
        show text2 at group2pos
        pause 0.5
        hide text2
This gets the text in the right location, but this is also not correct. This only works for one round, the "text2" is stuck on the same word while the other text at groupos1 is changing words. If I tried to take out the string in the brackets and then define it within the loop like the normal text it brings up a red image error.
I really just want something that will replicate the existing show text exactly while being able to display a difference instance of it. Any help is appreciated! I will continue experimenting in the meantime.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Multiple text displayables at once

#2 Post by Divona »

Use screen?

Code: Select all

screen my_text:
    text "{nw=0.75}[word]" at group1pos
    text "{nw=0.75}[word]" at group2pos
......
label show_text:
    show screen my_text
    pause 0.5
    hide screen my_text
Completed:
Image

User avatar
csky
Regular
Posts: 93
Joined: Sun Sep 14, 2014 3:46 pm
Completed: Perceptions of the Dead, Embers of Magic
Projects: Various Commissioned Artwork
Contact:

Re: Multiple text displayables at once

#3 Post by csky »

Divona wrote:Use screen?

Code: Select all

screen my_text:
    text "{nw=0.75}[word]" at group1pos
    text "{nw=0.75}[word]" at group2pos
......
label show_text:
    show screen my_text
    pause 0.5
    hide screen my_text
This just made the same thing happen where only the first one displays.
Although I can now combine this screen with the show text statement to make it so two different things display now, it is not going to be very efficient/effective when I need to display 7 or more things at once.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Multiple text displayables at once

#4 Post by Divona »

Right, so you want different text for each. You could use:

Code: Select all

define word1 = "One"
define word2 = "Two"
define word3 = "Three"
define word4 = "Four"
define word5 = "Five"
define word6 = "Six"
define word7 = "Seven"

screen my_text(w1="", w2="", w3="", w4="", w5="", w6="", w7=""):
    text w1 at group1pos
    text w2 at group2pos
    text w3 at group3pos
    text w4 at group4pos
    text w5 at group5pos
    text w6 at group6pos
    text w7 at group7pos

label show_text:
    show screen my_text(word1, word2, word3, word4, word5, word6, word7)
    pause 0.5
    hide screen my_text
This would give different text to display on all different 7 locations, if I understand correctly of what you're trying to do.
Just change "word" variables before the next round start, it should change the text when loop.
Completed:
Image

User avatar
csky
Regular
Posts: 93
Joined: Sun Sep 14, 2014 3:46 pm
Completed: Perceptions of the Dead, Embers of Magic
Projects: Various Commissioned Artwork
Contact:

Re: Multiple text displayables at once

#5 Post by csky »

Thank you for the screen suggestion. Unfortunately it didn't work out because I can't use ATL and transformations on the screens so I can't get them to do the same thing as the text... (if you know how to do this, ie move the screens around the area slowly, fade them in and out, that would also be helpful).

Post Reply

Who is online

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