Ren'Py Questions
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.
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.
Ren'Py Questions
I have some stupid newbie questions if you don't mind:
1. In Ren'Py's demo main menu screen, I think it takes at least 1 second after I click on the options there before the action is executed. Is that normal?
2. I think I will be using the demo's script (or Moonlight Walk's script) as a skeleton for my kinetic novel. So what are the things in the script that I can safely remove?
3. I'm doing a kinetic novel, so I don't need so many save_names since I don't have any choice branches. If anybody is doing kinetic novels, mind telling me what you did here? Should I divide it up into chapters?
4. In Part 2 of the tutorial, it says it declares a new background by scene bedroom1 with fade. But in the demo's script, it uses image. What happens when you use "scene"?
5. How do you pronounce "Ren'Py"?
I know I have some more questions but I have forgotten what they were. So that's all for now!
1. In Ren'Py's demo main menu screen, I think it takes at least 1 second after I click on the options there before the action is executed. Is that normal?
2. I think I will be using the demo's script (or Moonlight Walk's script) as a skeleton for my kinetic novel. So what are the things in the script that I can safely remove?
3. I'm doing a kinetic novel, so I don't need so many save_names since I don't have any choice branches. If anybody is doing kinetic novels, mind telling me what you did here? Should I divide it up into chapters?
4. In Part 2 of the tutorial, it says it declares a new background by scene bedroom1 with fade. But in the demo's script, it uses image. What happens when you use "scene"?
5. How do you pronounce "Ren'Py"?
I know I have some more questions but I have forgotten what they were. So that's all for now!
Re: Ren'Py Questions
For me, there's a noticable delay, but it's still significantly less than a second. I guess it probably depends how fast the machine running it is - there's nothing in the script that would force a delay there.Sakuya wrote:1. In Ren'Py's demo main menu screen, I think it takes at least 1 second after I click on the options there before the action is executed. Is that normal?
Um... all of it, or none of it, depending on how much of the original you want to keep?Sakuya wrote:2. I think I will be using the demo's script (or Moonlight Walk's script) as a skeleton for my kinetic novel. So what are the things in the script that I can safely remove?
Generally, the safest place to start editing would be right after the start: label - this is the 'script proper', where there's scenes and dialogue and so on, so you'd probably want to remove the dialogue and scene parts at least from this section.
You'll probably also want to change the image and Character declarations at the end of the first init block near the top, to include your own images and characters.
The style stuff right near the top of the first init block is probably the safest to keep, since that just deals with visual appearance and not story.
When I started out, the first thing I did was play with the demo script, successively taking bits like the init blocks out and seeing what broke/stopped happening, which gave me a good idea of what exactly each bit did.
That's what I'd do. I'm pretty sure the save name is only used for display on save games, but it seems to me to be sensible to give someone looking over the saves a clue or two as to how far through the game each save is.Sakuya wrote:3. I'm doing a kinetic novel, so I don't need so many save_names since I don't have any choice branches. If anybody is doing kinetic novels, mind telling me what you did here? Should I divide it up into chapters?
Check the sections of the reference manual that cover the scene statement and the image statement - simply put: The 'image' statement is used to give an image file (e.g. "kitchen.png") a text label, e.g.:Sakuya wrote:4. In Part 2 of the tutorial, it says it declares a new background by scene bedroom1 with fade. But in the demo's script, it uses image. What happens when you use "scene"?
Code: Select all
image kitchen = "kitchen.png"
The 'scene' statement is used to display a named image as the background of a new scene (which also serves to remove other things that had been added to the old scene, like character graphics), e.g.:
Code: Select all
scene kitchen with fade
I'm fairly sure it's a clever pun on the term "Ren'Ai", which I seem to recall is more or less Japanese for 'True Love', and 'Python', the name of the language it's written in - so it's probably pronounced the same as the respective parts of those words: "Ren" as in "Renaissance", "Py" sounding like "Pie".Sakuya wrote:4. How do you pronounce "Ren'Py"?
Thanks, I'm starting to get the hang of this code. A new question:
6. It says sounds cannot be stopped once it starts playing. So I take it it will stop if you have it on loop=0 which means it plays only once? If I want it to loop until a certain thing takes place, such as a new background image that comes up which marks the start of a new chapter, would that be possible? Does this apply to music too?
6. It says sounds cannot be stopped once it starts playing. So I take it it will stop if you have it on loop=0 which means it plays only once? If I want it to loop until a certain thing takes place, such as a new background image that comes up which marks the start of a new chapter, would that be possible? Does this apply to music too?
Code: Select all
$ renpy.play("soundfile.wav") #plays a sound file that won't stop unless...
$ renpy.play("anotherfile.wav") # ... another file is played before it's over
$ renpy.pause(0.5)
$ renpy.stop() # ... or you stop the sound from playing at some point
$ renpy.music.play("musicfile.mp3") # plays a music file that should loop by default
$ renpy.pause(10) #waits 10 seconds
$ renpy.music.stop() # stops the music
$ renpy.music.play("sometune.ogg", fadein=5) # plays a tune that will take 5 seconds to fade in
$ renpy.pause(5)
$ renpy.music.stop(channel=7, fadeout=5) # fades the music out over 5 seconds, then stops it (channel 7 is the default music channel)
Actually it seems it's either loops=True or loops=False. And it's only available for musics... So if you want to make a looping background sound (like some crowd ambience), you'll have to play it as a music.
Tip : there's a way to make more channels be "music", hence loopable, channels.
I posted my game, which isn't so much ren'ai, here and didn't get kicked too much, so it should be okay. But of course, the crowd appreciate the promise of possible ren'ai elements ^^.
Tip : there's a way to make more channels be "music", hence loopable, channels.
I posted my game, which isn't so much ren'ai, here and didn't get kicked too much, so it should be okay. But of course, the crowd appreciate the promise of possible ren'ai elements ^^.
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
I got rid of the loop counter around 5.1 or so, as it was hard to implement and unreliable in the face of saving, loading, rollback, and the like. You can sorta fake it with renpy.music.queue, however... just queue up the music as many times as you want.
I don't think we're very strict about enforcing the Ren'Ai aspect of things.
I don't think we're very strict about enforcing the Ren'Ai aspect of things.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Miko-Class Veteran
- Posts: 733
- Joined: Fri Jul 07, 2006 9:58 pm
- Projects: Suna to Majo
- Location: France
- Contact:
Monele, I wonder how you managed to handle that type of SFX looping.
Actually I wanted to play a sfx for a certain amount of time with your technique then use the renpy.pause method so that I would stop and fade the SFX, but I can't seem to make it work... (even by using different channels)
By the way I'm still searching through the demo how to put up a music on the main menu screen... Any hints?
Actually I wanted to play a sfx for a certain amount of time with your technique then use the renpy.pause method so that I would stop and fade the SFX, but I can't seem to make it work... (even by using different channels)
Code: Select all
$ renpy.music.play('bgm002.ogg', channel=1)
$ renpy.music.play('se010.ogg', channel=2, fadeout=3, fadein=3)
The trick :
This says that channel 5 & 6 will be assigned to sound effects... yet they are really music channels (in that they can loop and all that stuff).
In-game, you would then go :
You will *have* to indicate one of those special channels for it to work.
Not sure exactly what you're trying to do but I'll assume you want to :
1) play a background music
2) at some point play a *looping* sfx for some time (if it's not looping, it's a totally different thing)
3) after some time (either a pause or the script going on for a few lines), stop that sfx with a fadeout.
If you want the loop sound to fade in too, just add "fadein=X" as a parameter to music.play.
Code: Select all
init:
python:
renpy.sound.set_mixer(6, "sfx")
renpy.sound.set_mixer(5, "sfx")
In-game, you would then go :
Code: Select all
$ renpy.music.play('fire_amb.ogg', channel=6, loop=True, fadein=3)
$ renpy.music.play('jungle_amb.ogg', channel=5, loop=True, fadein=3)
Not sure exactly what you're trying to do but I'll assume you want to :
1) play a background music
2) at some point play a *looping* sfx for some time (if it's not looping, it's a totally different thing)
3) after some time (either a pause or the script going on for a few lines), stop that sfx with a fadeout.
Code: Select all
$ renpy.music.play('music.ogg') # will just play some tune in the background, on the default music channel
[...]
$ renpy.music.play('loopsound.wav', channel=6) # start playing the sound loop on channel 6
[...]
$ renpy.music.stop(channel=6, fadeout=3) # fades the sound out (3 seconds) and stops it
The background image is specified in style - in the demo script the lines (in the init block riiight at the bottom of the file) that control the background images are:Sakuya wrote:I'm also interested in how to edit the main menu by adding a custom-made background/CG as well as BGM.
Code: Select all
$ style.mm_root.background = Image("mainmenu.png")
$ style.gm_root.background = Image("gamemenu.png")
As I understand it, you can assign any displayable to those, so if you wanted a custom CG you could assign an Image() object like in the demo examples, but you could equally assign a Solid() (e.g. "Solid((0,0,0,255))" for black) colour, or composite something together in your init block or whatever.
As for playing music, all you need to do is add a 'main_menu' label to your script, which will get called by Ren'Py when it wants to display the main menu. If you want to run the entire menu yourself you can then messa round with ui functions and jump out of context to start the game (which is detailed a bit in the manual) but if all you want to do is play some music, you can turn control over to Ren'Py to finish off the menu by jumping to the '_library_main_menu' label.
By way of example, if you copy and paste this label into the demo script - best put it right at the beginning or right at the end to make sure you're not interrupting any other code - then you'll get the Joplin piece played on the menu screen:
Code: Select all
# This label will get called automatically when the game gets to the main menu.
label main_menu:
# Set some music playing.
$ renpy.music.play('sun-flower-slow-drag.mid')
# Lastly, tell Ren'Py to go manage the menu like it normally does.
jump _library_main_menu
On one hand, yes. If you use the following code instead:Sakuya wrote:Thanks very much. So having a character image appear with a fade-in on the main menu before the options appear is possible by putting it above the BGM line of code?
Code: Select all
label main_menu:
scene bg carillon
show eileen happy
with fade
$ renpy.pause(3)
$ renpy.music.play('sun-flower-slow-drag.mid')
jump _library_main_menu
On the other hand, if you scroll right to the bottom of the demo script there's a commented-out section that starts "label splashscreen:" - as the comment above suggests, this code is executed before the menu is shown for the first time (but not subseqent times in that execution) so if you're looking to do a short intro, that's the place to put it.
You can also start music playing there which lasts into the main menu, but the splashscreen doesn't get called if the game ends/resets and goes back to the main menu, so in those situations you'd get no music if you only started it in the splashscreen code.
Well, what I meant was, have the character image appear ON the main menu instead of having it fade out and then fade in the main menu. So:
1. Main menu image fades in.
2. Character image fades in.
3. Music fades in.
4. Options fades in.
5. And if it's possible, when the user selects Start, everything will fade to black before the game begins.
Edit:
If there's no way to do that, then perhaps I can put the character image onto the main menu image PNG. That way, when the code jumps to the main menu, it will still have the character there.
1. Main menu image fades in.
2. Character image fades in.
3. Music fades in.
4. Options fades in.
5. And if it's possible, when the user selects Start, everything will fade to black before the game begins.
Edit:
If there's no way to do that, then perhaps I can put the character image onto the main menu image PNG. That way, when the code jumps to the main menu, it will still have the character there.
To my knowledge, you can't actually fade into or out of the main menu - but you can more than likely cheat and make it look like you have. Consider instead:Sakuya wrote:1. Main menu image fades in.
2. Character image fades in.
3. Music fades in.
4. Options fades in.
5. And if it's possible, when the user selects Start, everything will fade to black before the game begins.
(In main_menu label)
* Fade to image of character
* Fade in music
* Fade to a screenshot of the menu screen
* Jump to _library_main_menu
(set main menu BG image to the image of the character from before)
(In start label, called when 'start game' is clicked)
* display screenshot of the menu screen with no transition effects
* fade from screenshot to black
* begin game
... make sense?
PyTom will probably come back from Otakon and tell me I've got it all wrong anyway and you can in fact fade in and out of the actual functioning-while-it's-fading main menu...
[Edit: I see you had the same idea I did!]
Who is online
Users browsing this forum: No registered users