init order

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
Longknight
Newbie
Posts: 15
Joined: Tue Jul 08, 2014 9:37 am
Contact:

init order

#1 Post by Longknight »

Hello all , i need some help

i am trying to work thru some code to understand renpy and python better an i keep coming across the follow at different points in the files

Code: Select all

init -2:

Code: Select all

init -6 python:

Code: Select all

init:

Code: Select all

init -10 python:
now i know its something to do with initialising values or python code before the game starts(i think) , but do the numbers indicate some kind of order?
If someone could explain it to me or point me in the right direction that would be great

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: init order

#2 Post by Asceai »

Yes.
Lower values are executed first.

All the 'init priority' statements ("image", "define", "style" etc.), unless they appear in an init block, are implicitly init 0.

Longknight
Newbie
Posts: 15
Joined: Tue Jul 08, 2014 9:37 am
Contact:

Re: init order

#3 Post by Longknight »

Thank you for that, i couldn't find it anywhere i looked

Out of curiosity, are there certain things that should be initialized before or after certain things or is it pretty much up to the coder?

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: init order

#4 Post by Donmai »

No matter how many '.rpy' script files you put inside your game folder, Ren'Py will treat them as a single big script file, and will try to execute things in this order: python early, init (-900 to 900), splashscreen, label start.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

Longknight
Newbie
Posts: 15
Joined: Tue Jul 08, 2014 9:37 am
Contact:

Re: init order

#5 Post by Longknight »

Excellent, Thank you for that

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Andredron