Entire script file in one tab? [Solved]

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
yon
Regular
Posts: 174
Joined: Tue Sep 09, 2014 5:09 pm
Projects: YDSP
Soundcloud: tetra-yon
itch: v-ual
Location: United States
Contact:

Entire script file in one tab? [Solved]

#1 Post by yon »

I've been wondering about this and it's held me up from actually working on coding the final product of YDSP to some extent. Does the entire game need to be in the same, single script file? By the end, it'll be absolutely enormous if I incorporate every single event and permeation.

Essentially, the way I have it set up is major events, minor events, and extra events.
Minor events happen the same way every playthrough. Major events are your routes, and extra events are connected to said route but less intensive.

After the 4th event on each route, it then breaks up into different types, best, good and bad. Essentially, if your affection points is, for example, X>50, you'd get best. 30<X<50 is good, and X<30 is bad.

What I was wondering is, would it be possible to include the route events themselves in other files and simply call them when they're triggered in the game? YDSP is a little simple in that your only interaction is choosing menus when they're presented to you, and events happen on specific days and specific times. Character X's rank 5 event is always on the fifth Tuesday of the game, for example.

I worry that including every single thing in the same script file would make it run terribly and result in more than a few errors. So, I reiterate:

Do I need to put it all into one file, or can it be separated into tabs and called when it's time for said event to play out?

What I think might work is to have the minor events in the script, since they're the same each time, then each character's route as its own file, and each character's extra events as their own files. Would that work? If not, why not?
Last edited by yon on Tue Oct 21, 2014 8:16 pm, edited 1 time in total.

thebackup
Veteran
Posts: 320
Joined: Fri Mar 27, 2009 7:36 pm
Completed: Final Week, CardioQuiz, Cafe Memoria, All I Want for Christmas is a Girlfriend, Dating Sim! Re:Mastered, Dating Sim! Luna's Lovely Summer
Projects: Memoria (on hiatus), Cafe Memoria Deux (cancelled)
Organization: PixaelSoft
itch: thebackup
Location: Southern CA
Contact:

Re: Entire script file in one tab?

#2 Post by thebackup »

yon wrote:Does the entire game need to be in the same, single script file? By the end, it'll be absolutely enormous if I incorporate every single event and permeation.
To put simply, no, you can split the game across scripts. You could have for example:

script.rpy

Code: Select all

label start:

    "blah blah!"

    if affection >= 50:
        call bestRoute
    elif (affection >= 30) or (affection < 50):
        call goodRoute
    elif affection < 30:
        call badRoute

    "should return here after the calls"

bestRoute.rpy

Code: Select all

label bestRoute:

    "the best ending!"
You might want to look at this:
http://www.renpy.org/doc/html/label.html

I hope this is what you're looking for!

champignonkinoko
Regular
Posts: 61
Joined: Sun Sep 07, 2014 8:51 pm
Contact:

Re: Entire script file in one tab?

#3 Post by champignonkinoko »

@thebackup

Thanks! That helped!

User avatar
Kate
Regular
Posts: 197
Joined: Thu Sep 19, 2013 6:10 pm
Projects: Blackout
Organization: Moonlight Otome
Location: United States
Contact:

Re: Entire script file in one tab?

#4 Post by Kate »

Right! It's handy to put separate events or routes in different files! Make sure you add at the end a

Code: Select all

"best ending!"

return
That will make sure your game returns back to where you "called" from and then you'll be back in the original file.
Current Project:
Blackout [VN][Romance][GxB][Mystery][Suspense] http://lemmasoft.renai.us/forums/viewto ... 43&t=34118
"It is the duty of authors to make the fantastic seem ordinary and the ordinary seem fantastic." - K. Auer

User avatar
Tayruu
Regular
Posts: 141
Joined: Sat Jul 05, 2014 7:57 pm

Re: Entire script file in one tab?

#5 Post by Tayruu »

I'm not sure if you necessarily have to put in a return in this sort of situation, but I try to make a habit of ending things with it as a mental indicator.

IIRC a 'called' label you can use return to jump back a label, however using 'jump' will mean using return goes back to the title screen, as it resets the stack of labels. (... actually the documentation thebackup linked mentions this, so there you go.)

User avatar
yon
Regular
Posts: 174
Joined: Tue Sep 09, 2014 5:09 pm
Projects: YDSP
Soundcloud: tetra-yon
itch: v-ual
Location: United States
Contact:

Re: Entire script file in one tab?

#6 Post by yon »

Ah, thank you! I'm familiar with labels, but I wasn't aware you could put them in other tabs. I appreciate all the replies.

Post Reply

Who is online

Users browsing this forum: decocloud, Google [Bot]