I'm trying to work with a window script (< Window_Base) that uses Game_Actor stuff like @data, @actor, and @equip, and Scene_Equip.
Can somebody give me a breakdown of how these all relate and link with each other? I know Scene_Equip deals with opening/activating/show/hide/.new/handlers, Game_Actor is all code-data-related (doesn't have a physical form) and the Window is where things are drawn (text, icon, gauges, etc.)
One way to get around with it (in Ruby) is knowing that there are certain global variables always available, like $game_actors and $game_party.members, both being arrays of all actors in the game. $game_party.members for example is an array of all actors inside your active party.
For other things, you can use an argument to pass a certain variable, let's see an example:
# Window This is a window class that receives a help window after being created.# The responsible of giving the reference to the actual help window instance (the object created while running) will be the scene.class Window_This < Window_Base def initialize(help_window) #this window receives a help window as an argument @help_window = help_window #here we save the variable as a class variable so we can access it later super(0,320,320,64) #some random values for x,y,w,h refresh end def refresh contents.clear draw_text_ex(4, 0, "Text") #this is an example of getting information from a known global variable @help_window.set_text($game_party.leader.name) endendclass Scene_Random < Scene_Base def start #we then create a help window instance @help_window = Window_Help.new #and throw it into this window's face! She knows what to do with it. @this_window = Window_This.new(@help_window) end def update_basic super print "asdf" if Input.trigger?🙂A) endendI hope this helps to illustrate,
Orochii Zouveleki
This was a pretty good illustration, I understand now more of the base structure. Hopefully this will help me accomplish what i'm trying to do.
If anyone else wants to expand, feel free to.
However I have a new concern. Let's say a window script has a method like "def equip=(equip)" How exactly do these kinds of methods work/are called? Some other various methods follow this suit as well but using shift+ctrl+f doesn't help find their origins/applications/callings. I'm guessing it has no arguments and is meant to return what's in the parenthesis?
It defines a setter (a method that sets a certain "property" or class variable). A method by a name of "equip=" for example is used in this way:
@something.equip = variableStill, nothing forces you to not use instead
@something.equip=(variable)Which is the way at which you call normally methods. Method name and arguments between parenthesis.
And as a trivia, attr_accessor, attr_writer, attr_reader are methods that pretty much "generate" these extra methods.
# attr_accessor creates a setter and a getter# attr_reader creates a getter# attr_writer creates a setter #Example:attr_accessor :thing#creates a getter and a setter for @thing #This is how the getter would look like in actual codedef thing return @thingend #And this how the setter would look likedef thing=(n) @thing = nend
I, again (?), hope this illustrates,
Orochii Zouveleki
OH! That certainly explains a lot!
Oh, another question. Let's say I have notetags on skills, stored in REGEXP, that are used within Game_Actor to do stuff. Let's say I want to make a window to display the information on these skills for the current actor-in-question that will be initialized and some refreshes when needed. Should I make the window as (superclass I think) "< Window_Base" or "<Window_Selectable"?
Use Window_Selectable if you want an interactive window
And Use Window_Base if you just want to display an information