Quick renpy question: making and using multiple script files

Hamfist

Member
Nov 16, 2019
299
87
so I want to break my "story" into multiple script files to make editing and coding easier without have twenty thousand lines to sift through to find where I need to be for which part of the story.

say for example my story is broken down by the hour,

how do I create a new script file?

then get the story to jump to the new script file once it reaches the end of the first one?

do I just use the "jump step(X)" command and insert label "step(X)" at the beginning? or will it simply move to the next script file once it runs out of script in the one it's in?

I know very basic and stupid questions but over half the wikis I find are shutdown and outdated so I want to make sure i'm using the correct coding for the latest version of renpy.

Thanks for helping
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
5,503
8,036
.rpy files are just text files... Make a new .rpy file, eg. Scenario2.rpy
then start that new file like this:

Python:
label Scenario2:
    Character "Hello, this is a new line"
    return


To connect to Scenario2 from another file, simply type "jump Scenario2"
 

Hamfist

Member
Nov 16, 2019
299
87
thank you very much that's pretty close to what I thought, thanks for clarifying it for me. I'm over 500 lines already and haven't coded in any of the images or scenes for the very beginning portion of the game (first hour) it's going to get very unwieldy if I don't segregate it a bit. just 7 decisions/menus and text/story so far and lots of the story still needs more details written in.
 

Hamfist

Member
Nov 16, 2019
299
87
each episode is one hour, yet it feels like days, and it takes weeks
View attachment 512068
you are not kidding.
i'm not really breaking it down by hour more where the MC is in his day, but I've been at this just shy of a week (learning renpy and daz, having done a total of zero amount of either before this) and only have him waking up eating breakfast and getting ready to head to work. (the main story line is written just not fleshed out to be readable more like a cheat sheet so I don't lose track of where the story is supposed to be going) and that's without ANY images colors or anything fancy coded in like affection modifiers (is that even what they are called). This is a really fun project, I just hope I can create some decent renders to match the story.
 

Hamfist

Member
Nov 16, 2019
299
87
Thanks Polywog, I'm definitely doing my best and since I have read/played dozens of visual novels I know what I want to read and experience from this story.

also doing my best to avoid what I see as common pitfalls in many of them. Like, crunchy incoherent sentences (i'm not talking about translations that's a whole level of hard as hell that I will never criticize), story changing pace to fast or too slow, easy typos, caps and punctuation. Bits of story that really make no impact on the game and don't add to the characters narrative and others. Or time jumps between scenes that don't clarify that time is passing, i'm not judging other peoples games, they are in fact what inspired me to make my own. I just have a clear idea of what I want from mine.

(there's one game I played recently where you have the choice to shower and eat breakfast every morning and neither choice ever leads to anything except you reading the same dialog over and over) but you need select both in turn to progress through the day, until much later in the game where more options open up but those two choices continue to be completely useless. seems like a lot of wasted coding or the Dev had an idea that never got implemented into the game so the options should have been removed in my opinion or combined into a single choice to act as a placeholder for the options that open later in the game)
 
Last edited:

Tarquinius

Newbie
Jul 11, 2018
33
45
To add on/hijack this thread (if I may?), I've also considering dividing my scripts instead of doing one huge one. Are there any benefits to doing this besides organisation? Will it affect performance for instance if my entire game runs on one long script?
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
5,503
8,036
To add on/hijack this thread (if I may?), I've also considering dividing my scripts instead of doing one huge one. Are there any benefits to doing this besides organisation? Will it affect performance for instance if my entire game runs on one long script?

PyTom, in a thread, once said that multiple files is better performance-wise than a single big one.
I do not know why and never tested it myself, but having a file for each thing has always been the standard way to do things.
 

polywog

Forum Fanatic
May 19, 2017
4,065
6,295
To add on/hijack this thread (if I may?), I've also considering dividing my scripts instead of doing one huge one. Are there any benefits to doing this besides organisation? Will it affect performance for instance if my entire game runs on one long script?
Mr Dots' team is a good example. Each update being an RPA archive, simplifies distribution. Just drop the RPA in the game folder.
 

Hamfist

Member
Nov 16, 2019
299
87
Great add on to the question Tarquinius, people are always welcome to toss stuff in on my threads or ask for clarifications, it tends to make for better conversations overall in my opinion.
 

Hamfist

Member
Nov 16, 2019
299
87
PyTom, in a thread, once said that multiple files is better performance-wise than a single big one.
I do not know why and never tested it myself, but having a file for each thing has always been the standard way to do things.
I would have to assume (I could be very wrong) because whatever system is running the game only has to search through or keep active the smaller file to find whatever wherever the given code or command is such as a variable it's easier to find a designated variable from a list of 5 than a list of 500. or like using a full render for a face shot, just a lot of information that's not need the whole time, reduce in demand from the operating system and processor would increase performance. I wonder at what size the impact gets noticable in performance.
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
5,503
8,036
I would have to assume (I could be very wrong) because whatever system is running the game only has to search through or keep active the smaller file to find whatever wherever the given code or command is such as a variable it's easier to find a designated variable from a list of 5 than a list of 500. or like using a full render for a face shot, just a lot of information that's not need the whole time, reduce in demand from the operating system and processor would increase performance. I wonder at what size the impact gets noticable in performance.
As far as I know, it loads everything up as a single file at the end, hence why you can just jump around. I could be wrong tho, don't know much about it.