Multiple Script Question

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
User avatar
Suru
Regular
Posts: 111
Joined: Wed Aug 31, 2016 10:27 pm
Contact:

Multiple Script Question

#1 Post by Suru » Wed May 31, 2017 11:45 pm

Hello,

I have been working on a game on and off for about 9 months when I have the time. I've figured out many basic functions and ways to make certain aspects of the game work the way I want them too. However, my Script is getting very long. I'm at at little over 6400 lines of code. This is at about 90ish minutes of playtime. From what I've tested so far everything works. My issue is that it's getting to the point where I want to branch out.

I have a lot of places for the character to go but I would like to be able to use scenes already written without having to write them out all over again every time a new choice comes up. Is there a way to use another of the script files so I could basically have a ongoing list of events where if one has already happened it moves to the next?

For example:

Jane has the option of going to the park, the zoo, or the museum. Each goes to it's own if statement and then plays through the scene then after it moves to the next piece of the script afterward.

The following day she isn't feeling the park so she goes to the museum. Is there a way to have the scene that would have been written up at the point of the park if statement but it happens now without having to rewrite the entire scene again?

Can I keep the scenes for different places in different files basically, so I can call on them when needed?

Sorry if this is unclear, I hope this describes my problem well enough. Everything I've done so far I've learned pretty much from forums but I don't understand a lot of actual programming jargon so I am not sure on how to approach this (or what I would even look up). So I wanted to ask about it.

Thanks

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Multiple Script Question

#2 Post by Divona » Thu Jun 01, 2017 1:13 am

See:

Language Basic from Ren'Py Documentation.
Generally, there's no difference between a script broken into multiple files, and a script that consists of one big file. Control can be transferred between files by jumping to or calling a label in another file. This makes the division of a script up into files a matter of personal style - some game-makers prefer to have small files (like one per event, or one per day), while others prefer to have one big script.
Read about Labels & Control Flow.

Also from the other threads:
- Script in multiple files?
- How to break up your script in to multiple files
- multiple script files?
- How Can I Use Multiple Script Files?
- Multiple routes
Completed:
Image

User avatar
Suru
Regular
Posts: 111
Joined: Wed Aug 31, 2016 10:27 pm
Contact:

Re: Multiple Script Question

#3 Post by Suru » Thu Jun 01, 2017 1:25 am

Awesome. I already have a better idea and knowing where to look helps a lot! I'm gonna get right back to work! Thanks so much for the links!

Post Reply

Who is online

Users browsing this forum: Google [Bot]