hide at followed by show at not working properly? [Solved]

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
Valiowk
Newbie
Posts: 22
Joined: Sat Jan 02, 2016 8:32 pm
Contact:

hide at followed by show at not working properly? [Solved]

#1 Post by Valiowk »

I'm trying to use the first example from this thread. My goal is to modify the following code so that I can use the ATL commands repeatedly with different characters:

Code: Select all

    show xxx:
        linear 0.5 alpha 0.0
    show yyy:
        alpha 0.0
        pause 0.5
        linear 0.5 alpha 0.5
That is, xxx is suppose to dissolve away in 0.5 seconds, then after 0.5 seconds when xxx has dissolved away, yyy dissolves in to become semitransparent.

My modified code looks as follows.

Code: Select all

init:
    transform diss:
        on show:
            alpha 0.0
            pause 0.5
            linear 0.5 alpha 0.5
        on hide:
            linear 0.5 alpha 0.0
and in the script I have

Code: Select all

    hide xxx at diss
    show yyy at diss
When I run the code, however, xxx disappears immediately and yyy appears immediately.
Of course, I could write

Code: Select all

    hide xxx
    with dissolve
instead of "hide xxx at diss" and remove the pause from the "on show" part for this example, but I'd prefer not to do that in case I want to make further customizations to the "on hide" statement. I also don't want to have to write out the full ATL code every time because I'll be using the commands rather frequently.

Am I misunderstanding something about the way "at" works?
Last edited by Valiowk on Tue Feb 02, 2016 10:42 pm, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: hide at followed by show at not working properly?

#2 Post by philat »

I'm guessing, but it sounds like you're replacing images via image tags. http://www.renpy.org/doc/html/displayin ... html#image

Valiowk
Newbie
Posts: 22
Joined: Sat Jan 02, 2016 8:32 pm
Contact:

Re: hide at followed by show at not working properly?

#3 Post by Valiowk »

philat wrote:I'm guessing, but it sounds like you're replacing images via image tags. http://www.renpy.org/doc/html/displayin ... html#image
Yes, xxx and yyy are image names.

If it's useful for you to know, I'm using the built-in define image figure that makes each image name the same as the file name (without the names of any folders the file is in - I assume that's how the built-in feature works?). Moreover, every time I use the code above, I'm using it for different characters, so the image tags of xxx and yyy are different.

Is there something I'm misunderstanding about replacing images via image tags?

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: hide at followed by show at not working properly?

#4 Post by philat »

I meant it sounds like you are doing the following:

Code: Select all

hide image one at diss
show image two at diss
which automatically uses replace/replaced events, not hide/show events. If not, there is no reason the ATL should not be working.

Valiowk
Newbie
Posts: 22
Joined: Sat Jan 02, 2016 8:32 pm
Contact:

Re: hide at followed by show at not working properly?

#5 Post by Valiowk »

philat wrote:I meant it sounds like you are doing the following:

Code: Select all

hide image one at diss
show image two at diss
which automatically uses replace/replaced events, not hide/show events. If not, there is no reason the ATL should not be working.
Please see the reply above - the image tags of xxx and yyy should be different, as far as I understand. Does this still end up using replace/replaced events instead of hide/show events?

Actually, my code frequently looks more like

Code: Select all

hide xxx at diss, left
show yyy at diss, right
If the reason why replace/replaced events are being used is because both the hide and show have "at diss", would making separate codes for "at diss, left" and "at diss, right" help?
Last edited by Valiowk on Mon Feb 01, 2016 3:35 am, edited 2 times in total.

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: hide at followed by show at not working properly?

#6 Post by philat »

I read what you wrote. I was clarifying what I meant. Again, if that is not the case, I don't know why it's not working, as it's working for me.

ETA in response to your edits: I am not saying that the replace/replaced events are being used. I repeat, I don't know. What I do know is that the following works without issue.

Code: Select all

image white = Solid("FFF", xysize=(50,50))
image red = Solid("F00", xysize=(50,50))

transform diss:
    on show:
        alpha 0.0
        pause 0.5
        linear 0.5 alpha 0.5
    on hide:
        linear 0.5 alpha 0.0

label start:

    show white at diss
    e "You've created a new Ren'Py game."
    hide white at diss
    show red at diss
    e "Once you add a story, pictures, and music, you can release it to the world!"

Valiowk
Newbie
Posts: 22
Joined: Sat Jan 02, 2016 8:32 pm
Contact:

Re: hide at followed by show at not working properly?

#7 Post by Valiowk »

Valiowk wrote:Actually, my code frequently looks more like

Code: Select all

hide xxx at diss, left
show yyy at diss, right
If the reason why replace/replaced events are being used is because both the hide and show have "at diss", would making separate codes for "at diss, left" and "at diss, right" help?
Following on the above, I wrote separate codes for "at diss, left" and "at diss, right", and it now has the behaviour that xxx dissolves away in 0.5 seconds, then after 0.5 seconds when xxx has dissolved away, yyy dissolves in to become semitransparent. So it seems that the issue is that for me, but not for philat above, using "hide at" and "show at" of the same ATL automatically uses replace/replaced events even if the image tags of the two images are different...?

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: hide at followed by show at not working properly?

#8 Post by philat »

Adding left or right after diss does not alter the behavior for me, nor should it. Perhaps you've customized the default left/right transforms in some way that is incompatible with the ATL, but again, I'm guessing.

Valiowk
Newbie
Posts: 22
Joined: Sat Jan 02, 2016 8:32 pm
Contact:

Re: hide at followed by show at not working properly?

#9 Post by Valiowk »

philat wrote:Adding left or right after diss does not alter the behavior for me, nor should it. Perhaps you've customized the default left/right transforms in some way that is incompatible with the ATL, but again, I'm guessing.
Aha, problem found. You're right - I redefined the positions of left/right, just changing their xalign and xpos. Now this is the the strange thing I don't understand: if I write "at left, diss" and "at right, diss" instead of "at diss, left" and "at diss, right", then the problem goes away. So apparently there is some incompatibility in the order after the positions have been redefined, but not before... But since the problem has been solved I'm not going to worry about it for now.

(So it was the part of my code that I thought was unimportant that was causing the problem. Apologies for leaving it out at the start!)

Post Reply

Who is online

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