Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 RGSS scripting dissections and explinations
#65
(11-10-2018, 05:07 AM)DerVVulfman Wrote: Did we talk about Inheritance before?  (checking....)  Oh, wow!  I did, at the beginning of Page 2!  Lemme recap:

The Recap

Did you read that again?  Yes?  Goodie!   Cause I'm going to start using SOME terms here.  You do have to learn them too, right?

When I said.....

Quote:Go and look at the 'Window_Selectable' class in your editor, and you may see this:
class Window_Selectable < Window_Base

Looks odd, no?   The '< Window_Base' thingie says 'WE CHEATED!!!'   We just made a whole class called Window_Selectable, and we're re-using material from Window_Base without needing to retype it!!!

Now I will talk about some terms:  The Parent Class and the Child class.    They probably came up with those names when they also decided to call this thingie 'Inheritance'  Tongue sticking out

When I said that the Window_Selectable class is reusing material from Window_Base, it is 'inheriting' the material....   Just as a baby inherits its eyes from its mother.  The Windows_Selectable class is what we call a Child class, and the Window_Base class is its parent.  But just the same, the hidden Windows class is a parent class to the Windows_Base class... with Window Base being the child class.

Yeah, so whenever you have one class based on another, that new class is a child of the older parent.

So what the heck is a SUPERCLASS?????

Wait?  Where did that come from?  Krypton?

Nope.   It's sorta just another way to refer to a Parent class.  If you look at some of the default scripts like Game_Battler, they refer to themselves as being Superior to the other...  a superclass:


Code:
#==============================================================================
# ** Game_Battler (part 1)
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass for the Game_Actor
#  and Game_Enemy classes.
#==============================================================================

class Game_Battler

Of course, you'll see that the Child classes have that goofy < Game_Battler after the class's name is defined:

Code:
class Game_Actor < Game_Battler

So saying that the Game_Battler class is a Parent class to the Game_Actor class, you could also say that the Game_Battler class is a superclass to the Game_Actor class.  

Got it so far??????  Happy
soo essentially its like a tree...inheritance is similar to a tree...starting at one point and then using the initial script as a building block to continue without having to constantly rebuild the same thing over and over....like a tree...the hidden "Window" class is the roots with "Window_Base" as the trunk "Window_Selectable" as branches and anything else that uses the scripts pertaining to the usage of windows becomes its leaves and "Pacman" < is a way of showing that its using the previously established script as a base to work from so its not as much too type
am I getting that right? because your explanation made oodles of sense if I got that right! Grinning
[Image: SP1-Writer.png]
[Image: 55e3faa432d9efb86b8f19a6f25c0126-dawz35x.png]

new logo for Yesteryear created by Lunarberry!
Reply }


Messages In This Thread
RE: RGSS scripting dissections and explinations - by Siletrea - 11-10-2018, 05:32 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Help iwth script (RGSS Player crash) Whisper 3 7,673 06-17-2017, 05:03 PM
Last Post: Whisper
  How can I use the cmd of "require" in rgss superegp 2 5,380 11-03-2015, 06:16 AM
Last Post: kyonides
   Scripting in VX vs VX Ace Miharu 5 8,205 02-21-2015, 10:10 AM
Last Post: Taylor
   Combat animations via scripting; How? ZeroSum 2 4,571 09-20-2013, 06:58 PM
Last Post: ZeroSum
Question  RGSS stoped to work Chaos17 5 6,929 02-14-2013, 05:13 PM
Last Post: DerVVulfman
   Ruby, RGSS & General Code Discussion Kain Nobel 6 9,912 12-22-2012, 05:11 AM
Last Post: MechanicalPen
   [Request] Tut. for RGSS Eldur 9 10,610 12-07-2012, 04:27 AM
Last Post: DerVVulfman
   [ASK-RGSS] Behemoth's CBS alike Getsuga_kawaii 0 3,863 04-29-2010, 03:07 PM
Last Post: Getsuga_kawaii
   Scripting I think spazfire 7 8,981 04-12-2010, 03:21 AM
Last Post: DerVVulfman
   Beginner Scripting Tuts? KDawg08 1 3,684 03-31-2010, 11:03 PM
Last Post: Hsia_Nu



Users browsing this thread: