Is this text behaviour possible in Ren'py

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
mugenjohncel
Hentai Poofter
Posts: 2121
Joined: Sat Feb 04, 2006 11:13 pm
Organization: Studio Mugenjohncel
Location: Philippines
Contact:

Is this text behaviour possible in Ren'py

#1 Post by mugenjohncel »


CLICK HERE TO WATCH VIDEO

Is this text behaviour possible in Ren'py?... If it is... may I humbly beg how it is done?...

"POOF" (Disappears)

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Is this text behaviour possible in Ren'py

#2 Post by PyTom »

The closest I was able to get to this effect was with:

Code: Select all


transform whatfx:
    xalign 0.5 yalign 0.5

    on show:
        yoffset -100.0 alpha 0.0
        linear .1 yoffset 0.0 alpha 1.0
    on replace:
        yoffset -100.0 alpha 0.0
        linear .1 yoffset 0.0 alpha 1.0

    on hide:
        linear .1 yoffset 100.0 alpha 0.0
    
    
    # on replaced:
    #    linear .1 yoffset 100.0 alpha 0.0

screen say:
    text what id "what" at whatfx
    use quick_menu
This doesn't work well, however, since the disappearing text is instantly replaced with the entering text. That's due to an issue with Ren'Py, and how hiding something and then showing it again will terminate the "on hide" handler. I will likely fix that at some point, but it will take a major version to do so.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
mugenjohncel
Hentai Poofter
Posts: 2121
Joined: Sat Feb 04, 2006 11:13 pm
Organization: Studio Mugenjohncel
Location: Philippines
Contact:

Re: Is this text behaviour possible in Ren'py

#3 Post by mugenjohncel »

PyTom wrote:This doesn't work well, however, since the disappearing text is instantly replaced with the entering text. That's due to an issue with Ren'Py, and how hiding something and then showing it again will terminate the "on hide" handler.
Thanks!... This will do for now... One last thing...how to position the text about 200px down instead of being at the very center?

"POOF" (Disappears)

pwisaguacate
Veteran
Posts: 356
Joined: Mon Mar 11, 2013 11:03 pm
Contact:

Re: Is this text behaviour possible in Ren'py

#4 Post by pwisaguacate »

..."    xalign 0.5 yalign 0.5    "...

Kinsman
Regular
Posts: 130
Joined: Sun Jul 26, 2009 7:07 pm
Location: Fredericton, NB, Canada
Contact:

Re: Is this text behaviour possible in Ren'py

#5 Post by Kinsman »

You're lucky I was doing some similar experiments in the weeks before your question came up.

The trick is to keep the old and new text in separate variables, and also to make sure the say screen doesn't re-animate the two sentences, if you're doing something other than changing the dialogue. You can use Character callbacks to manage both.

Here's a project file with a demonstration. Hope you can use it.
Attachments
ScrollSay.zip
(639.45 KiB) Downloaded 181 times
Flash To Ren'Py Exporter
See the Cookbook thread

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Is this text behaviour possible in Ren'py

#6 Post by xavimat »

Kinsman wrote:You're lucky I was doing some similar experiments in the weeks before your question came up.

The trick is to keep the old and new text in separate variables, and also to make sure the say screen doesn't re-animate the two sentences, if you're doing something other than changing the dialogue. You can use Character callbacks to manage both.

Here's a project file with a demonstration. Hope you can use it.
This effect is really nice!

I've been trying to change the color of the text (because there is no name of the character). The "what_color" in the Character definition works for the entering text (new_text), but the exiting text turns to white. How is it possible to do it?
Thanks!
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

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

Re: Is this text behaviour possible in Ren'py

#7 Post by Alex »

In say screen change the line

Code: Select all

text old_text style "say_dialogue" at say_exit
to

Code: Select all

text old_text id "what" style "say_dialogue" at say_exit

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Is this text behaviour possible in Ren'py

#8 Post by xavimat »

Thanks, Alex.
It works, but it doesn't solve the problem.
I'm trying to display a dialogue between two characters. To distinguish between them, I've tried "what_color". The point is that, when a new character speaks, the new text has the new color, but the old text, while disappears, should maintain its former color. With your code, the old text changes to the new color.

EDIT - SOLVED:
I've tried with what_prefix="{color=#44f}" (without what_suffix="{/color}"). And it works perfectly. :)

I've tried later with what_prefix="{color=#44f}", what_suffix="{/color}" but it raises an strange error: "Open text tag at end of string u'{colo'." When I click the "Ignore" button, the desired effect is shown correctly.
The exception is raised only when the script changes from a character to another, when the same character goes on, there is no error.

Maybe another variable to store the "old_color" is needed?
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot], snotwurm