How do you organize your scripts

A place to discuss things that aren't specific to any one creator or game.
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Message
Author
User avatar
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

#1 Post by Sabotage » Fri Mar 29, 2013 6:28 am

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?

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

#2 Post by Obscura » Fri Mar 29, 2013 7:30 am

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.
Coming Out On Top - An Adult Gay Dating Sim
website

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

#3 Post by TrickWithAKnife » Fri Mar 29, 2013 11:27 am

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.

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.

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

#4 Post by Sabotage » Fri Mar 29, 2013 12:39 pm

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.
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:

img character happy
show character happy

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.
Oh goodness.. so you can have a separate rpy for the backgrounds and the character images? Wow!

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?

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

#5 Post by Obscura » Fri Mar 29, 2013 1:21 pm

a .rpy per sprite (the sprites are made up of multiple, interchangeable layers so their code is quite long)
Sorry, "a" should be changed to "one" .rpy file per sprite.

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.)
Coming Out On Top - An Adult Gay Dating Sim
website

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

#6 Post by Sabotage » Fri Mar 29, 2013 1:47 pm

Obscura wrote:
a .rpy per sprite (the sprites are made up of multiple, interchangeable layers so their code is quite long)
Sorry, "a" should be changed to "one" .rpy file per sprite.

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.)
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).

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

#7 Post by TrickWithAKnife » Fri Mar 29, 2013 7:10 pm

Sabotage wrote:Oh goodness.. so you can have a separate rpy for the backgrounds and the character images? Wow!
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: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?
Neither. One of the features inside the game is a smartphone that the protagonists can use to do various things.

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.

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

#8 Post by arachni42 » Fri Mar 29, 2013 10:50 pm

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?
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. ;)

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.
I, Miku (NaNoRenO 2014)
Vignettes (NaNoRenO 2013)
_________________

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

#9 Post by Ran08 » Fri Mar 29, 2013 11:55 pm

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! :o Like arachni42, I also just "call" out the different paths, and I have a separate file for the flags. :)

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

#10 Post by ebi brain » Sat Mar 30, 2013 5:37 am

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:/
Since I have our site RSI, I used speech recognition by, sometimes this means I'll make some mistakes. :D

My sketchbook - Come yell at me :D

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

#11 Post by TrickWithAKnife » Sat Mar 30, 2013 6:03 am

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.

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

#12 Post by ebi brain » Sat Mar 30, 2013 10:13 am

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 :D
Thanks!
Since I have our site RSI, I used speech recognition by, sometimes this means I'll make some mistakes. :D

My sketchbook - Come yell at me :D

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

#13 Post by Kokoro Hane » Sun Mar 31, 2013 7:36 pm

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"

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: How do you organize your scripts

#14 Post by Gear » Tue Apr 02, 2013 12:41 am

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.

Code: Select all

Example: 02.rpy
##Misplaced
label misplaced:
    D "Dialogue?  Yes!  Yay!"
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.
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.

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

#15 Post by Audria » Tue Apr 02, 2013 2:35 am

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!

Post Reply

Who is online

Users browsing this forum: No registered users