How do you organize your scripts
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
- Sabotage
- Regular
- Posts: 27
- Joined: Thu Mar 28, 2013 7:50 am
- Projects: Cupcake! [WIP-40%] :: Riddled [Idea-0%]
- Contact:
How do you organize your scripts
I am a total newbie when in comes to Ren'py (I've just started a few days ago). It's a fantastic engine and I find myself enjoying the scripting; which is a rare case since I was never the "programmer" type. I guess that is testament to how easy it is to use the program!
For my scripting, I tend to just slap on all the commands in one file. I am aware of "calling" separate scripts and I've tried it. I am just curious how advanced users organize their scripts. Any tips or tricks up your sleeve?
For my scripting, I tend to just slap on all the commands in one file. I am aware of "calling" separate scripts and I've tried it. I am just curious how advanced users organize their scripts. Any tips or tricks up your sleeve?
- Obscura
- Eileen-Class Veteran
- Posts: 1431
- Joined: Fri Mar 09, 2012 6:58 pm
- Projects: Coming Out On Top
- Location: United States
- Contact:
Re: How do you organize your scripts
I'm far from an "advanced" user, but I do have something that generally looks like this:
variable.rpy (for setting and defining all the variables)
main.rpy (for the main storyline)
a .rpy per sprite (the sprites are made up of multiple, interchangeable layers so their code is quite long)
minor_endings.rpy
When the main script starts splitting into different paths, I end up making a new .rpy file for each major path.
variable.rpy (for setting and defining all the variables)
main.rpy (for the main storyline)
a .rpy per sprite (the sprites are made up of multiple, interchangeable layers so their code is quite long)
minor_endings.rpy
When the main script starts splitting into different paths, I end up making a new .rpy file for each major path.
- TrickWithAKnife
- Eileen-Class Veteran
- Posts: 1261
- Joined: Fri Mar 16, 2012 11:38 am
- Projects: Rika
- Organization: Solo (for now)
- IRC Nick: Trick
- Location: Tokyo, Japan
- Contact:
Re: How do you organize your scripts
I have different .rpys for different things to make searching easier. Apart from the regular files that everyone has, these are most of what I use mine for at the moment:
There is some extra language functionality that I've been working on in what little free time I've had recently. That will add at least a few more too.
As you can imagine, the ability for jEdit to line up script files to the side of the window is extremely useful for readability purposes.
- Backgrounds
- Character definitions
- Character images
- Dev notes
- Effects
- Info on various countries
- Intro
- Smartphone
- Test functions
- Variables
There is some extra language functionality that I've been working on in what little free time I've had recently. That will add at least a few more too.
As you can imagine, the ability for jEdit to line up script files to the side of the window is extremely useful for readability purposes.

"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.
If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.
If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.
- Sabotage
- Regular
- Posts: 27
- Joined: Thu Mar 28, 2013 7:50 am
- Projects: Cupcake! [WIP-40%] :: Riddled [Idea-0%]
- Contact:
Re: How do you organize your scripts
That's good insight, mate! Esp. about the one where you separate the minor endings. Good touch. I'm a bit curious about the "a" file though (the sprite one). I haven't gone as far as scripting the sprite itself. I just go:Obscura wrote:I'm far from an "advanced" user, but I do have something that generally looks like this:
variable.rpy (for setting and defining all the variables)
main.rpy (for the main storyline)
a .rpy per sprite (the sprites are made up of multiple, interchangeable layers so their code is quite long)
minor_endings.rpy
When the main script starts splitting into different paths, I end up making a new .rpy file for each major path.
img character happy
show character happy
Oh goodness.. so you can have a separate rpy for the backgrounds and the character images? Wow!TrickWithAKnife wrote: I have different .rpys for different things to make searching easier. Apart from the regular files that everyone has, these are most of what I use mine for at the moment:
Backgrounds
Character definitions
Character images
Dev notes
Effects
Info on various countries
Intro
Smartphone
Test functions
Variables
Then more for actual dialogue and such, organised into chunks of time. Early on they are organised in days, but further will probably be organised into weeks.
Also on the Smartphone one.. Is that one where you bundle the game for smartphone, or a sort of disclaimer in case they're playing it on smartphone?
- Obscura
- Eileen-Class Veteran
- Posts: 1431
- Joined: Fri Mar 09, 2012 6:58 pm
- Projects: Coming Out On Top
- Location: United States
- Contact:
Re: How do you organize your scripts
Sorry, "a" should be changed to "one" .rpy file per sprite.a .rpy per sprite (the sprites are made up of multiple, interchangeable layers so their code is quite long)
The code I'm using is this one.
http://lemmasoft.renai.us/forums/viewto ... 51&t=15345
Except I have 9 different mouths, 4 different sets of eyes, and five different sets of eyebrows per sprite. (Plus 2 poses and a number of different outfits.)
- Sabotage
- Regular
- Posts: 27
- Joined: Thu Mar 28, 2013 7:50 am
- Projects: Cupcake! [WIP-40%] :: Riddled [Idea-0%]
- Contact:
Re: How do you organize your scripts
That's really helpful. And actually logical, when you think about it (saving file size for one thing). It wouldn't look weird, would it? (Mouth out of place etc. otherwise, this might really be worth picking up). I'll post more specific questions over there (it might be off topic here haha).Obscura wrote:Sorry, "a" should be changed to "one" .rpy file per sprite.a .rpy per sprite (the sprites are made up of multiple, interchangeable layers so their code is quite long)
The code I'm using is this one.
http://lemmasoft.renai.us/forums/viewto ... 51&t=15345
Except I have 9 different mouths, 4 different sets of eyes, and five different sets of eyebrows per sprite. (Plus 2 poses and a number of different outfits.)
- TrickWithAKnife
- Eileen-Class Veteran
- Posts: 1261
- Joined: Fri Mar 16, 2012 11:38 am
- Projects: Rika
- Organization: Solo (for now)
- IRC Nick: Trick
- Location: Tokyo, Japan
- Contact:
Re: How do you organize your scripts
I doubt most people would have a separate .rpy for backgrounds, but I just found it easier to keep things organised like that.Sabotage wrote:Oh goodness.. so you can have a separate rpy for the backgrounds and the character images? Wow!
Neither. One of the features inside the game is a smartphone that the protagonists can use to do various things.Sabotage wrote:Also on the Smartphone one.. Is that one where you bundle the game for smartphone, or a sort of disclaimer in case they're playing it on smartphone?
There's a lot of different functions, with some rather lengthy code, so it really needed its own .rpy.
At the end of the day, it's up to you how many .rpys you have, and what you use them for.

"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.
If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.
If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.
- arachni42
- Veteran
- Posts: 341
- Joined: Mon Feb 25, 2013 6:33 pm
- Organization: no, I'm pretty messy
- Location: New York
- Contact:
Re: How do you organize your scripts
I would imagine you'll figure out what works best for you in time. I'm a beginner at Ren'Py, but I've done a lot of other kinds of programming, so I came in with strong preferences for the way I wanted to organize things. "Call" was one of the first things I learned.Sabotage wrote: For my scripting, I tend to just slap on all the commands in one file. I am aware of "calling" separate scripts and I've tried it. I am just curious how advanced users organize their scripts. Any tips or tricks up your sleeve?
My first project has an introduction, then a story for each of five characters in a certain sequence. So it's been pretty simple: introduction.rpy, char1.rpy, char2.rpy, etc. I also made a separate file defining all of the flags. Generally speaking, I like to keep things "modular," so that I'm not crossing over between files all of the time to find stuff. My character definitions are in script.rpy, but that's because there aren't very many of them, and they're all organized together at the top. script.rpy is relatively short, so it's really easy for me to see the overall structure of my game right there. For testing, I can also quickly comment out huge pieces of the game (by commenting out calls) and easily restore them.
I also never, ever, EVER ever give anything a name shorter than 3 characters (and even 3 is pushing it). That is because Ctrl-F is my best friend that I take everywhere I go, and it's pretty tedious to Ctrl-F a variable in 1000s of lines of code if it's named something like "t" or "it".
That's just how I do it; I'd be interested in knowing if other people do keep everything in script.rpy.
- Ran08
- Miko-Class Veteran
- Posts: 737
- Joined: Tue Jun 12, 2012 1:17 am
- Completed: https://ran.itch.io/
- Projects: Fate's Cafe
- Tumblr: otometwist
- Skype: @otomeran
- itch: ran
- Location: Manila
- Contact:
Re: How do you organize your scripts
I sort of have a lot of .rpy files because I have one for the main path and I have separate files for each separate route. I also have a different .rpy file for the backgrounds, the images, and even the character definitions themselves. Just to keep things tidy. 
And... I can't slap commands into one file. They make my head spin!
Like arachni42, I also just "call" out the different paths, and I have a separate file for the flags. 
And... I can't slap commands into one file. They make my head spin!
♡ Feel free to check out my game development blog~
♡ Once Upon A Hallow's Eve is a GxB Halloween otome.
♡ The Thing With Mistletoes is a GxB Christmas otome.
♡ Random VN reviews? Click me! You know you want to~
♡ Once Upon A Hallow's Eve is a GxB Halloween otome.
♡ The Thing With Mistletoes is a GxB Christmas otome.
♡ Random VN reviews? Click me! You know you want to~
-
ebi brain
- Regular
- Posts: 193
- Joined: Thu Nov 11, 2010 1:10 pm
- Organization: Zettai Rookie Project
- Contact:
Re: How do you organize your scripts
Ususally my scripts are just one big file in which I dump EVERYTHING.
It's really chaotic working like that...
So I think after having read this thread,I'm going to split it up in different files...
But I was just wondering, how exactly do you name files?
For instance: day1.rpy, characters.rpy, backgrounds.rpy etc?
Last night I tried to save a file as day1.rpy but I got some traceback error :/
Edit: wait.. I got it! When I use "save as",while you can give the file a different name, it'll just make a copy... so you end up having 2 x "label start"!
Now to find out how to just rename a file:/
It's really chaotic working like that...
So I think after having read this thread,I'm going to split it up in different files...
But I was just wondering, how exactly do you name files?
For instance: day1.rpy, characters.rpy, backgrounds.rpy etc?
Last night I tried to save a file as day1.rpy but I got some traceback error :/
Edit: wait.. I got it! When I use "save as",while you can give the file a different name, it'll just make a copy... so you end up having 2 x "label start"!
Now to find out how to just rename a file:/
Since I have our site RSI, I used speech recognition by, sometimes this means I'll make some mistakes. 
My sketchbook - Come yell at me
My sketchbook - Come yell at me
- TrickWithAKnife
- Eileen-Class Veteran
- Posts: 1261
- Joined: Fri Mar 16, 2012 11:38 am
- Projects: Rika
- Organization: Solo (for now)
- IRC Nick: Trick
- Location: Tokyo, Japan
- Contact:
Re: How do you organize your scripts
Close your editor, open your game folder, and rename the files the old-fashioned way. Be aware there may be three copies of everything.

"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.
If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.
If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.
-
ebi brain
- Regular
- Posts: 193
- Joined: Thu Nov 11, 2010 1:10 pm
- Organization: Zettai Rookie Project
- Contact:
Re: How do you organize your scripts
It's that easy?
So, if I want to rename script.rpy to backgrounds.rpy, all I have to do is rename those three files that are called script.(rpy or something else) in the game directory.
I can do that
Thanks!
So, if I want to rename script.rpy to backgrounds.rpy, all I have to do is rename those three files that are called script.(rpy or something else) in the game directory.
I can do that
Thanks!
Since I have our site RSI, I used speech recognition by, sometimes this means I'll make some mistakes. 
My sketchbook - Come yell at me
My sketchbook - Come yell at me
- Kokoro Hane
- Eileen-Class Veteran
- Posts: 1218
- Joined: Thu Oct 27, 2011 6:51 pm
- Completed: 30 Kilowatt Hours Left, The Only One Girl { First Quarter }, An Encounter ~In The Rain~, A Piece of Sweetness, Since When Did I Have a Combat Butler?!, Piece by Piece, +many more
- Projects: Fateful Encounter, Operation: Magic Hero
- Organization: Tofu Sheets Visual
- Deviantart: kokoro-hane
- itch: tofu-sheets-visual
- Contact:
Re: How do you organize your scripts
I've been using Ren'Py since late 2011, and yet, the funny thing is I don't organize my scripts XD I literally just have my whole VN in the one original script file. It can be frustrating to find, admittedly, but I've gotten so used to it it isn't even all that hard anymore. I guess I'm just a messy programmer. Probably my most MESSY coded VN is my first one that I am still writing....oh my gosh, 57,000+ words, breaking into lots of different paths, and I have the labels everywhere. My newer WIPs, even though everything is in one script, I tend to have all related labels one after the other, so generally I know where what paths I am writing are, unlike my first one which has labels just...everywhere, not always corresponding, but no one would notice in the game since it is commanded to jump to where it needs to go XD Most likely, I will begin to organize from now on when I decide to transition my first VN from 6.12.1 to 6.15.2
PROJECTS:
Operation: Magic Hero [WiP]
Piece By Piece [COMPLETE][Spooktober VN '20]
RE/COUNT RE:VERSE [COMPLETE][RPG]
Since When Did I Have a Combat Butler?! [COMPLETE][NaNoRenO2020+]
Crystal Captor: Memory Chronicle Finale [COMPLETE][RPG][#1 in So Bad It's Good jam '17]
But dear God, You're the only North Star I would follow this far
Owl City "Galaxies"
Operation: Magic Hero [WiP]
Piece By Piece [COMPLETE][Spooktober VN '20]
RE/COUNT RE:VERSE [COMPLETE][RPG]
Since When Did I Have a Combat Butler?! [COMPLETE][NaNoRenO2020+]
Crystal Captor: Memory Chronicle Finale [COMPLETE][RPG][#1 in So Bad It's Good jam '17]
But dear God, You're the only North Star I would follow this far
Owl City "Galaxies"
- 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: How do you organize your scripts
It took me a while to decide how to organize my scripts, but I ended up keeping all the variables, image definitions, character definitions, and startup codes in script.rpy. Then I created Prologue.rpy for all my prologues, 01.rpy for Chapter 1, 02.rpy for all my Chapter 2's, and so-on. I make sure to place all the titles of my chapters in the label and in comments with two hashes so I can CTRL+F them when I need a certain chapter.
The tutorial has its own file, sometimes if one of the chapters is particularly troublesome with code (I have one that's sort of a branch nexus based on decisions) it'll warrant its own file. But basically, this is the system that worked best for me.
Code: Select all
Example: 02.rpy
##Misplaced
label misplaced:
D "Dialogue? Yes! Yay!"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.


- Audria
- Newbie
- Posts: 18
- Joined: Tue Feb 26, 2013 4:16 am
- Projects: Bed & Breakfast, Grace Academy
- Organization: Bloody Rose Designs
- Contact:
Re: How do you organize your scripts
OMGosh, that sounds awesome. Like other newbs, I've just been mashing everything into my script.rpy file. How do you do a call to go to another script when needed? Is there a tutorial on that? If so, would someone post a link so I can investigate this?
Thanks for this awesome organizational skills topic!
Thanks for this awesome organizational skills topic!
Who is online
Users browsing this forum: No registered users
