The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Gando on February 22, 2008, 05:45:49 PM

Title: Remove window?
Post by: Gando on February 22, 2008, 05:45:49 PM
Hi,

i'm very new to scripting and i reccently made my first window. Here is the script:


class Window_First < Window_Base
  #------------------------------------------------#
  # Object Initialization                                         #               
  #------------------------------------------------#
  def initialize
    super(0, 0, 256, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
   
    refresh
  end
 
  #------------------------------------------------#
  # Refresh                                                        #
  #------------------------------------------------#
  def refresh
    self.contents.clear

    self.contents.draw_text(0, 0, 256, 32, "Hello, World", 1)
end
end



And my question is, how can you make it so when the person playing the game can remove the window by pressing a button, lets say C?  I belive it has something to do with $window.dispose but i can't quite figure it out >.<
Thx.

//Gando
Title: Re: Remove window?
Post by: modern algebra on February 22, 2008, 09:23:15 PM
So, this window is not in a scene? Well, yeah, if you set the window to the global variable $window_first (or whatever name) then you could make an event which looks like this:


Conditional Branch:  Button C is being pressed
  Script: $window_first.dispose
Branch End


If you didn't want to dispose the window, $window_first.visible = false would work as well.