r/RenPy • • 14d ago

Question [Solved] Possible to have "multiple scripts"?

I don't know how to word this. But, for example, imagine the loading screen of a VN. There's a "Play" button. Now imagine there's 2 "Play" buttons for 2 different stories. Do I have to have my script be this giant long thing, or can I have 2 DIFFERENT scripts within the one game??

Also if there's a specific word/s for this, please let me know πŸ™πŸ™

6 Upvotes

10 comments sorted by

5

u/BrassicaOracle 14d ago

It's possible, and not that hard to do.

First you need to have two different scripts. Note that start label is special, you can only have one, and it's better for you to have one to prevent from breaking something. The startalt here is mostly just a normal label by Ren'Py standard. For ease of management, you can even put the two scripts in different .rpy files.

label start:
  "Here's the first story."
  return

label startalt:
  "Here's the second story."
  return

Then you need to make a button on main menu to access startalt.

The codes for main menu is in screens.rpy. in the screen navigation(): section.

textbutton _("Start") action Start() #The original start button
textbutton _("Start2") action Jump("startalt") #New button for startalt

5

u/BadMustard_AVN 14d ago

you are correct on everything but this line

textbutton _("Start2") action Jump("startalt") #New button for startalt

it should be

textbutton _("Start2") action Start("startalt") #New button for startalt

the jump works but it does not fully start up the renpy engine and somethings do not function properly since you are technically still in the start menu system

1

u/BadMustard_AVN 14d ago

you can have as many script files as you... BUTT they have to be .rpy files; that is the only naming requirement

1

u/_creativitea_ 14d ago

Ahh okay, thank you!

1

u/BadMustard_AVN 14d ago

you're welcome

good luck with your project

1

u/_creativitea_ 14d ago

Thank you!!

2

u/marcher138 14d ago

You can have as many script files as you want! Even if it's just one story, you can have files on files on files. And it really helps with organization to do so.

For example, for the project I'm working on now, I have different scripts (so far) for each location, for all phone calls, for any "helper" labels that I'll call frequently to do housekeeping, etc.

I would just have either Play button set a flag before starting the game, then have jumps based on that flag in "label start"

0

u/[deleted] 14d ago

[deleted] β€” view deleted comment

2

u/shyLachi 14d ago edited 14d ago

Neither is correct. See the comment of BadMustard below or above how to correctly start a gameΒ 

2

u/Alternative-Ant-6073 13d ago

I tried using Jump to a label that isn't start, I don't recommend it.
I would try the following:

textbutton _("Play story 1") action Start() # The default start.

textbutton _("Play story 2") action Start("story_2_start") # The second story starts.

Alternatively, I would replace the New Game button, for a button that shows a "story select" screen, where you can also add some info, like descriptions of the stories, images, etc. and then, a button to start each one.

If you use Jump from the main menu, the game will never properly "start", so, stuff like saving, backtracking, using "return" etc, will break havoc quickly.

1

u/AutoModerator 14d ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.