Page 1 of 1

NVL Dialogue Transform only on incoming text?

Posted: Sun Mar 30, 2014 12:28 pm
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

Re: NVL Dialogue Transform only on incoming text?

Posted: Sun Mar 30, 2014 6:54 pm
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

Re: NVL Dialogue Transform only on incoming text?

Posted: Sun Mar 30, 2014 7:52 pm
by vividXP
That works perfectly. Thank you so much!

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

Posted: Mon Mar 31, 2014 8:09 am
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

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

Posted: Mon Mar 31, 2014 5:53 pm
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.

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

Posted: Tue Apr 01, 2014 12:09 am
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

Re: NVL Dialogue Transform only on incoming text?

Posted: Wed Apr 02, 2014 5:05 pm
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.

Re: NVL Dialogue Transform only on incoming text?

Posted: Fri Apr 04, 2014 4:09 pm
by vividXP
That seemed to do the trick.

Thank you so much.