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.
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:
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:
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
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"
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.
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
strayerror wrote: ↑Fri Feb 14, 2020 1:33 pmas 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.
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!!!