using multiple script files to seperate scenes

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
iksanabot2
Newbie
Posts: 14
Joined: Tue Apr 30, 2019 11:27 am
Contact:

using multiple script files to seperate scenes

#1 Post by iksanabot2 »

Hi everyone,
I'm new to renpy but not completely new to python. I'm experienced coding with Matlab, and so Python feels familiar to me, but I still need to learn some of the language differences.

Anyway, I am writing a multi-scene script that will also be multi episode. To keep things organized and easy to find, I'm creating a seperate script file for every scene. So for example, the first script file is "scriptE01S01.rpy", the next scene is "scriptE01S02.rpy", and eventually I'll potentially have script files all the way up to "E99S99.rpy". I'll be keeping track of mutliple variables that get adjusted over the course of all episodes/scenes. My question is, does anybody see a problem with the way I am doing it? Will I get to a point where I realize I should have done it much differently?

Thanks for your advice,
iksanabot

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: using multiple script files to seperate scenes

#2 Post by Per K Grok »

iksanabot2 wrote: Tue Apr 30, 2019 11:35 am Hi everyone,
I'm new to renpy but not completely new to python. I'm experienced coding with Matlab, and so Python feels familiar to me, but I still need to learn some of the language differences.

Anyway, I am writing a multi-scene script that will also be multi episode. To keep things organized and easy to find, I'm creating a seperate script file for every scene. So for example, the first script file is "scriptE01S01.rpy", the next scene is "scriptE01S02.rpy", and eventually I'll potentially have script files all the way up to "E99S99.rpy". I'll be keeping track of mutliple variables that get adjusted over the course of all episodes/scenes. My question is, does anybody see a problem with the way I am doing it? Will I get to a point where I realize I should have done it much differently?

Thanks for your advice,
iksanabot
Having different script files is just fine. Renpy will work just the same if you have everything in one script file or if you split the code up between many script files. But it is a lot easier to keep track for the programmer.

The labels is all that is needed to go from code in one script file to code in another.

I do the same thing, except I'm not as organized in naming the different script files. :)

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: using multiple script files to seperate scenes

#3 Post by xavimat »

Renpy will consider all your .rpy files as a large unified file. You can organize them as you please.
I usually have a file for definitions (define, default, classes), another file for my screens and some others for the labels. If you have complex images (like layered images or Dynamic Displayables) it's useful to have another file for them.
It's important to keep track of your label names, you can't use the same name for different labels (you can't use the same name for different screens neither). An exception to this are local label names.
One advice: don't start your filenames with double zero (00something.rpy) because that can confuse renpy (internal renpy files have 00names to ensure they are executed before your own files).
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

iksanabot2
Newbie
Posts: 14
Joined: Tue Apr 30, 2019 11:27 am
Contact:

Re: using multiple script files to seperate scenes

#4 Post by iksanabot2 »

Thanks Per K Grok, thanks xavimat!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]