Stopping looping for webm animations

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
Marionette
Regular
Posts: 128
Joined: Thu Apr 21, 2011 12:04 pm
Completed: https://marionette.itch.io/
Projects: Get Meowt of Here
Deviantart: rexx9224
itch: marionette
Location: Ireland
Discord: Marionette#2995
Contact:

Stopping looping for webm animations

#1 Post by Marionette »

So basically I want to be able to display an animation, and then have it stop once the animation is complete.
It's not immediately obvious how to do this, without using renpy.movie_cutscene, which I don't think is really what I'm looking to do here.

Code: Select all


#The animation is defined like so:
image swordAttack movie = Movie(channel="swordAttack", play="img/animations/swordAttack_real.webm", mask="img/animations/swordAttack_mask.webm")

#and then used like so:
  show swordAttack movie
This will show the animation, but then it keeps looping rather than stopping once it is complete.

I am hoping there is a way to tell the animation to not loop that I've overlooked, rather than needing to add a bunch of pauses and hides each time I use them.

Thanks in advance.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Stopping looping for webm animations

#2 Post by Imperf3kt »

https://www.renpy.org/doc/html/movie.ht ... -functions
renpy.movie_cutscene(filename, delay=None, loops=0, stop_music=True)
This displays an MPEG-1 cutscene for the specified number of seconds. The user can click to interrupt the cutscene. Overlays and Underlays are disabled for the duration of the cutscene.

filename
The name of a file containing an MPEG-1 movie.
delay
The number of seconds to wait before ending the cutscene. Normally the length of the movie, in seconds. If None, then the delay is computed from the number of loops (that is, loops + 1) * the length of the movie. If -1, we wait until the user clicks.
loops
The number of extra loops to show, -1 to loop forever
Perhaps use this method instead and set looping to 0
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Marionette
Regular
Posts: 128
Joined: Thu Apr 21, 2011 12:04 pm
Completed: https://marionette.itch.io/
Projects: Get Meowt of Here
Deviantart: rexx9224
itch: marionette
Location: Ireland
Discord: Marionette#2995
Contact:

Re: Stopping looping for webm animations

#3 Post by Marionette »

Imperf3kt wrote: Sun Jan 21, 2018 2:41 am https://www.renpy.org/doc/html/movie.ht ... -functions
renpy.movie_cutscene(filename, delay=None, loops=0, stop_music=True)
This displays an MPEG-1 cutscene for the specified number of seconds. The user can click to interrupt the cutscene. Overlays and Underlays are disabled for the duration of the cutscene.

filename
The name of a file containing an MPEG-1 movie.
delay
The number of seconds to wait before ending the cutscene. Normally the length of the movie, in seconds. If None, then the delay is computed from the number of loops (that is, loops + 1) * the length of the movie. If -1, we wait until the user clicks.
loops
The number of extra loops to show, -1 to loop forever
Perhaps use this method instead and set looping to 0
Thanks for your response, unfortunately, it seems that this function sets the movie to play fullscreen, which means it won't work as an in-game animation.
Also, i don't think it allows you to apply a mask to it, and without the mask the animations in this format look terrible. lol

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Stopping looping for webm animations

#4 Post by Imperf3kt »

Looking through some old code the closest thing I found was:

Code: Select all

init:
    image movie = Movie(size=(1280, 720), xalign=0.5, yalign=0.5, loop=False)
label start:
    play movie "movies/mymovie.mkv"
Now, no guarantees because;
1: Its not mentioned in the documentation
2: I tested the code, but my movie from that time was encoded in AVC (mpeg-4 part10) and later versions of Ren'Py no longer work with this (not supported to begin with) codec.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Marionette
Regular
Posts: 128
Joined: Thu Apr 21, 2011 12:04 pm
Completed: https://marionette.itch.io/
Projects: Get Meowt of Here
Deviantart: rexx9224
itch: marionette
Location: Ireland
Discord: Marionette#2995
Contact:

Re: Stopping looping for webm animations

#5 Post by Marionette »

Imperf3kt wrote: Sun Jan 21, 2018 5:24 am Looking through some old code the closest thing I found was:

Code: Select all

init:
    image movie = Movie(size=(1280, 720), xalign=0.5, yalign=0.5, loop=False)
label start:
    play movie "movies/mymovie.mkv"
Now, no guarantees because;
1: Its not mentioned in the documentation
2: I tested the code, but my movie from that time was encoded in AVC (mpeg-4 part10) and later versions of Ren'Py no longer work with this (not supported to begin with) codec.
Thanks for your help, I tried your code and although it didn't work directly, with a bit of tweaking I was able to get it to not loop if I used it like this instead.

Code: Select all

init:
    image movie = Movie(size=(1280, 720), xalign=0.5, yalign=0.5)
label start:
    play movie "movies/mymovie.mkv" noloop


However as my animations rely on masks, it's still not quite there. I tried adding the masks to the movie define, but when I do that the animation doesn't show up at all.
I can't seem to figure out how to add the mask inline when I'm calling the play movie bit either. :(

Any suggestions?

Poorman65
Newbie
Posts: 16
Joined: Fri Apr 20, 2018 2:36 am
Contact:

Re: Stopping looping for webm animations

#6 Post by Poorman65 »

Did you figure this out? I have the same problem. I have an Animation that needs to have a Mask and play over a background. In some cases I will have other Animations playing at the same time.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], geoWaffle