09-10-2017, 03:36 AM
(This post was last modified: 09-10-2017, 03:40 AM by DerVVulfman.)

Oh, you can TOTALLY screw things up with substitution... if you accidentally erase one thing with another by accident. But on the subject of substitution, let me break Kyo's first example.
@substituted_player = Player.new
Here, we have a variable called @substituted_player.
In it, we tell it that it is equal to our Player class. While nor ahown specifically, let's just assume it is like having the RPGMaker XP class "Game_Player", okay? When we 'start up' that class, we run it like "Game_Player.new", so here we make THIS class run as "Player.new".
So here, we make @substituted_player become a new 'copy' of the Player class.
@substituted_player.name = "Stan"
FIRST... let's assume that the 'Player' class we made has a property (a value it can read/write) called 'name'.
This is basically telling the @substituted_player (copy of Player) that its name property is now 'Stan'.
It wouldn't work if the Player class doesn't have a name property to change. But for a point of argument, we're assuming that the Player class DOES have a name property. I explain properties a little below.
print "#{@substituted_player.name}, the kind of old hockey player, steps out right now and gets a seat in no time."
This statement is printing out...
=> "Stan, the kind of old hockey player, steps out right now and gets a seat in no time."
Here, we see the odd bit of code... #(@substituted_player.name)
When the program reaches the #( ..blahblahblah.. ) bit of code, it becomes replaced with the name stored within @substituted_player.name ... aka Stan.

Golf Rugby on ICE? ROFL!!! I LOVE IT!!!

Now you heard me say (or read me type?) the word 'property' when I referred to the Player class in the example above. It's a bit of tech jargon.
Most Classes are made from a whole bunch of methods. But classes (like the Game_Player, Game_Character, etc) that deal with data have a whole lotta properties... or info that can be READ.
For example, you have in the Game_Actor class, a bunch of values near the top of the script, and a whole lotta methods.
When there is some bit of data that you can read from a class, it is a property. For example, the Game_Actor class (which defines an individual actor or game hero) has a character's ID, an index, their name, and so on. Some of this can be changed easier than others. Some not so much.
Just a primer to prep you, knowing the learning curve you're struggling with ... I'm not being specific or anything.