- Joined
- May 8, 2015
- Messages
- 76
- Reaction score
- 17
- First Language
- English
- Primarily Uses
- RMVXA
For a game I'm working on, I have certain menu commands (in this case the Item command) in Scene_Menu open up other command windows with their own choices (which will be referred to in the rest of my question as sub-command windows. I'm having this problem where if I go to a scene from a command on a sub-command window, the game crashes when I return to Scene_Menu with the error 'disposed window'. I have also tested the code in a seperate project with the default scripts and had the same error. Can someone please help?
Here is my source code:
Thank you.
Here is my source code:
class Window_MenuItem < Window_Command
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0)
update_placement
self.openness = 0
open
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# * Update Window Position
#--------------------------------------------------------------------------
def update_placement
self.x = (Graphics.width - width) / 2
self.y = (Graphics.height - height) / 2
end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
def make_command_list
add_command("Party",
arty)
add_command("Actor", :actor)
add_command(Vocab::cancel, :cancel)
end
end
class Scene_Menu
#--------------------------------------------------------------------------
# * Create Item Window
#--------------------------------------------------------------------------
def create_item_window
@item_window = Window_MenuItem.new
@item_window.x = 0
@item_window.y = 216
@item_window.set_handler
party, method
command_party_items))
@item_window.set_handler
actor, method
command_personal))
@item_window.set_handler
cancel, method
on_item_close))
end
#--------------------------------------------------------------------------
# * Close Item Window
#--------------------------------------------------------------------------
def close_item_window
@item_window.close
update until @item_window.close?
end
#--------------------------------------------------------------------------
# * Item Window Cancel Handling
#--------------------------------------------------------------------------
def on_item_close
@item_window.unselect
@command_window.activate
close_item_window
end
#--------------------------------------------------------------------------
# * [Item] Command On Command Window
#--------------------------------------------------------------------------
def command_item
create_item_window
end
#--------------------------------------------------------------------------
# * [Party] Command On Item Window
#--------------------------------------------------------------------------
def command_party_items
SceneManager.call(Scene_Item)
end
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0)
update_placement
self.openness = 0
open
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# * Update Window Position
#--------------------------------------------------------------------------
def update_placement
self.x = (Graphics.width - width) / 2
self.y = (Graphics.height - height) / 2
end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
def make_command_list
add_command("Party",
add_command("Actor", :actor)
add_command(Vocab::cancel, :cancel)
end
end
class Scene_Menu
#--------------------------------------------------------------------------
# * Create Item Window
#--------------------------------------------------------------------------
def create_item_window
@item_window = Window_MenuItem.new
@item_window.x = 0
@item_window.y = 216
@item_window.set_handler
@item_window.set_handler
@item_window.set_handler
end
#--------------------------------------------------------------------------
# * Close Item Window
#--------------------------------------------------------------------------
def close_item_window
@item_window.close
update until @item_window.close?
end
#--------------------------------------------------------------------------
# * Item Window Cancel Handling
#--------------------------------------------------------------------------
def on_item_close
@item_window.unselect
@command_window.activate
close_item_window
end
#--------------------------------------------------------------------------
# * [Item] Command On Command Window
#--------------------------------------------------------------------------
def command_item
create_item_window
end
#--------------------------------------------------------------------------
# * [Party] Command On Item Window
#--------------------------------------------------------------------------
def command_party_items
SceneManager.call(Scene_Item)
end
end
Thank you.

