Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] Where is class Window? What is self.*?

To create a window, I use Window_Base as a superclass. But there are something I don't understand. Please help me about:
class Window_Base < Window
1. Window_Base is a subclass of Window. But I can't see where class Window is?
def initialize(x, y, width, height)
super()
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
self.x = x
self.y = y
self.width = width
self.height = height
self.z = 100
end
2. What is self.* in method initialize? What is self.z?

Help me please, thank you! ^^
 

cairn

Member

class window is one of the famous hidden rmxp classes. You can find it on the help file that came along with rmxp. I just got started at looking on the hidden classes through the help file so I can't be of much more help :/.
 
Window is the hidden RGSS class that controls the look and layout of the window itself.

self is a psudo variable meaning the class itself, so self.z would be Window_Base.z or aWindow_Base.z

self.z is the window's z value, or its priority over other displayed things.
 
Yeyinde":14vgdu7m said:
Window is the hidden RGSS class that controls the look and layout of the window itself.

self is a psudo variable meaning the class itself, so self.z would be Window_Base.z or aWindow_Base.z

self.z is the window's z value, or its priority over other displayed things.

Actually, the hidden classes are programmed in C, so that they can process faster. I think they're included in the RGSS102E.dll file. Anyway, the only way to interact with the Window Class (short of actually editing it) is to use the methods given in the help file. What were you hoping to do with the class? The most common reason someone wants that class is so they can change the width of those borders in the window, which can be done with a couple of rewrites here. (Just search "Hidden Window rewrite" or something like that, I've got a thread a while back asking for it as well)
 
I am understand alot:
  1. Window is a hidden class. It may be included in RGSS102E.dll.
  2. self is a non executable code. It gives an idea to the developer for preparing the actual code. So self.z is Window_Base.z (because Window_Base is a subclass of Window) and it priority over other displayed things.
Thanks cairn, Yeyinde and Glitchfinder very much! This is resolved now! xD
 
self refers to the current instance object, in the scope where it's called.

Here you define a subclass of Window.
as Class itself is an object, by creating a new class you create a new instance of Class. Here you create a new instance of Class that inherits the methods from Window. So to access this new instance, you use self.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top