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.
503/5000
I apologize for my bad English and I state that I am an artist and not a programmer, it is the first time that I see a programming code ...
My problem is this:
I would like to play a sound when my personal "user Iterface" screen appears and stop it when the the screen closes, but after many tests and attempts I did not understand how I should do, I looked at other topics but I could not find anything; I write below the code of my screen and thanks in advance for the answers.
Thanks Enchante00 for the answer,
I wrote your suggest, but nothing happend...
perhaps i forgot to unblock some options or gui customizations or... i don't know
deltadidirac wrote: ↑Fri Nov 30, 2018 5:13 am
I would like to play a sound when my personal "user Iterface" screen appears and stop it when the the screen closes,
You could start and stop the music in connection with the commands to show and hide the screen
deltadidirac wrote: ↑Fri Nov 30, 2018 3:15 pm
Thanks Enchante00 for the answer,
I wrote your suggest, but nothing happend...
perhaps i forgot to unblock some options or gui customizations or... i don't know
see you
I'm sorry. It's my mistake the code should be the one below:
now since the background song is a song and not a sound, I have to understand how to start the music piece only once, until you start a new label, otherwise at each "show" and "hide", the song starts again from head.
If I was capable, I would build a function, probably it would be more simple...
This means that the first time you play the music track it will continue to play but not at every show and hide anymore. It will only play once and when you are in your new label you can stop the music and change the track
thanks Enchante00
but i think that is the same way to write play and stop in the start and in the end of every label..
it's just an intuition, but I think the right path is this:
incorporate my music as a property of the my screen object and define it as play once.
At the same time insert in the label object (whatever it is), the stop music property.
Sorry I'm confused a bit so let's clarify a few things XD
So when you show your screen do you want to:
1. Play the music once every time you show your screen or
2. When you show your screen for the first time, it plays your music and the next time you show your screen it doesn't.
In addition, you want the music just to play once and not loop?
-My game (like others), brings up the UI screen when a scene is finished and continues to remain visible (regardless of where you go), until you unlock the next scene or because you have done an action (like buying an Item ) or because you are in a given place at a given time.
-so, every time the UI screen appears I want to start the piece of music (which lasts 4.5 minutes, so you do not need the loop or at most 2 times) and stop only at the beginning of the new scene and not when you are moving around the locations or in the main map.