Is there a way to prevent namebox refresh?

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
phaseblast
Newbie
Posts: 3
Joined: Mon Oct 08, 2018 1:58 am
Tumblr: dilaudid

Is there a way to prevent namebox refresh?

#1 Post by phaseblast » Mon Apr 20, 2020 3:29 am

Hi all! I'm wondering if anyone can help me out with a solution for an issue caused by the automatic refresh of the namebox/nameplate that happens when there's a new line of dialogue.

Basically, I have a transform animation on the namebox so that it dissolves and slides in from the left; the animation itself works great! The problem is that it repeats on every subsequent line of dialogue, like so:

Image

The transform itself is really really simple:

Code: Select all

transform say_namebox_animation:
        subpixel True xalign 0.75 alpha 0
        linear 0.5 xalign 0.8 alpha 1
I can do basic Ren'py coding, but I'm not at all familiar with Python or more complex commands, so I'm at a loss for how I should approach this. Is it possible to stop the namebox from auto-refreshing? If not, can anyone think of another way to achieve the same effect without using the namebox properties? I don't mind having to MacGyver a solution through disabling two window and making a "fake" nameplate that serves the same visual function (and if anyone has advice for that I'd be grateful) but I figured I should see if anyone knows of a simpler way that I'm oblivious to.

Thanks in advance!

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 556
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: Is there a way to prevent namebox refresh?

#2 Post by hell_oh_world » Mon Apr 20, 2020 6:28 am

phaseblast wrote:
Mon Apr 20, 2020 3:29 am
Hi all! I'm wondering if anyone can help me out with a solution for an issue caused by the automatic refresh of the namebox/nameplate that happens when there's a new line of dialogue.

Basically, I have a transform animation on the namebox so that it dissolves and slides in from the left; the animation itself works great! The problem is that it repeats on every subsequent line of dialogue, like so:

Image

The transform itself is really really simple:

Code: Select all

transform say_namebox_animation:
        subpixel True xalign 0.75 alpha 0
        linear 0.5 xalign 0.8 alpha 1
I can do basic Ren'py coding, but I'm not at all familiar with Python or more complex commands, so I'm at a loss for how I should approach this. Is it possible to stop the namebox from auto-refreshing? If not, can anyone think of another way to achieve the same effect without using the namebox properties? I don't mind having to MacGyver a solution through disabling two window and making a "fake" nameplate that serves the same visual function (and if anyone has advice for that I'd be grateful) but I figured I should see if anyone knows of a simpler way that I'm oblivious to.

Thanks in advance!
have you tried these yet?

Code: Select all

transform say_namebox_animation:
	on start:
        	subpixel True xalign 0.75 alpha 0
        	linear 0.5 xalign 0.8 alpha 1
or

Code: Select all

transform say_namebox_animation:
	on show:
        	subpixel True xalign 0.75 alpha 0
        	linear 0.5 xalign 0.8 alpha 1

User avatar
phaseblast
Newbie
Posts: 3
Joined: Mon Oct 08, 2018 1:58 am
Tumblr: dilaudid

Re: Is there a way to prevent namebox refresh?

#3 Post by phaseblast » Tue Apr 21, 2020 8:27 am

hell_oh_world wrote:
Mon Apr 20, 2020 6:28 am
have you tried these yet?

Code: Select all

transform say_namebox_animation:
	on start:
        	subpixel True xalign 0.75 alpha 0
        	linear 0.5 xalign 0.8 alpha 1
or

Code: Select all

transform say_namebox_animation:
	on show:
        	subpixel True xalign 0.75 alpha 0
        	linear 0.5 xalign 0.8 alpha 1
I hadn't actually tried those and I feel silly for overlooking it, so thank you for the suggestion! Unfortunately, on start doesn't have any effect at all, and on show seems to stop the entire animation from working for some reason.

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 556
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: Is there a way to prevent namebox refresh?

#4 Post by hell_oh_world » Tue Apr 21, 2020 9:19 am

phaseblast wrote:
Tue Apr 21, 2020 8:27 am
hell_oh_world wrote:
Mon Apr 20, 2020 6:28 am
have you tried these yet?

Code: Select all

transform say_namebox_animation:
	on start:
        	subpixel True xalign 0.75 alpha 0
        	linear 0.5 xalign 0.8 alpha 1
or

Code: Select all

transform say_namebox_animation:
	on show:
        	subpixel True xalign 0.75 alpha 0
        	linear 0.5 xalign 0.8 alpha 1
I hadn't actually tried those and I feel silly for overlooking it, so thank you for the suggestion! Unfortunately, on start doesn't have any effect at all, and on show seems to stop the entire animation from working for some reason.
well if none of those work, i suggest trying other events of atl / transform... https://www.renpy.org/doc/html/atl.html#external-events
personally, i think the problem is because of the lack of proper event handling in your transforms, that's why i suggested putting an event inside your transforms. it's just a matter of proper event handling. mostly, with screens that are being called `show` and `start` events are what being triggered, that's the reason i suggested those, but feel free to play around with other events, one of those might fix the issue though.

if it's still not fixed after trying all of those... guess you could try this...

Code: Select all

default is_namebox_showed = False

transform say_namebox_animation:
	on show:
        	subpixel True xalign 0.75 alpha 0
        	linear 0.5 xalign 0.8 alpha 1

screen say():
	on "hide" action SetVariable("is_namebox_showed", False)
	if not is_namebox_showed:
		timer 0.001 action SetVariable("is_namebox_showed", True)
		
	# some codes of the say screen....
		showif is_namebox_showed: # enclose the namebox in showif to trigger the on show event in the transform...
			window:
                		style "namebox"
                		text who id "who"
                		at say_namebox_animation # add the transform

User avatar
Tayruu
Regular
Posts: 129
Joined: Sat Jul 05, 2014 7:57 pm

Re: Is there a way to prevent namebox refresh?

#5 Post by Tayruu » Fri Apr 24, 2020 3:43 am

Funnily enough I'm trying to do this exact same effect. I want a name box to pan in when a character starts speaking, and swap with other name "cards" when switching characters or the like.
And I've run into this same problem.

I gave the above code a try, using variables and on show, and it still results in the animation re-playing when pauses occur or new messages. It seems that on "hide" triggers on a pause for some reason, even though the say screen isn't actually hiding.

I was able to prove this with the following:

Code: Select all

init -1500 python:
    def say_hide_test():
        renpy.sound.play("system_confirm.ogg")
        return

screen say(who, what):
    predict False
    on "hide" action Function(say_hide_test)
    # [...]
EDIT: Addendum - making the test variable store the current who could be a possible solution, as it would probably detect changes in who, including None. Not sure how to make use of it yet though, and it seems to trigger twice (sound plays twice) with a fresh message after a pause/animation/etc.

Code: Select all

init -1500 python:
    def say_hide_test(w):
        global present_who
        renpy.sound.play("system_confirm.ogg")
        present_who = w
        return

screen say(who, what):
    predict False
    #on "hide" action Function(say_hide_test)
    if present_who != who:
        timer 0.001 action Function(say_hide_test, who)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], hell_oh_world, noeinan