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.
I have this label on my script file, basically it works as a gallery of pictures with some transitions added to it. I want to put this as the main menu background. Any idea on how I could do this?
label menuCarruselTest:
$numPoster=renpy.random.randint(1,cantImgMainMenu)
#Si es el que acaba de salir sortea denuevo
if numPoster==numAnterior:
jump menuCarruselTest
$numAnterior=numPoster #guardo cual fue el que salio
$numPosterstr="[numPoster]" #lo convierto a string
$imagenAMostrarMM="MainMenuPresent/Poster-"+numPosterstr+".png" #arma la imagen a mostrar
show image (imagenAMostrarMM) at MMTransicion
$ renpy.pause(5.0, hard=True) #para hacer una pausa, y el hard es para que no se la salteen
scene black
with dissolve
$contadorAlPedo=contadorAlPedo+1
if contadorAlPedo==1000:
return #sale del programa, es para evitar un loop infinito
else:
jump menuCarruselTest
Working on many weird narrative games at Curse Box Studios
If main_menu label exist, it will be executed, instead of showing the main menu screen. Note that you will be responsible for shwing and handling all menu screens in this case.
An alternative approach is to convert you code into a screen and use that instead.
Ocelot wrote: ↑Wed Mar 20, 2024 4:49 am
If main_menu label exist, it will be executed, instead of showing the main menu screen. Note that you will be responsible for shwing and handling all menu screens in this case.
An alternative approach is to convert you code into a screen and use that instead.
How can I write this in screen language? I can't use jumps or repeat. Hoy could I accomplish the same loop?
Working on many weird narrative games at Curse Box Studios
a) Use timers that change varable controlling current image.
b) CDD which change rendered image based on elapsed time
c) Potentially ATL animation which has a funtcion statement changing child of transform.
Ocelot wrote: ↑Wed Mar 20, 2024 3:52 pm
a) Use timers that change varable controlling current image.
b) CDD which change rendered image based on elapsed time
c) Potentially ATL animation which has a funtcion statement changing child of transform.
Right now Im triying to do it this way, as an animated image
You cannot simply add random code and expect it to work. ATL has different syntax from both RenPy script and SL, so you'll need more complex approach. This, for example will change bachground from red to green and back every 3 seconds:
init python:
def change_image(trans, st, at):
if (at // 3) % 2 == 0:
trans.set_child(Solid("#0F0"))
else:
trans.set_child(Solid("#F00"))
return None
image green_to_red:
function change_image
pause 1.0
repeat
label start:
show green_to_red
"..."
return
[code]
If you have any transitions you want to use, you will have to bake them into [c]funtion[/c] code as well. In this case I heavily suggest go with "screen with timers" approach instead.