File Organization

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.
Post Reply
Message
Author
User avatar
Gear
Miko-Class Veteran
Posts: 764
Joined: Tue Apr 05, 2011 10:15 pm
Projects: Tempestus Sum
Organization: Xenokos Interactive
IRC Nick: Gear
Skype: Skye.Gear
Location: Grand Prairie, TX
Contact:

File Organization

#1 Post by Gear »

I'm sure this has been asked before, but I haven't seen it yet, so I figure I'll ask it now. Is it possible to further organize files within the "game" folder? I know I could just create a new folder, but how would I tell Ren'Py to search for a file in a different location other than just the root game folder?

I tried this, but it doesn't work, since the slash prevents the engine from registering one of the characters:

Code: Select all

image bg pro = "title\bgpro.jpg"
The best reason to get up in the morning is to outdo yourself: to do it better than you've ever done it before. But if you haven't done it better by nightfall... look at your globe and pick a spot: it's always morning somewhere.

Mechathulhu
Newbie
Posts: 1
Joined: Thu Apr 21, 2011 3:39 pm
Contact:

Re: File Organization

#2 Post by Mechathulhu »

I'm not 100% sure if this is the correct way to do it, but I do know it works.

Code: Select all

image bg pro = "title/bgpro.jpg"
In Python, you would do something like os.path.join("title", "bgpro.jpg"), which automatically combine the paths to whatever is appropriate to your operating system (slash for Linux/OSX, backslash for Windows), but it seems Ren'Py only works if you use slashes. It might automatically convert the slashes to backslashes for Windows, but I'm not sure.

User avatar
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:

Re: File Organization

#3 Post by PyTom »

You want to use a forward slash / rather than a backslash. It's one way in which Ren'Py betrays its secret unix origins. (Also, backslash is a special character in Python. \b is the single backspace character.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Gear
Miko-Class Veteran
Posts: 764
Joined: Tue Apr 05, 2011 10:15 pm
Projects: Tempestus Sum
Organization: Xenokos Interactive
IRC Nick: Gear
Skype: Skye.Gear
Location: Grand Prairie, TX
Contact:

Re: File Organization

#4 Post by Gear »

Amazing. I could swear up and down I've tried that before to no avail, and yet it works now without issue. Thanks for the help. I'm going to go brain myself with a Unix manual now.
The best reason to get up in the morning is to outdo yourself: to do it better than you've ever done it before. But if you haven't done it better by nightfall... look at your globe and pick a spot: it's always morning somewhere.

Post Reply

Who is online

Users browsing this forum: Google [Bot]