Is there a way to open a file outside of the game directory?

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
ringo_ni_ringo
Newbie
Posts: 7
Joined: Tue Mar 18, 2014 12:01 pm
Projects: Spinoza Rosa
Location: Tucson, AZ
Contact:

Is there a way to open a file outside of the game directory?

#1 Post by ringo_ni_ringo »

So, I am noticing that my "game" folder for this project is getting really crowded and hard to sort through when I need to change/re-size/edit an image or shorten a sound so it fits. I could just use the 'Search' that windows has but it isn't effective to search by the file type or name. I was thinking of separating the sprites and backgrounds from the music and sounds and making it more organized. Maybe I'm just a bit OCD when it comes to how things are organized on computers and such, but it really does help me a lot to do so. (I've spent a chunk of time trying to research this and either there's nothing or Google is stupid.)

AxemRed
Veteran
Posts: 482
Joined: Sun Jan 09, 2011 7:10 am
Contact:

Re: Is there a way to open a file outside of the game direct

#2 Post by AxemRed »

Use subfolders.

User avatar
ringo_ni_ringo
Newbie
Posts: 7
Joined: Tue Mar 18, 2014 12:01 pm
Projects: Spinoza Rosa
Location: Tucson, AZ
Contact:

Re: Is there a way to open a file outside of the game direct

#3 Post by ringo_ni_ringo »

Well yes, but how do I call them? Like I tried to, and it worked. The problem I have is that I don't know if telling it "C:/Users/Zoe/Desktop/PROJECTS/Spinoza Rosa/game/bleh/bleh.png" would work on another computer. I'm still kind of a noob when it comes to ren'py and python, but I have lots of experience in visual BASIC and html.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Is there a way to open a file outside of the game direct

#4 Post by xela »

Just the "bleh/bleh.png" will do.
Like what we're doing? Support us at:
Image

User avatar
ringo_ni_ringo
Newbie
Posts: 7
Joined: Tue Mar 18, 2014 12:01 pm
Projects: Spinoza Rosa
Location: Tucson, AZ
Contact:

Re: Is there a way to open a file outside of the game direct

#5 Post by ringo_ni_ringo »

Oh, thank you. >_<; I feel kinda silly now.

User avatar
ringo_ni_ringo
Newbie
Posts: 7
Joined: Tue Mar 18, 2014 12:01 pm
Projects: Spinoza Rosa
Location: Tucson, AZ
Contact:

Re: Is there a way to open a file outside of the game direct

#6 Post by ringo_ni_ringo »

Okay so ren'py hated what ever I did. I gave it the images for all the characters and the backgrounds just like this:

Code: Select all

## Declare character images below this line.

## FIAMN
image fiamn neutral = "/characters/fiamn/fiamn_neutral.png"
image fiamn semb = "/characters/fiamn/fiamn_semb.png"
image fiamn emb = "/characters/fiamn/fiamn_emb.png"
image fiamn silly = "/characters/fiamn/fiamn_silly.png"
image fiamn sad = "/characters/fiamn/fiamn_sad.png"
image fiamn serious = "/characters/fiamn/fiamn_serious.png"
image fiamn angry = "/characters/fiamn/fiamn_angry.png"
image fiamn annoyed = "/characters/fiamn/fiamn_annoyed.png"
image fiamn happy = "/characters/fiamn/fiamn_happy.png"
and it gives me this error:
I'm sorry, but an uncaught exception occurred.

While running game code:
File "game/script.rpy", line 820, in script
IOError: Couldn't find file '/characters/fiamn/fiamn_neutral.png'.
I have the folders set up like this:
Capture.PNG
Capture2.PNG
What did I do wrong to upset this thing to the point that it won't run at all?

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Is there a way to open a file outside of the game direct

#7 Post by Asceai »

get rid of the / at the start of the paths

Code: Select all

image fiamn neutral = "characters/fiamn/fiamn_neutral.png"

User avatar
ringo_ni_ringo
Newbie
Posts: 7
Joined: Tue Mar 18, 2014 12:01 pm
Projects: Spinoza Rosa
Location: Tucson, AZ
Contact:

Re: Is there a way to open a file outside of the game direct

#8 Post by ringo_ni_ringo »

Thank you. >_< Everything works fine now.
It was a pain to go through and change that though...

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Is there a way to open a file outside of the game direct

#9 Post by xela »

Get a decent text editor and use the replace function. Noone changes this stuff manually if there is a pattern to fix on.
Like what we're doing? Support us at:
Image

User avatar
ringo_ni_ringo
Newbie
Posts: 7
Joined: Tue Mar 18, 2014 12:01 pm
Projects: Spinoza Rosa
Location: Tucson, AZ
Contact:

Re: Is there a way to open a file outside of the game direct

#10 Post by ringo_ni_ringo »

Y-you don't have to do it manually? 0A0

User avatar
Destiny
Veteran
Posts: 468
Joined: Thu Jun 14, 2012 2:00 pm
Projects: Cards of Destiny, Sky Eye
Location: Germany
Contact:

Re: Is there a way to open a file outside of the game direct

#11 Post by Destiny »

Nope, pretty much all text editors (especially those of Ren'Py) feature the search/replace feature
You only have to watch out what to replace with what (if the way is "/liam/liam_not", then just replacing "/liam" into "liam" will result in a "liamliam_not" instead of the wanted "liam/liam_not").
Replace.png
Image
Cards of Destiny (WIP) / Sky Eye (WIP)

Post Reply

Who is online

Users browsing this forum: No registered users