show xxxx at Position(...) failing without "with dissolve"

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
ISAWHIM
Veteran
Posts: 318
Joined: Sun Nov 06, 2016 5:34 pm
Contact:

show xxxx at Position(...) failing without "with dissolve"

#1 Post by ISAWHIM »

I have a quick little animated pop-up showing player gains and losses, as they are earned.

The code is simple. It hides the dialogue box, shows the image at a set position, then it floats off the screen.

I am running into two issues, but this first one seems to be a bug. If I do not add the "with dissolve", or some other "with" property... It shows the image at the bottom of the screen, instead of at the set "ypos". Which also indicates that it is not obeying the "yanchor", and I assume, any of the other positioning values.)

This fails to display the image at the correct location.

Code: Select all

label gain():
    $ points += 1
    window hide
    show _points_gain at Position(xpos = 0.5, xanchor=0.5, ypos=0.20, yanchor=0.5)
    show _points_gain with hpunch
    pause(0.1)
    hide _points_gain with moveouttop
    return
This shows the image in the correct location ("with dissolve" added)

Code: Select all

label gain():
    $ points += 1
    window hide
    show _points_gain at Position(xpos = 0.5, xanchor=0.5, ypos=0.20, yanchor=0.5) with dissolve
    show _points_gain with hpunch
    pause(0.1)
    hide _points_gain with moveouttop
    return
My other issue is that this animation can be "clicked-through", which I do not want to happen. (Clicking-through makes it impossible to see that you have accumulated the points. Flying past the animation and the following display of points totaled.)

How can I suppress "click to continue", until the "hide xxx with moveouttop" has completed? (Or until the total have shown on the screen, for xxxx amount of time.)

I can sort-of see why the first set of code MIGHT fail... (There is a SHOW followed by another SHOW. However, it should be positioning the image first, then simply doing the second animation, once it is displayed at that location. There was two individual animations, which caused it to display correctly. Removing one, should not change anything. However, I am going to resolve this by moving that second SHOW WITH, up to the prior POSITION command.)

EG, Just noting this as an odd "bug" of sorts. The failing of the POSITION, without a WITH, in this code case.

Also, this "hpunch" shakes the whole screen... How do I make it shake just the image? (Or is that another bug?)

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2397
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: show xxxx at Position(...) failing without "with dissolv

#2 Post by Ocelot »

For clicking through problem, try renpy.pause with hard=True set

I am not sure, what happens with your not in correct position problem, but you can try to add with None statement to your first show statement as temporary workaround.

As for hpunch: it is supposed to do that. You can define your own transform and use it instead. (IIRC, it would be hard to make it generic without some in-depth coding. Maybe I would finally do this someday...)
< < insert Rick Cook quote here > >

User avatar
ISAWHIM
Veteran
Posts: 318
Joined: Sun Nov 06, 2016 5:34 pm
Contact:

Re: show xxxx at Position(...) failing without "with dissolv

#3 Post by ISAWHIM »

That will be a good tip if I find another situation where the image seems to fail obeying the set position. (The "with none" tip.)

Going to try the "hard=True..." trick now.

Odd that "hpunch", shakes the actual "background", instead of the thing you set it to shake/hpunch. Not sure I see the point of it as an "individual image function", if it doesn't do anything to the actual image you set it to use. Should be a "background" function, without a need to state any image... Like, just being "screen hpunch", or "background hpunch".

Honestly, it should be "animate(AnyThingDisplayable) with SomeAnimationFunctionSpecificToThisDisplayableOnly", or something like that. Such odd sets of specific cross-object functions in those prefab animations.

Again, thanks for the help.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2397
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: show xxxx at Position(...) failing without "with dissolv

#4 Post by Ocelot »

Most misleading thing is actually ability to write with statement embedded in show statement.

Code: Select all

show foo with bar
# In reality it actually means:
with None
show foo
with bar
with statement works roughly like that: Grab state of old game window. Now grab state of new game window, after all show statement after previous (possibly implicit) withstatement are applied. Now make an animation. morphing old screen into new one.
It doesn't make shake effect impossible to do, but you will have to delve into how game window displayable actually work. I might try to do something on this week.
< < insert Rick Cook quote here > >

User avatar
ISAWHIM
Veteran
Posts: 318
Joined: Sun Nov 06, 2016 5:34 pm
Contact:

Re: show xxxx at Position(...) failing without "with dissolv

#5 Post by ISAWHIM »

What I was saying, is this...
"show MyImage with hpunch" <-(Shakes the background, instead of the image you tell it to animate with that effect)
... doesn't do the animation to MyImage, in stead, it does this...

show MyImage
background hpunch <-(In essence, the above line is doing this.)

Thus, making this "show MyImage with", redundant, as it isn't applying the effect to it.

The key-word being "with", which signifies "do this to me"

That is like telling you to get in the car, then telling the car to, "drive to store", and instead of the car moving, the store comes to you, or the whole world moves, instead of your car. If I wanted the store to move, or the world, I would have told it to "drive to you". Thus, "store/world hpunch", instead of "car hpunch".

EG, it isn't an animation of the IMAGE, so it shouldn't be set in the IMAGE, as an image function/effect for that image.

EG, dissolve will dissolve the image, not the background, when I set it to the image. I would also expect hpunch to hpunch the image, not the background, when I set it to the image. It makes no sense to have that set in the image, if it is not doing anything to the image.

I imagine it is an OLD OLD effect, specific to backgrounds, and should not even attempt to function in something that isn't the actual background. Like a hard-coded function, "Shake [background]", instead of "Shake [This]"

User avatar
ISAWHIM
Veteran
Posts: 318
Joined: Sun Nov 06, 2016 5:34 pm
Contact:

Re: show xxxx at Position(...) failing without "with dissolv

#6 Post by ISAWHIM »

The pause trick isn't working, sort-of...

It actually pauses after the animation, or before it, but the animation can still be passed-up. Thus, it only adds an annoying pause that can't be passed...

Not sure where to look for the "Click to continue", function. But that is what I need interrupted. I'll make another post for that issue, unless you want to chime-in here for that too. (I may find what I am looking for, in another search.)

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2397
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: show xxxx at Position(...) failing without "with dissolv

#7 Post by Ocelot »

Check this out: https://www.renpy.org/doc/html/store_va ... miss_pause
It should help.

In short, you should set it ti False, before unskippable transition, and set to True afterwards (if you want to allow players to skip other thransitions.)
< < insert Rick Cook quote here > >

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: show xxxx at Position(...) failing without "with dissolv

#8 Post by gas »

Code: Select all

label gain():
    $ points += 1
    window hide
    show _points_gain at Position(xpos = 0.5, xanchor=0.5, ypos=0.20, yanchor=0.5)
    show _points_gain with hpunch
    pause(0.1)
    hide _points_gain with moveouttop
    return
Hey hey, you're underestimating Ren'py speed XD.
This:

Code: Select all

show _points_gain at Position(xpos = 0.5, xanchor=0.5, ypos=0.20, yanchor=0.5)
show _points_gain with hpunch
Show the thing at the Position you declared, then instantly reshow it at default position operating this Transition.

Please mind that transitions are different things than ATL (Transform).
Transitions like hpunch operate on the scene level.

So, your code could solve like this.

Code: Select all

label gain():
    $ points += 1
    window hide
    show _points_gain at mytransform
    pause(0.1, hard=True)
    hide _points_gain with moveouttop
    return
and later you define a transform called 'mytransform' that define the position and the ATL stuff you want for (if your positions are fixed as it look like, this seems the best solution).
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
ISAWHIM
Veteran
Posts: 318
Joined: Sun Nov 06, 2016 5:34 pm
Contact:

Re: show xxxx at Position(...) failing without "with dissolv

#9 Post by ISAWHIM »

gas wrote:Hey hey, you're underestimating Ren'py speed XD.
This:

Code: Select all

show _points_gain at Position(xpos = 0.5, xanchor=0.5, ypos=0.20, yanchor=0.5)
show _points_gain with hpunch
Show the thing at the Position you declared, then instantly reshow it at default position operating this Transition.
I thought that too, but it should be showing it at the position it was set to, as it does in the same code, with "with dissolve".

Eg, When the "with dissolve" is added to the "Position()", the next line does not relocate the item to the "default position", then animate it. It animates it from the set prior "Position()", which it is not doing here, without the "with dissolve" added.

Additionally, "hpunch" doesn't actually do anything to the image, which is even more odd, as I stated above. That might be why it is "resetting" the image at that point, and not after the "dissolve" has been done. Again, that doesn't make any sense either. Thus, why I assume it is a bug.

I am going to have to resort to ATL, because the prefab stuff is not desirable for much of anything beyond what they do, when they even work as described. (Few settings to control the prefab animations.)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]