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.
-
Ornitovox
- Newbie
- Posts: 3
- Joined: Sat Feb 08, 2020 7:47 pm
-
Contact:
#1
Post
by Ornitovox » 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)
Any help or guidance will be welcome
-
Angelo Seraphim
- Regular
- Posts: 32
- Joined: Tue May 21, 2019 8:00 am
- Completed: Enamored Risks (NaNoReNo 2020)
- Projects: 616 Charagma
- Organization: GLSUoA
- Deviantart: glsuoa
- itch: glsuoa
- Location: London, UK
- Discord: Just A Concept#9599
-
Contact:
#2
Post
by Angelo Seraphim » Wed Feb 12, 2020 12:42 pm
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!"
...
-
rames44
- Veteran
- Posts: 232
- Joined: Sun May 29, 2016 4:38 pm
-
Contact:
#3
Post
by rames44 » Wed Feb 12, 2020 12:51 pm
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.
-
strayerror
- Regular
- Posts: 154
- Joined: Fri Jan 04, 2019 3:44 pm
-
Contact:
#4
Post
by strayerror » 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
-
Ornitovox
- Newbie
- Posts: 3
- Joined: Sat Feb 08, 2020 7:47 pm
-
Contact:
#5
Post
by Ornitovox » Thu Feb 13, 2020 10:07 am
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"

-
strayerror
- Regular
- Posts: 154
- Joined: Fri Jan 04, 2019 3:44 pm
-
Contact:
#6
Post
by strayerror » 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
-
Ornitovox
- Newbie
- Posts: 3
- Joined: Sat Feb 08, 2020 7:47 pm
-
Contact:
#7
Post
by Ornitovox » Fri Feb 21, 2020 3:08 pm
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!!!
Users browsing this forum: Bing [Bot], Google [Bot], span4ev