Hi folks!
Here Nio back for a another discussion about rgss !
for people who begin in rgss you will maybe need to know this little information~
First I will love to say all my explanation are based on my OWN experimentation in rgss I can have false but I love to share my experimentation!
Now let's speak about
Method hierarchy
for people who don't know what is this term in rgss
this simply the order of how method are called !
I spoke with a friend who wanted to know how to show a picture before the Printf of the battle message "enemy appear"
so I thought about the method hierarchy so let's explain
Naturally rgss will run in a sort of way like a stairway and will run the first method after the second method and e.c.t
now this know how to settle the priority of wich method you want to start
because no you can't put your code way ...you will hit a crash for sure
so let's show some exemple code
def mainSceneManager.clear Graphics.freezecreate_backgroundcreate_commandupdateendso ...maybe you can be a little lost no?
but this pretty easy to understand! think of the rgss this like a domino!
who run each method in order unless you have a "IF" method but let's see that later.
so Naturally you will want to Clear you SceneManager from any kind of data and prepare you scene!
after you surely want to Freeze the graphics of your game for avoid any lags from the Scene_Map or event!
so they will come first!
but ..why background will come before command and no after?
simply ..normally you want to create your background in first! don't forget this like a domino but also like a manual...you want to read your manual correctly and not pass of the page 1 to the page 20?
Naturally all will depends of how you want your scene to appear!
I invite you people to test my theory by using "msgbox_p("method")
for see how they read it!
so now...oh! we forgot update
why if this seem a important setting...we put it in last?
the answer is simple the update method is something who update your previous method...so if you put in before the other method...what the update will do if....no one of his method is not still create??
so this why you have to put the update in last.
so now
Multiple hierachy call
def mainSceneManager.clear Graphics.freezecreate_backgroundcreate_commandupdateenddef create_backgroundcreate_first_backgroundcreate_second_backgroundendHuho!
what happen here?
we call a the create_background method but...surprise! they have two more method who are appear!
so now my create command will not work?
No No you don't have to worry! this simply rgss will run these two method before running create command!
don't forget! Domino trail is not linear you can have some extra calling separate into multiple method! this even better to have separate calling this help for make your system readable!
Breaking method hierarchy
Now you surely want to not run a method if a certain condition is not meet right? so now for doing this let's show "if" statement!
the if statement are multiple they serve for force a call or stop a call to do if the condition is not meet but I assume you know how manipulate variable so we will pass to the if statement.
def mainSceneManager.clear Graphics.freeze@variable = truecreate_backgroundcreate_commandupdateenddef create_backgroundif @variable == truecreate_first_backgroundcreate_second_backgroundendendso now as you can see if the variable will equal true..this will run the two method else..this will run nothing!
now let's check you surelly want to run something else if the method will be not meet!
so for that we use this method!
def create_backgroundif @variable == truecreate_first_backgroundcreate_second_backgroundelserun_blank_backgroundendendthe else method is here for run a second method if the first is not met!
this not magic?
ho and NEVER forget to add a extra end
for each if statement you do!
so Here the ends of my explanation I hope you loved to read this Like I said I just share my experimentation with the people!
they also exist a lot of way of coding and this one is just one of the numerous way you can code in ruby!
so Nio out's~
Here Nio back for a another discussion about rgss !
for people who begin in rgss you will maybe need to know this little information~
First I will love to say all my explanation are based on my OWN experimentation in rgss I can have false but I love to share my experimentation!
Now let's speak about
Method hierarchy
for people who don't know what is this term in rgss
this simply the order of how method are called !
I spoke with a friend who wanted to know how to show a picture before the Printf of the battle message "enemy appear"
so I thought about the method hierarchy so let's explain
Naturally rgss will run in a sort of way like a stairway and will run the first method after the second method and e.c.t
now this know how to settle the priority of wich method you want to start
because no you can't put your code way ...you will hit a crash for sure
so let's show some exemple code
def mainSceneManager.clear Graphics.freezecreate_backgroundcreate_commandupdateendso ...maybe you can be a little lost no?
but this pretty easy to understand! think of the rgss this like a domino!
who run each method in order unless you have a "IF" method but let's see that later.
so Naturally you will want to Clear you SceneManager from any kind of data and prepare you scene!
after you surely want to Freeze the graphics of your game for avoid any lags from the Scene_Map or event!
so they will come first!
but ..why background will come before command and no after?
simply ..normally you want to create your background in first! don't forget this like a domino but also like a manual...you want to read your manual correctly and not pass of the page 1 to the page 20?
Naturally all will depends of how you want your scene to appear!
I invite you people to test my theory by using "msgbox_p("method")
for see how they read it!
so now...oh! we forgot update
why if this seem a important setting...we put it in last?
the answer is simple the update method is something who update your previous method...so if you put in before the other method...what the update will do if....no one of his method is not still create??
so this why you have to put the update in last.
so now
Multiple hierachy call
def mainSceneManager.clear Graphics.freezecreate_backgroundcreate_commandupdateenddef create_backgroundcreate_first_backgroundcreate_second_backgroundendHuho!
what happen here?
we call a the create_background method but...surprise! they have two more method who are appear!
so now my create command will not work?
No No you don't have to worry! this simply rgss will run these two method before running create command!
don't forget! Domino trail is not linear you can have some extra calling separate into multiple method! this even better to have separate calling this help for make your system readable!
Breaking method hierarchy
Now you surely want to not run a method if a certain condition is not meet right? so now for doing this let's show "if" statement!
the if statement are multiple they serve for force a call or stop a call to do if the condition is not meet but I assume you know how manipulate variable so we will pass to the if statement.
def mainSceneManager.clear Graphics.freeze@variable = truecreate_backgroundcreate_commandupdateenddef create_backgroundif @variable == truecreate_first_backgroundcreate_second_backgroundendendso now as you can see if the variable will equal true..this will run the two method else..this will run nothing!
now let's check you surelly want to run something else if the method will be not meet!
so for that we use this method!
def create_backgroundif @variable == truecreate_first_backgroundcreate_second_backgroundelserun_blank_backgroundendendthe else method is here for run a second method if the first is not met!
this not magic?
ho and NEVER forget to add a extra end
for each if statement you do!
so Here the ends of my explanation I hope you loved to read this Like I said I just share my experimentation with the people!
they also exist a lot of way of coding and this one is just one of the numerous way you can code in ruby!
so Nio out's~

