Page 1 of 1

Seperating text into script files?

Posted: Sun Sep 11, 2011 7:13 pm
by Kazegen
I'm compiling a demo to release for my game soon, but I'd like to separate my GIGANTIC script for the game into separate script files. A good example of this would be in the tutorial file, where if you look at the game script there's a bunch of tabs at the top for each tutorial. It seems to me like separating the parts of my game into small chunks would make it easier to edit. Is this a practical thing to do, and if so, how would I go about doing it?

Re: Seperating text into script files?

Posted: Sun Sep 11, 2011 7:29 pm
by HigurashiKira
Simply copy/paste parts of the script into new .rpy files. You can easily jump between scripts with no problems

Code: Select all

label start:
"Blahblahblah"

jump text2:

#This next part is in a seperate .rpy file

label text2:
"Randon stuff"

jump text3:

#Another jump

label text3:
"Yay"

Re: Seperating text into script files?

Posted: Sun Sep 11, 2011 7:31 pm
by bink
It's really something you should do to keep your project under control. It makes finding and editing things much easier.
If you want some code to be in a different file, just create a new .rpy file and paste the code in. However, you can't have one half of a function or a label in one file and another half in the other file. You can only copy over passage that can work no matter where they are in the script.
For example, if you have two labels, just copy one over to the new file and delete it from the old file. Jumps between labels will work across multiple files. That's the easiest way to split up your code.

Code: Select all

#in day_one.rpy
label day_one_end:
    "Wow, what a day."
    "I should go to bed now."
    jump day_two_wake_up

#in day_two.rpy
label day_two_wake_up:
    "It's morning already?!"
This works fine. Ren'Py just jumps to a label that is located in another file. As you can see, it's actually quite simple and works automatically. If your story is already divided up into several labels, you can just copy them over.

Re: Seperating text into script files?

Posted: Sun Sep 11, 2011 8:31 pm
by Kazegen
Ok, worked out fine. Thanks for the help.