NVL Dialogue Transform only on incoming text?

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
vividXP
Regular
Posts: 53
Joined: Tue Jan 08, 2013 9:54 am
Projects: "Almost There" (NanoReno '14)
Location: Florida
Contact:

NVL Dialogue Transform only on incoming text?

#1 Post by vividXP »

What I'm generally trying to achieve is a fade in and slide from the left affect. I've only done the fade in effect and I came across an issue.

1. I need the dialogue to start from alpha 0 to visible. Right now it shows the text at 1.0 alpha then drops back down to 0, so it looks like blinking instead of fading in.

2. The transforms affect all the text on the screen. I want this transform to only affect that incoming dialogue.


My code

Code: Select all

transform what_fade:
    alpha 0
    linear 1 alpha 1.0

screen nvl:

    window:
        style "nvl_window"

        has vbox:
            style "nvl_vbox"

        # Display dialogue.
        for who, what, who_id, what_id, window_id in dialogue:
            window:
                id window_id

                has hbox:
                    spacing 10

                if who is not None:
                    text who id who_id

                text what id what_id at what_fade
Last edited by vividXP on Tue Apr 01, 2014 12:09 am, edited 2 times in total.
vividxp.tumblr.com
Wọn ṣe bí òtòṣì ò gbọn bí ọlọrò; wón ní ì bá gbón ì bá lówó lọwọ / People think the poor person lacks the wisdom the wealthy person has; they say if one had wisdom, one would be rich

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: NVL Dialogue Transform only on incoming text?

#2 Post by Asceai »

maybe

Code: Select all

transform what_fade:
    alpha 0
    linear 1 alpha 1.0

screen nvl:

    window:
        style "nvl_window"

        has vbox:
            style "nvl_vbox"

        # Display dialogue.
        for who, what, who_id, what_id, window_id in dialogue[:-1]:
            window:
                id window_id

                has hbox:
                    spacing 10

                if who is not None:
                    text who id who_id

                text what id what_id

        for who, what, who_id, what_id, window_id in dialogue[-1:]:
            window:
                id window_id

                has hbox:
                    spacing 10

                if who is not None:
                    text who id who_id

                text what id what_id at what_fade

User avatar
vividXP
Regular
Posts: 53
Joined: Tue Jan 08, 2013 9:54 am
Projects: "Almost There" (NanoReno '14)
Location: Florida
Contact:

Re: NVL Dialogue Transform only on incoming text?

#3 Post by vividXP »

That works perfectly. Thank you so much!
vividxp.tumblr.com
Wọn ṣe bí òtòṣì ò gbọn bí ọlọrò; wón ní ì bá gbón ì bá lówó lọwọ / People think the poor person lacks the wisdom the wealthy person has; they say if one had wisdom, one would be rich

User avatar
vividXP
Regular
Posts: 53
Joined: Tue Jan 08, 2013 9:54 am
Projects: "Almost There" (NanoReno '14)
Location: Florida
Contact:

Re: [SOLVED] NVL Dialogue Transform only on incoming text?

#4 Post by vividXP »

I ended up removing it because it didn't work well with the wait tags since they are technically on the same line. It just restarts the transformation. *sigh* But this is still good to know
vividxp.tumblr.com
Wọn ṣe bí òtòṣì ò gbọn bí ọlọrò; wón ní ì bá gbón ì bá lówó lọwọ / People think the poor person lacks the wisdom the wealthy person has; they say if one had wisdom, one would be rich

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

Re: [SOLVED] NVL Dialogue Transform only on incoming text?

#5 Post by Kinsman »

You might be able to solve the problem with the wait tags by using character callbacks.

Code: Select all

init python:

    animate_last_nvl = True

    def nvl_assistant(event,interact=True,**kwargs):
        global animate_last_nvl
        if event == "begin":
            animate_last_nvl = True
        if event == "show_done":
            animate_last_nvl = False
        

    config.character_callback = nvl_assistant

And in the screen code you got, change the last bit to this:

Code: Select all

$global animate_last_nvl
if animate_last_nvl == True:
    text what id what_id at what_fade
else:
    text what id what_id

This code is off the cuff, so let me know how it works for you.
Flash To Ren'Py Exporter
See the Cookbook thread

User avatar
vividXP
Regular
Posts: 53
Joined: Tue Jan 08, 2013 9:54 am
Projects: "Almost There" (NanoReno '14)
Location: Florida
Contact:

Re: [SOLVED] NVL Dialogue Transform only on incoming text?

#6 Post by vividXP »

That code doesn't work. But I may have put it in wrong. I put the init python block in script.rpy and what exactly am I replacing when I want to insert the code black that starts with global...my original code or Asceai's code.

I've tried generally all combinations and the result is all the text at alpha 1...no transform at all
vividxp.tumblr.com
Wọn ṣe bí òtòṣì ò gbọn bí ọlọrò; wón ní ì bá gbón ì bá lówó lọwọ / People think the poor person lacks the wisdom the wealthy person has; they say if one had wisdom, one would be rich

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

Re: NVL Dialogue Transform only on incoming text?

#7 Post by Kinsman »

Sorry about that. I found an error in the code, and I've got a test project for you to look at.

If you want to use the code in your own project, you'll find everything bundled under the "nvl" section of screens.rpy.
Attachments
TestProject.zip
(284.17 KiB) Downloaded 36 times
Flash To Ren'Py Exporter
See the Cookbook thread

User avatar
vividXP
Regular
Posts: 53
Joined: Tue Jan 08, 2013 9:54 am
Projects: "Almost There" (NanoReno '14)
Location: Florida
Contact:

Re: NVL Dialogue Transform only on incoming text?

#8 Post by vividXP »

That seemed to do the trick.

Thank you so much.
vividxp.tumblr.com
Wọn ṣe bí òtòṣì ò gbọn bí ọlọrò; wón ní ì bá gbón ì bá lówó lọwọ / People think the poor person lacks the wisdom the wealthy person has; they say if one had wisdom, one would be rich

Post Reply

Who is online

Users browsing this forum: No registered users