Subdirectories and audio in init blocks
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.
-
- Newbie
- Posts: 19
- Joined: Mon Apr 08, 2013 10:46 pm
- Contact:
Subdirectories and audio in init blocks
Ok, my questions are pretty much what the title says. I consulted both the Ren'py wiki and manual to no avail, and my inquiries are as follows:
1. Can I define my audio files in an init block (pretty much like images) so that I could only write play music x instead of play music "insertlongname.mp3" within the script?
2. How can I reference subdirectories within the game folder without writing something like this - "D:/Imagini/renpy-6.14.1-sdk/Work_in_progress/game/Graphics/Backgrounds/House.png" - in every single image definition I have? Same thing goes for sounds and music which are placed now inside /game/Audio/Sounds and /game/Audio/Music. (now you probably know why I want to define the audio in init blocks too...)
Isn't there any way to avoid this tedious work? I don't want my game directory to look like a recycle bin with pngs, oggs and rpys in the same fies-ridden folder, but I don't want to write whole directories throughout the whole script either, so help will be very appreciated!
1. Can I define my audio files in an init block (pretty much like images) so that I could only write play music x instead of play music "insertlongname.mp3" within the script?
2. How can I reference subdirectories within the game folder without writing something like this - "D:/Imagini/renpy-6.14.1-sdk/Work_in_progress/game/Graphics/Backgrounds/House.png" - in every single image definition I have? Same thing goes for sounds and music which are placed now inside /game/Audio/Sounds and /game/Audio/Music. (now you probably know why I want to define the audio in init blocks too...)
Isn't there any way to avoid this tedious work? I don't want my game directory to look like a recycle bin with pngs, oggs and rpys in the same fies-ridden folder, but I don't want to write whole directories throughout the whole script either, so help will be very appreciated!
-
- Eileen-Class Veteran
- Posts: 1258
- Joined: Fri Sep 21, 2007 7:13 am
- Projects: a battle engine
- Contact:
Re: Subdirectories and audio in init blocks
Yep.1. Can I define my audio files in an init block (pretty much like images) so that I could only write play music x instead of play music "insertlongname.mp3" within the script?
Code: Select all
init python:
x = "insertlongname.mp3"
Code: Select all
define x = "insertlongname.mp3"
You don't want to do that anyway. Your game will break on anyone else's computer. Give paths relative to the 'game' directory- that is, your House.png is:2. How can I reference subdirectories within the game folder without writing something like this - "D:/Imagini/renpy-6.14.1-sdk/Work_in_progress/game/Graphics/Backgrounds/House.png" - in every single image definition I have? Same thing goes for sounds and music which are placed now inside /game/Audio/Sounds and /game/Audio/Music. (now you probably know why I want to define the audio in init blocks too...)
Code: Select all
image House = "Graphics/Backgrounds/House.png"
- Taleweaver
- Writing Maniac
- Posts: 3428
- Joined: Tue Nov 11, 2003 8:51 am
- Completed: Metropolitan Blues, The Loyal Kinsman, Daemonophilia, The Dreaming, The Thirteenth Year, Adrift, Bionic Heart 2, Secrets of the Wolf, The Photographer
- Projects: The Pilgrim's Path, Elspeth's Garden, Secret Adventure Game!
- Organization: Tall Tales Productions
- Location: Germany
- Contact:
Re: Subdirectories and audio in init blocks
Ren'Py-specific questions go into the Ren'Py Questions forum.
Moving.
Moving.
Scriptwriter and producer of Metropolitan Blues
Creator of The Loyal Kinsman
Scriptwriter and director of DaemonophiliaScriptwriter and director of The Dreaming
Scriptwriter of Zenith ChroniclesScriptwriter and director of The Thirteenth Year
Scriptwriter and director of Romance is DeadScriptwriter and producer of Adrift
More about me in my blog"Adrift - Like Ever17, but without the Deus Ex Machina" - HigurashiKira
-
- Newbie
- Posts: 19
- Joined: Mon Apr 08, 2013 10:46 pm
- Contact:
Re: Subdirectories and audio in init blocks
Thanks a lot! I tried to do a relative-to-the-game-directory-pathway, but I always wrote it "game/Graphics/Backgrounds/House.png" instead of just "Graphics/Backgrounds/House.png" and it didn't work... Again, thanks for the help!
EDIT: Although the pathway works in its new form, I still can't define music! Whether I try it after "init python" or before in the ways suggested above, ren'py crashes and says "IO Error: couldn't find file [defined-name]"
EDIT: Although the pathway works in its new form, I still can't define music! Whether I try it after "init python" or before in the ways suggested above, ren'py crashes and says "IO Error: couldn't find file [defined-name]"
-
- Eileen-Class Veteran
- Posts: 1258
- Joined: Fri Sep 21, 2007 7:13 am
- Projects: a battle engine
- Contact:
Re: Subdirectories and audio in init blocks
Post code, both the code where you define it and the code where you play it.Vict0r1994 wrote:EDIT: Although the pathway works in its new form, I still can't define music! Whether I try it after "init python" or before in the ways suggested above, ren'py crashes and says "IO Error: couldn't find file [defined-name]"
-
- Newbie
- Posts: 19
- Joined: Mon Apr 08, 2013 10:46 pm
- Contact:
Re: Subdirectories and audio in init blocks
The code where I define it:
The code where I play it:
I double-checked the name and extension of the file and it is indeed "alarm_clock.mp3". What am I doing wrong?
Code: Select all
define alarm_clock = "Audio/Sounds/alarm_clock.mp3"
Code: Select all
play sound "alarm_clock"
-
- Newbie
- Posts: 19
- Joined: Mon Apr 08, 2013 10:46 pm
- Contact:
Re: Subdirectories and audio in init blocks
No matter. Found the mistake. I shouldn't have put commas where I played it. Thanks again!
Who is online
Users browsing this forum: Ahrefs [Bot], Ocelot