How to have two instances of 'show text' simultaneously

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
Destiny-Smasher
Regular
Posts: 40
Joined: Wed Aug 09, 2017 7:10 pm
Projects: DownRight Fierce, Life is Strange: All Wounds
Tumblr: destiny-smasher.tumblr.com
itch: destiny-smasher
Contact:

How to have two instances of 'show text' simultaneously

#1 Post by Destiny-Smasher »

Having trouble figuring out this one since it's such a broad type of question for such a specific intention.

I've been learning ways to get more use out of the 'show text' function recently, but I can't figure out how I can get two instances of text to appear simultaneously. For instance, if I want to have two separate lines of separate text display on different parts of the screen at the same time, how do I make that happen? Do I have to define some kind of extra 'show text' function somehow?

User avatar
Jackkel Dragon
Veteran
Posts: 283
Joined: Mon Mar 31, 2014 7:17 pm
Organization: Nightshade, Team Despair
itch: jackkel-dragon
Location: USA
Contact:

Re: How to have two instances of 'show text' simultaneously

#2 Post by Jackkel Dragon »

I don't know if it works with text displayables, but maybe try using the "as" keyword? That's how images can be duplicated, at least.

Example:
show character as c1 at left
show character as c2 at right
Main Website
Includes information about and links to many of my current and past projects.

Major Game Projects
[Nightshade] Eldritch Academy, Eldritch University, Blooming Nightshade, Flowering Nightshade, Life as Designed
[Team Despair] Corpse Party D2 series

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

Re: How to have two instances of 'show text' simultaneously

#3 Post by Imperf3kt »

Code: Select all

show text _("my text")
show text _("My other text")
with none
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

User avatar
m_from_space
Miko-Class Veteran
Posts: 985
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: How to have two instances of 'show text' simultaneously

#4 Post by m_from_space »

Just create your own little screen!

Code: Select all

screen mytext(t1="", t2=""):
    text t1:
        pos (20, 20)
    text t2:
        align (0.5, 0.5)

label start:
    show screen mytext("This is a sentence.", "This one is centered.")

User avatar
Alex
Lemma-Class Veteran
Posts: 3095
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: How to have two instances of 'show text' simultaneously

#5 Post by Alex »

Yet another sample

Code: Select all

transform txt_pos(x=0, y=0):
    pos (x, y)

# The game starts here.

label start:
    "..."
    show text "Test 1" as txt1 at txt_pos(0.1, 0.1)
    show text "Test 2" as txt2 at txt_pos(0.5, 0.2)
    show text "Test 3" as txt3 at truecenter
    with Dissolve(2.0)
    "?!"

User avatar
Destiny-Smasher
Regular
Posts: 40
Joined: Wed Aug 09, 2017 7:10 pm
Projects: DownRight Fierce, Life is Strange: All Wounds
Tumblr: destiny-smasher.tumblr.com
itch: destiny-smasher
Contact:

Re: How to have two instances of 'show text' simultaneously

#6 Post by Destiny-Smasher »

Hm, I don't think any of these will work in my case (I tried everything but the screens option and nothing seemed to work), maybe since I'm using Random function to call random lines of dialogue. BUT, maybe this could help with something else down the line where pre-set lines are being used! Thanks for the advice everyone!

User avatar
m_from_space
Miko-Class Veteran
Posts: 985
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: How to have two instances of 'show text' simultaneously

#7 Post by m_from_space »

So, why didn't you test the screens option?

Make sure to understand that there is difference between "dialogue" and other kinds of text (like as part of the show text statements)!

So how do you call random lines of dialogue (which I assume are not really dialogue)?

User avatar
Destiny-Smasher
Regular
Posts: 40
Joined: Wed Aug 09, 2017 7:10 pm
Projects: DownRight Fierce, Life is Strange: All Wounds
Tumblr: destiny-smasher.tumblr.com
itch: destiny-smasher
Contact:

Re: How to have two instances of 'show text' simultaneously

#8 Post by Destiny-Smasher »

The implementation of the screens function didn't look like it'd be compatible with the dialogue I'm implementing, which uses a random function. So each time a particular instance of dialogue is needed, it'll pull from a pool and randomly pick one. I'm not sure if that's compatible with the screens function mentioned above, though could still be useful in cases where you're using pre-set lines of dialogue, I suspect!
define nemona_dodge = RandomDialogue('Missed me!{p}{bt=3}¡Jeje!{/bt}', '{bt=2}{i}Oooh,{/i}{/bt}{p}that’s a miss!', '{font=PokemonGb-RAeo.ttf}{size=-5}Bad RNG{/size}{/font}{p}for you, huh?', '{font=PokemonGb-RAeo.ttf}{size=-5}But it missed!{/size}{/font}{p}{bt=3}¡Jeje!{/bt}')
In my case, what I was wondering is, can I make a damage number (which itself is variable) pop up on screen as well as a random character line.
What I'm doing instead is having the random dialogue pop up over the character sprite, and then putting the "main text" in the narration box to show how much damage occurs. Which maybe actually works better, anyway. Though things like buffs/debuffs being applied could potentially utilize this same idea with two lines of dialogue appearing at once.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], decocloud