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.

A little help -- disposed window

Aran

Member

Here's a small script I made, but I get an error for 'dispose window'

Code:
#==============================================================================
# ** Time Display
#==============================================================================
# Aran
# Version 1.0
# 03.07.06
#==============================================================================
#Via the Advanced Time System (Required) you can display the time on your screen
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log("Time Display", "Aran", 1, "03.07.06")

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state("Time Display") == true
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# * Time HUD
#------------------------------------------------------------------------------
  class Window_Time < Window_Base
    def initialize
      super(width - 640, 430, self.contents.width, 50)
      self.contents = Bitmap.new(width - 32, height - 32)
      self.opacity = 0
      self.contents.font.name = "Goudy Old Style"
      refresh
    end
    
    def refresh
      self.contents.clear
      draw_text(4,4,160,28,"Time:" + $ats.clock)
    end
    
    def update
      refresh
    end
  end
  
#==============================================================================
# * Scene Map
#------------------------------------------------------------------------------  
  class Scene_Map
    
#------------------------------------------------------------------------------
# * Alias Listings
#------------------------------------------------------------------------------
    alias aran_time_disp_scn_map_main main
    alias aran_time_disp_scn_map_update update
#------------------------------------------------------------------------------    
    
    def main
      @win_time = Window_Time.new
      aran_time_disp_scn_map_main
    end
    
    def update
      @win_time.update
      if $scene != self
        @win_time.dispose
      end
            aran_time_disp_scn_map_update
    end
  end
  
#------------------------------------------------------------------------------
# * End SDK Test
#------------------------------------------------------------------------------
end
 
No need for more bumps! xD

Well, the answer is simple but strange... Somehow your script runs the lines below the main loop twice, and since you don´t have any protection for the "double-called dispose" error, it goes mad. I only added some letters after the dispose line. Here is the new main method for Scene_Map on your Time Window script:

Code:
    def main
      @win_time = Window_Time.new
      aran_time_disp_scn_map_main
      @win_time.dispose if !@win_time.disposed?
    end

Just that. I think that solves your problem.
 

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