09-10-2017, 02:58 AM
I hate to highlight stuff on my phone -_-
Err, they wield an L shaped stick that they use to hit a black disk... yeah, it's a cold place with an icy floor...
Substitute = Replace = Exchange was just a way to tell you that they are synonyms or words with similar meanings, not actual classes or modules.
THERE IS NO SPECIFIC CLASS for substitutions, mainly because strings or those arrays of many characters set in a row and surrounded by quotes, either ' ' or " " are able to let you substitute some of its characters. We have showed you two ways to substitute characters, but there are two additional methods that may replace any character, but they may also use regex or regexp or regular expressions. You should not use regular expressions if you havent fully understand expression substitutions. Expressions are either idioms or words or weird characters like %s (a percent symbol and some s character), you place them inside strings when they may have changing values.
Lets say that you change Pod Pod's name during gameplay to Evil Pod Pod, let's supposed a chip malfunctions and she becomes quite evil.
class Window_ActorName < Window_Base
def initialize(x, y, 160, 64)
super
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.draw_text(0, 0, width - 32, 32, $game_party.actors[0].name, 1)
end
end
There we defined a new window with some unknown x and y coordinates, 160 as its width and 64 as its height.
super is a pseudo variable, it helps you call our window's parent class, Window_Base. Our window passed x, y, width and height to Window_Base because it is mandatory, you would get an error otherwise. Since super was left inside the initialize method, it called Window_Base initialize method to set our window's x and y coordinates, its width and its height. Even if you cannot read it here, it also set the windowskin, that ugly blue box with a thin white border.
self.contents is a Bitmap, remember its a class that handles text and drawings of any color. draw_text prints our labels or texts for us on screen inside that horrible blue box. Its first parameter is x, followed by y, a custom width, a custom height, our text and optionally 0 1 or 2 as a way to tell it to print our text aligned to the left hand side, centered or to the right hand side respectively.
What's our text here? $game_party.actors[0].name
$game_party equals a copy of Game_Party class where you can find an array named @actors. There it stored your game's heroes including Pod Pod or Evil Pod Pod XD
$game_party.actors[0] equals your first hero in the array. If she's Pod Pod then its name on screen will be Pod Pod.
Err, they wield an L shaped stick that they use to hit a black disk... yeah, it's a cold place with an icy floor...
Substitute = Replace = Exchange was just a way to tell you that they are synonyms or words with similar meanings, not actual classes or modules.
THERE IS NO SPECIFIC CLASS for substitutions, mainly because strings or those arrays of many characters set in a row and surrounded by quotes, either ' ' or " " are able to let you substitute some of its characters. We have showed you two ways to substitute characters, but there are two additional methods that may replace any character, but they may also use regex or regexp or regular expressions. You should not use regular expressions if you havent fully understand expression substitutions. Expressions are either idioms or words or weird characters like %s (a percent symbol and some s character), you place them inside strings when they may have changing values.
Lets say that you change Pod Pod's name during gameplay to Evil Pod Pod, let's supposed a chip malfunctions and she becomes quite evil.
class Window_ActorName < Window_Base
def initialize(x, y, 160, 64)
super
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.draw_text(0, 0, width - 32, 32, $game_party.actors[0].name, 1)
end
end
There we defined a new window with some unknown x and y coordinates, 160 as its width and 64 as its height.
super is a pseudo variable, it helps you call our window's parent class, Window_Base. Our window passed x, y, width and height to Window_Base because it is mandatory, you would get an error otherwise. Since super was left inside the initialize method, it called Window_Base initialize method to set our window's x and y coordinates, its width and its height. Even if you cannot read it here, it also set the windowskin, that ugly blue box with a thin white border.
self.contents is a Bitmap, remember its a class that handles text and drawings of any color. draw_text prints our labels or texts for us on screen inside that horrible blue box. Its first parameter is x, followed by y, a custom width, a custom height, our text and optionally 0 1 or 2 as a way to tell it to print our text aligned to the left hand side, centered or to the right hand side respectively.
What's our text here? $game_party.actors[0].name
$game_party equals a copy of Game_Party class where you can find an array named @actors. There it stored your game's heroes including Pod Pod or Evil Pod Pod XD
$game_party.actors[0] equals your first hero in the array. If she's Pod Pod then its name on screen will be Pod Pod.