Page 1 of 1
Create an animation with time parameters
Posted: Sat Feb 08, 2020 10:34 pm
by Ornitovox
Hi everyone, I'm a newbie to Renpy and I'm practicing with some codes found in this wise forum.
I would like you to give me an idea like this convert to a custom function:
Code: Select all
image Run 1:
"images/001.jpg"
pause .15
"images/002.jpg"
pause .15
"images/003.jpg"
pause .15
repeat
Code: Select all
def Run (int charID):
# show images/001.jpg"
# pause charID
# show images/001.jpg"
# pause charID
# show images/001.jpg"
# pause charID
# repeat
Code: Select all
j "Hi"
$Run(0.3)
j "fast"
$Run(0.1)
Any help or guidance will be welcome
Re: Create an animation with time parameters
Posted: Wed Feb 12, 2020 12:42 pm
by Angelo Seraphim
Ornitovox wrote: ↑Sat Feb 08, 2020 10:34 pm
Hi everyone, I'm a newbie to Renpy and I'm practicing with some codes found in this wise forum.
I would like you to give me an idea like this convert to a custom function:
Code: Select all
image Run 1:
"images/001.jpg"
pause .15
"images/002.jpg"
pause .15
"images/003.jpg"
pause .15
repeat
Code: Select all
def Run (int charID):
# show images/001.jpg"
# pause charID
# show images/001.jpg"
# pause charID
# show images/001.jpg"
# pause charID
# repeat
Code: Select all
j "Hi"
$Run(0.3)
j "fast"
$Run(0.1)
Hmmm... I think your first code was fine.
Try something like this:
Code: Select all
image run_1:
"images/001.jpg"
pause .15
"images/002.jpg"
pause .15
"images/003.jpg"
pause .15
repeat ## Will repeat infinitely.
# repeat 4 ## Will rpeat 4 times.
# time 5.0 ## Will run the animation for 5 seconds and end.
label start:
j "Hi."
show run_1
j "I'm running!"
...
Re: Create an animation with time parameters
Posted: Wed Feb 12, 2020 12:51 pm
by rames44
You’re missing the point - he wants to be able to vary the times on an invocation-by-invocation basis, not have them hard coded.
There may be magic I don’t know, but the only way I know how to do this is with a custom Displayable.
Re: Create an animation with time parameters
Posted: Wed Feb 12, 2020 9:45 pm
by strayerror
I believe the most direct equivalent of what you're asking for would be something like:
Code: Select all
transform run(t):
"images/001.jpg"
t
"images/002.jpg"
t
"images/003.jpg"
t
repeat
label start:
show expression run(.3) as runner
j "Hi"
show expression run(.1) as runner
j "fast"
return
Re: Create an animation with time parameters
Posted: Thu Feb 13, 2020 10:07 am
by Ornitovox
strayerror wrote: ↑Wed Feb 12, 2020 9:45 pm
I believe the most direct equivalent of what you're asking for would be something like:
Code: Select all
transform run(t):
"images/001.jpg"
t
"images/002.jpg"
t
"images/003.jpg"
t
repeat
label start:
show expression run(.3) as runner
j "Hi"
show expression run(.1) as runner
j "fast"
return
Thank you ... it has helped me a lot !!!! Transformation is the best way to do this.
Although I did not find information on: "... as runner"

Re: Create an animation with time parameters
Posted: Fri Feb 14, 2020 1:33 pm
by strayerror
as runner is effectively naming what's displayed for Ren'Py's benefit, so that when you do the next
show ... as runner it's replaced, rather than being shown along side or on top of it.
runner in this instance is just a name I picked for the purposes of the demo, it could be anything that's not considered syntax keyword.
Code: Select all
show a
'Implicitly tagged as "a".'
show expression magic(2.) as a
'This tells renpy to treat it as if it was tagged "a", and so replaces the image shown by the previous show.'
show b
'Implicitly tagged as "b", shown alongside anything already on screen.'
show a as b
'Because it\'s tagged as "b", it replaces the image shown by the last show, resulting in two copies of image "a" being displayed.'
I'm afraid that ended up a little less straight forward than I had hoped, but with any luck it's still useful. Here's a link to the official documentation for
as which can be found within the
show docs:
https://www.renpy.org/doc/html/displayi ... -statement
Re: Create an animation with time parameters
Posted: Fri Feb 21, 2020 3:08 pm
by Ornitovox
strayerror wrote: ↑Fri Feb 14, 2020 1:33 pm
as runner is effectively naming what's displayed for Ren'Py's benefit, so that when you do the next
show ... as runner it's replaced, rather than being shown along side or on top of it.
runner in this instance is just a name I picked for the purposes of the demo, it could be anything that's not considered syntax keyword.
Code: Select all
show a
'Implicitly tagged as "a".'
show expression magic(2.) as a
'This tells renpy to treat it as if it was tagged "a", and so replaces the image shown by the previous show.'
show b
'Implicitly tagged as "b", shown alongside anything already on screen.'
show a as b
'Because it\'s tagged as "b", it replaces the image shown by the last show, resulting in two copies of image "a" being displayed.'
I'm afraid that ended up a little less straight forward than I had hoped, but with any luck it's still useful. Here's a link to the official documentation for
as which can be found within the
show docs:
https://www.renpy.org/doc/html/displayi ... -statement
Thank you for your time ... this latest information has helped me a lot, even more than my first question. XD

Thanks!!!