Hey guys, pretty sure I'm either blind, stupid or both.
I've been perusing Trihan's AMAZING tutorials on ruby. Let me just say they awesome by the way. Much learning, such code. They got me experimenting with Scenes and Windows trying to come up with things I could do. Anyways, I have hit a brick wall with this code I made:
Everything seems fine with this, as far as I can tell, and I can even get the scene to switch and window to appear as expected, but that is where things get weird. As soon as the code hits the constructor for the window I am greeted by that evil ping noise and a invitation back to the script editor, which points at my new window's "super" or w/e other line I put there, that is signed off by some mysterious stranger named "disposed window".
I would like to meet this "disposed window" scoundrel in person and give them a piece of my mind, but I'm honestly not sure where they call home? Looking through the code I can trace the problem back to the Scene_Base where I find some interesting things:
If I am reading this right, the Scene_Base does:
1 & 2. some start up procedures okay cool
3. waits for the scene to transition to the new one sounds good
4. Runs a pre_terminate method (that is empty even in a fresh project) wait... what?
5. and then terminates (disposes) all the windows in the scene (the new scene?) WHAT?! WHY!?!
This order of operations confuses the heck out of me. It seems that no matter what I do what ever window I create for my new scene is IMMEDIATELY disposed. I tried running the window without calling a new scene and get the same issue. Would appreciate it if someone could slap me upside the head and show me what letter/syntax I messed up that is causing this because every built in scene works fine, so it cannot be an issue with the Scene_Base.
I've been perusing Trihan's AMAZING tutorials on ruby. Let me just say they awesome by the way. Much learning, such code. They got me experimenting with Scenes and Windows trying to come up with things I could do. Anyways, I have hit a brick wall with this code I made:
Code:
class CommandScene < Scene_MenuBase
def start
super
command = BattleMenu.new
command.set_handler(:atkcom, method(:stuff))
command.set_handler(:ratkcom, method(:stuff))
command.set_handler(:spccom, method(:stuff))
command.set_handler(:passcom, method(:stuff))
end
def stuff
puts "hi"
end
end
class BattleMenu < Window_Selectable #or Command (same results)
def initialize
super(0, 0,100, Graphics.height - y)
#main
#activate
#refresh
end
def main
add_command("Attack", :atkcom)
add_command("Ranged Attack", :ratkcom)
add_command("Special", :spccom)
add_command("Pass", :passcom)
end
end
Everything seems fine with this, as far as I can tell, and I can even get the scene to switch and window to appear as expected, but that is where things get weird. As soon as the code hits the constructor for the window I am greeted by that evil ping noise and a invitation back to the script editor, which points at my new window's "super" or w/e other line I put there, that is signed off by some mysterious stranger named "disposed window".
I would like to meet this "disposed window" scoundrel in person and give them a piece of my mind, but I'm honestly not sure where they call home? Looking through the code I can trace the problem back to the Scene_Base where I find some interesting things:
1 & 2. some start up procedures okay cool
3. waits for the scene to transition to the new one sounds good
4. Runs a pre_terminate method (that is empty even in a fresh project) wait... what?
5. and then terminates (disposes) all the windows in the scene (the new scene?) WHAT?! WHY!?!
This order of operations confuses the heck out of me. It seems that no matter what I do what ever window I create for my new scene is IMMEDIATELY disposed. I tried running the window without calling a new scene and get the same issue. Would appreciate it if someone could slap me upside the head and show me what letter/syntax I messed up that is causing this because every built in scene works fine, so it cannot be an issue with the Scene_Base.