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.

Getting an error

I'm getting an error on window base whenever I try to open the menu. Any idea why? It says the error had something to do with dispose.

Code:
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    # Dispose if window contents bit map is set
    if self.contents != nil
      self.contents.dispose
    end
    super
  end
 

Anonymous

Guest

Did it say disposed window by any chance? If it did, then it means that you called dispose on a window that was already disposed.
 
I don't see "def desposed?" anywhere, but here is the exact error

Code:
Script "Window_Base" line 30: RGSSError occured

disposed window


Line 30 is this
Code:
   if self.contents != nil

----
EDIT
----

I removed a script, and the error stopped occuring. How can I make this script not give me the error?

Code:
 #Widescreen Window
#By: Takneo 31 / 1 / 2007

#This is my first script, so don't make fun of it!
#************************************************* ******

=begin
*Instruction
Paste above Main.
when you want to call the screen, use a new event with "Call Script" and write:
$scene.widescreen1.visible = true
$scene.widescreen2.visible = true

when you want the widescreen to turn off, do the same, but instead of using "true" use "false"
=end

#*******************************************
# Special Thanks to vgvgf from rmxp.org for helping me with my troubles!
#*******************************************

class Widescreen_Window1 < Window_Base
def initialize
super(0, 0, 640, 35)
self.contents = Bitmap.new(width-32, height-32)
self.windowskin = RPG::Cache.windowskin("Widescreen.png")
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
end
end

class Widescreen_Window2 < Window_Base
def initialize
super(0, 445, 640, 35)
self.contents = Bitmap.new(width-32, height-32)
self.windowskin = RPG::Cache.windowskin("Widescreen.png")
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
end
end

class Scene_Map
attr_accessor :widescreen1
attr_accessor :widescreen2
alias scene_map_main main
def main
@widescreen1 = Widescreen_Window1.new
@widescreen2 = Widescreen_Window2.new
@widescreen1.visible = false
@widescreen2.visible = false
scene_map_main
@widescreen1.dispose
@widescreen2.dispose
end
end
 

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