Disposed Window Error?

Hey Guys I just finished making a game using rpg maker xp but i have a few question..

Before i ask a few questions,i would like to introduce my game, The game is called animalrescue which the player needs to rescue the animals by answering a few quiz.. When each quiz is answered coorrect, the player may move to the second question and each correct quiz ansered, the player receive scoring points and the score windows is shown at the map... The game was able to dispose the window after the game finished and not shown in the scene title. But i have a problem which is that after completing the game it will return to the title screen but after i start a new game as soon as i finish the 1st game, an error

occured

error.png this is the pprobblem that i countered

Code script for scoring:

=begin╔══════════════════════════════════════════════════════════════════════════════╗║ Ratty's scoreboard v.2 ║║ By Punk ║║ 10/05/08 ║╟──────────────────────────────────────────────────────────────────────────────╢║ - To display the window, type $pk_rsbw = Window_PK_RattySB.new in a script ║║ call. ║║ - To dispose the window, type $pk_rsbw.dispose in a new script call. ║║ - You're not going to use the default menu system right? Meep! ║╚══════════════════════════════════════════════════════════════════════════════╝=end#-- Start Customization --PK_RSBW_WX = 390 # X PositionPK_RSBW_WY = 0 # Y PositionPK_RSBW_WWIDTH = 250 # WidthPK_RSBW_WHEIGHT = 60 # HeightPK_RSBW_SCORENAME = "SCORE" # Score NamePK_RSBW_SCOREID = 3 # Score Game Variable IDPK_RSBW_SCORENAMEFONT = ["Arial", "Tahoma"] # Score Name FontsPK_RSBW_SCORENAMEFONTSIZE = 22 # Score Name Font SizePK_RSBW_SCORENAMEBOLD = true # Score Name Bold Flag?PK_RSBW_SCORENAMEITALICS = false # Score Name Italics Flag?PK_RSBW_SCORENAMECR = 255 # Score Name Color Amount of Red?PK_RSBW_SCORENAMECG = 255 # Score Name Color Amount of Green?PK_RSBW_SCORENAMECB = 150 # Score Name Color Amount of Blue?PK_RSBW_SCORENAMECO = 255 # Score Name Opacity?PK_RSBW_SCOREIDFONT = ["Arial", "Tahoma"] # Score ID FontsPK_RSBW_SCOREIDFONTSIZE = 22 # Score ID Font SizePK_RSBW_SCOREIDBOLD = true # Score ID Bold Flag?PK_RSBW_SCOREIDITALICS = false # Score Name Italics Flag?PK_RSBW_SCOREIDCR = 255 # Score ID Color Amount of Red?PK_RSBW_SCOREIDCG = 255 # Score ID Color Amount of Green?PK_RSBW_SCOREIDCB = 255 # Score ID Color Amount of Blue?PK_RSBW_SCOREIDCO = 255 # Score ID Opacity?PK_RSBW_WOPACITY = 255 # Window Opacity#-- End Customization --class Window_PK_RattySB < Window_Base def initialize super(PK_RSBW_WX, PK_RSBW_WY, PK_RSBW_WWIDTH, PK_RSBW_WHEIGHT) self.contents = Bitmap.new(width - 32, height - 32) @pk_rsbw_wsname = $game_system.windowskin_name self.windowskin = RPG::Cache.windowskin(@pk_rsbw_wsname) self.visible = true self.opacity = PK_RSBW_WOPACITY refresh end def update if $game_variables[PK_RSBW_SCOREID] != @pk_rsbw_scoretempval refresh end end def refresh self.contents.clear self.contents.font.name = PK_RSBW_SCORENAMEFONT self.contents.font.size = PK_RSBW_SCORENAMEFONTSIZE self.contents.font.bold = PK_RSBW_SCORENAMEBOLD self.contents.font.italic = PK_RSBW_SCORENAMEITALICS self.contents.font.color = Color.new(PK_RSBW_SCORENAMECR, PK_RSBW_SCORENAMECG, PK_RSBW_SCORENAMECB, PK_RSBW_SCORENAMECO) self.contents.draw_text(0, 32 * 0, PK_RSBW_WWIDTH, 32, PK_RSBW_SCORENAME + ": ") self.contents.font.name = PK_RSBW_SCOREIDFONT self.contents.font.size = PK_RSBW_SCOREIDFONTSIZE self.contents.font.bold = PK_RSBW_SCOREIDBOLD self.contents.font.italic = PK_RSBW_SCOREIDITALICS self.contents.font.color = Color.new(PK_RSBW_SCOREIDCR, PK_RSBW_SCOREIDCG, PK_RSBW_SCOREIDCB, PK_RSBW_SCOREIDCO) self.contents.draw_text(PK_RSBW_SCORENAME.length * 25, 32 * 0, PK_RSBW_WWIDTH, 32, $game_variables[PK_RSBW_SCOREID].to_s) @pk_rsbw_scoretempval = $game_variables[PK_RSBW_SCOREID] end def dispose if self.contents != nil self.contents.dispose end super endendclass Scene_Map alias pk_rsbw_update :update def update pk_rsbw_update if $pk_rsbw == nil else $pk_rsbw.update end end endabove is the code for displaying score window in the game and on the line 62 where the error occured which is self.contents.clear

line 62

line 62.png

(By the way my friend gave the script to mee for the scoring section so i dont know about the script either.. it is not mine..)

Can anyone help me??
can anyone help me? 🙁
nikzaim, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

You need to be a little patient.  Don't forget that with differing time zones, people will be on different work/leisure/sleep patterns and people who answer queries here do so in their free time and have other commitments as well.  The 72 hour buffer is there for a reason.
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


Where is the window created? You've got Game_Map updating the window, but if the window doesn't exist because you haven't created it, then there's going to be an issue when you try to update/refresh it.
sry im newbie about scripting... i dont understand about "Where is the window created?"
You must have


$pk_rsbw = Window_PK_RattySB.new


somewhere in your code? (creating it as a global variable is not a good idea either - if you use it from Scene_Map, create it, dispose of it and update it in the same way as other windows used from Scene_Map.


Disposing of a window may not make it nil.
oh i put in in a common event call showscore which is in the level 1

window.png

window2.png
Yeah, that's just not a good way to go about it.

If you want a new window on the map, put it ALL in Scene_Map, and follow its example with the other windows.
Okay ive done that but i have another problem... whenever i start a new game, immediately the game will only show the score hud script and does nothing, the game is black screen for some reason.

here is the scene_map code that i just change

#==============================================================================# ** Scene_Map#------------------------------------------------------------------------------# This class performs map screen processing.#==============================================================================PK_RSBW_WX = 390 # X PositionPK_RSBW_WY = 0 # Y PositionPK_RSBW_WWIDTH = 250 # WidthPK_RSBW_WHEIGHT = 60 # HeightPK_RSBW_SCORENAME = "SCORE" # Score NamePK_RSBW_SCOREID = 3 # Score Game Variable IDPK_RSBW_SCORENAMEFONT = ["Arial", "Tahoma"] # Score Name FontsPK_RSBW_SCORENAMEFONTSIZE = 22 # Score Name Font SizePK_RSBW_SCORENAMEBOLD = true # Score Name Bold Flag?PK_RSBW_SCORENAMEITALICS = false # Score Name Italics Flag?PK_RSBW_SCORENAMECR = 255 # Score Name Color Amount of Red?PK_RSBW_SCORENAMECG = 255 # Score Name Color Amount of Green?PK_RSBW_SCORENAMECB = 150 # Score Name Color Amount of Blue?PK_RSBW_SCORENAMECO = 255 # Score Name Opacity?PK_RSBW_SCOREIDFONT = ["Arial", "Tahoma"] # Score ID FontsPK_RSBW_SCOREIDFONTSIZE = 22 # Score ID Font SizePK_RSBW_SCOREIDBOLD = true # Score ID Bold Flag?PK_RSBW_SCOREIDITALICS = false # Score Name Italics Flag?PK_RSBW_SCOREIDCR = 255 # Score ID Color Amount of Red?PK_RSBW_SCOREIDCG = 255 # Score ID Color Amount of Green?PK_RSBW_SCOREIDCB = 255 # Score ID Color Amount of Blue?PK_RSBW_SCOREIDCO = 255 # Score ID Opacity?PK_RSBW_WOPACITY = 255 # Window Opacityclass Scene_Map < Window_Base #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Make sprite set @spriteset = Spriteset_Map.new # Make message window @message_window = Window_Message.new # Transition run Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of sprite set @spriteset.dispose # Dispose of message window @message_window.dispose # If switching to title screen if $scene.is_a?(Scene_Title) # Fade out screen Graphics.transition Graphics.freeze end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Loop loop do # Update map, interpreter, and player order # (this update order is important for when conditions are fulfilled # to run any event, and the player isn't provided the opportunity to # move in an instant) $game_map.update $game_system.map_interpreter.update $game_player.update # Update system (timer), screen $game_system.update $game_screen.update # Abort loop if player isn't place moving unless $game_temp.player_transferring break end # Run place move transfer_player # Abort loop if transition processing if $game_temp.transition_processing break end end # Update sprite set @spriteset.update # Update message window @message_window.update # If game over if $game_temp.gameover # Switch to game over screen $scene = Scene_Gameover.new return end # If returning to title screen if $game_temp.to_title # Change to title screen $scene = Scene_Title.new return end # If transition processing if $game_temp.transition_processing # Clear transition processing flag $game_temp.transition_processing = false # Execute transition if $game_temp.transition_name == "" Graphics.transition(20) else Graphics.transition(40, "Graphics/Transitions/" + $game_temp.transition_name) end end # If showing message window if $game_temp.message_window_showing return end # If encounter list isn't empty, and encounter count is 0 if $game_player.encounter_count == 0 and $game_map.encounter_list != [] # If event is running or encounter is not forbidden unless $game_system.map_interpreter.running? or $game_system.encounter_disabled # Confirm troop n = rand($game_map.encounter_list.size) troop_id = $game_map.encounter_list[n] # If troop is valid if $data_troops[troop_id] != nil # Set battle calling flag $game_temp.battle_calling = true $game_temp.battle_troop_id = troop_id $game_temp.battle_can_escape = true $game_temp.battle_can_lose = false $game_temp.battle_proc = nil end end end # If B button was pressed if Input.trigger?(Input:: # If event is running, or menu is not forbidden unless $game_system.map_interpreter.running? or $game_system.menu_disabled # Set menu calling flag or beep flag $game_temp.menu_calling = true $game_temp.menu_beep = true end end # If debug mode is ON and F9 key was pressed if $DEBUG and Input.press?(Input::F9) # Set debug calling flag $game_temp.debug_calling = true end # If player is not moving unless $game_player.moving? # Run calling of each screen if $game_temp.battle_calling call_battle elsif $game_temp.shop_calling call_shop elsif $game_temp.name_calling call_name elsif $game_temp.menu_calling call_menu elsif $game_temp.save_calling call_save elsif $game_temp.debug_calling call_debug end end end #-------------------------------------------------------------------------- # * Battle Call #-------------------------------------------------------------------------- def call_battle # Clear battle calling flag $game_temp.battle_calling = false # Clear menu calling flag $game_temp.menu_calling = false $game_temp.menu_beep = false # Make encounter count $game_player.make_encounter_count # Memorize map BGM and stop BGM $game_temp.map_bgm = $game_system.playing_bgm $game_system.bgm_stop # Play battle start SE $game_system.se_play($data_system.battle_start_se) # Play battle BGM $game_system.bgm_play($game_system.battle_bgm) # Straighten player position $game_player.straighten # Switch to battle screen $scene = Scene_Battle.new end #-------------------------------------------------------------------------- # * Shop Call #-------------------------------------------------------------------------- def call_shop # Clear shop call flag $game_temp.shop_calling = false # Straighten player position $game_player.straighten # Switch to shop screen $scene = Scene_Shop.new end #-------------------------------------------------------------------------- # * Name Input Call #-------------------------------------------------------------------------- def call_name # Clear name input call flag $game_temp.name_calling = false # Straighten player position $game_player.straighten # Switch to name input screen $scene = Scene_Name.new end #-------------------------------------------------------------------------- # * Menu Call #-------------------------------------------------------------------------- def call_menu # Clear menu call flag $game_temp.menu_calling = false # If menu beep flag is set if $game_temp.menu_beep # Play decision SE $game_system.se_play($data_system.decision_se) # Clear menu beep flag $game_temp.menu_beep = false end # Straighten player position $game_player.straighten # Switch to menu screen $scene = Scene_Menu.new end #-------------------------------------------------------------------------- # * Save Call #-------------------------------------------------------------------------- def call_save # Straighten player position $game_player.straighten # Switch to save screen $scene = Scene_Save.new end #-------------------------------------------------------------------------- # * Debug Call #-------------------------------------------------------------------------- def call_debug # Clear debug call flag $game_temp.debug_calling = false # Play decision SE $game_system.se_play($data_system.decision_se) # Straighten player position $game_player.straighten # Switch to debug screen $scene = Scene_Debug.new end #-------------------------------------------------------------------------- # * Player Place Move #-------------------------------------------------------------------------- def transfer_player # Clear player place move call flag $game_temp.player_transferring = false # If move destination is different than current map if $game_map.map_id != $game_temp.player_new_map_id # Set up a new map $game_map.setup($game_temp.player_new_map_id) end # Set up player position $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y) # Set player direction case $game_temp.player_new_direction when 2 # down $game_player.turn_down when 4 # left $game_player.turn_left when 6 # right $game_player.turn_right when 8 # up $game_player.turn_up end # Straighten player position $game_player.straighten # Update map (run parallel process event) $game_map.update # Remake sprite set @spriteset.dispose @spriteset = Spriteset_Map.new # If processing transition if $game_temp.transition_processing # Clear transition processing flag $game_temp.transition_processing = false # Execute transition Graphics.transition(20) end # Run automatic change for BGM and BGS set on the map $game_map.autoplay # Frame reset Graphics.frame_reset # Update input information Input.update endalias pk_rsbw_update :update def update pk_rsbw_update if $pk_rsbw == nil else $pk_rsbw.update end enddef initialize super(PK_RSBW_WX, PK_RSBW_WY, PK_RSBW_WWIDTH, PK_RSBW_WHEIGHT) self.contents = Bitmap.new(width - 32, height - 32) @pk_rsbw_wsname = $game_system.windowskin_name self.windowskin = RPG::Cache.windowskin(@pk_rsbw_wsname) self.visible = true self.opacity = PK_RSBW_WOPACITY refresh end def update if $game_variables[PK_RSBW_SCOREID] != @pk_rsbw_scoretempval refresh end end def refresh self.contents.clear self.contents.font.name = PK_RSBW_SCORENAMEFONT self.contents.font.size = PK_RSBW_SCORENAMEFONTSIZE self.contents.font.bold = PK_RSBW_SCORENAMEBOLD self.contents.font.italic = PK_RSBW_SCORENAMEITALICS self.contents.font.color = Color.new(PK_RSBW_SCORENAMECR, PK_RSBW_SCORENAMECG, PK_RSBW_SCORENAMECB, PK_RSBW_SCORENAMECO) self.contents.draw_text(0, 32 * 0, PK_RSBW_WWIDTH, 32, PK_RSBW_SCORENAME + ": ") self.contents.font.name = PK_RSBW_SCOREIDFONT self.contents.font.size = PK_RSBW_SCOREIDFONTSIZE self.contents.font.bold = PK_RSBW_SCOREIDBOLD self.contents.font.italic = PK_RSBW_SCOREIDITALICS self.contents.font.color = Color.new(PK_RSBW_SCOREIDCR, PK_RSBW_SCOREIDCG, PK_RSBW_SCOREIDCB, PK_RSBW_SCOREIDCO) self.contents.draw_text(PK_RSBW_SCORENAME.length * 25, 32 * 0, PK_RSBW_WWIDTH, 32, $game_variables[PK_RSBW_SCOREID].to_s) @pk_rsbw_scoretempval = $game_variables[PK_RSBW_SCOREID] end def dispose if self.contents != nil self.contents.dispose end super end endlalal.pnggame picture

OTHER OPTIONS

if i remove class Scene_Map < Window_Base to Scene_Map only, i got an error

opopo.png

line 325line 325.png
i have play with the coding in the scene_map and it seems that i am unabe to show the score hud script.. it is impossible..
nikzaim, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

Just because you are having trouble, doesn't mean it's impossible. It just means there's something you're not doing right.

Be more patient, and wait for someone to come along and help you.
The basic way of creating and maintaining windows is thus:

In your scene, in this case scene_map,

Before Graphics.transition

@my_window = Window_MyWindow.new

After @sprite_set.update

@my_window.update

After Graphics.freeze

@my_window.dispose

Then go into a new script.

This script should look something like so:

class Window_MyWindow   def initialize    #stuff goes here  end   def update    refresh  end def refresh # do stuff end endSo when Scene_Map uses the line "@my_window = Window_MyWindow.new" it creates a new instance of that window.

Scene_Map calls the window, but doesn't contain it, if that makes sense.
Thank You So much... I have to say i Am really thankfull for those who have helped me and take your time to answer every single one. Please keep up that good work because without you guys I would be lost. For the moment it seems to be running fine without any problem..

I'll let you guys know if there's a problem, But at the moment it seems pretty fine. 😀 😀 😀

I still have a few questions...

1. how do i make the window remove at the game over screen?

2. How do i make the window appear after my intro is it possible? i dont want it to show immediately after i hitting a new game.. after transferring my player into level 1(in a new map), i want the window show there is it possible?
Use a switch to indicate whether it's visible or not.  Turn on the switch when you want it to be visible.  Switches are off at the start of the game by default.  

Then in the update method of your window class, add this line:

self.visible = $game_switches[5]changing 5 to be whatever switch number you intend to use (no leading zeros).
Use a switch to indicate whether it's visible or not.  Turn on the switch when you want it to be visible.  Switches are off at the start of the game by default.  

Then in the update method of your window class, add this line:

self.visible = $game_switches[5]changing 5 to be whatever switch number you intend to use (no leading zeros).
I did what you told me what to do but it still not working.. however  i found out something very similar to my situation and the coding use is :

@my_window.visible = $game_switches[9]I need to put the coding in the Scene_Map in the def update section. Now i am able to make the window display on and off using switches!!

THANKS Shaz And Amy Pond for helping me!!
Yep, that would work too.

Maybe instead of self.visible, just @visible might have worked.
hello sorry for bringing back an old thread, i still have the same problem when the scene for gameover appears the game crash and it says the same problem like dispose window error...

Can any1 help me again xx 😛

error 69.png

codings.png
(Bump)

Anyone Can Help me? 🙁

Original thread: https://forums.rpgmakerweb.com/threads/disposed-window-error.44938/