Custom Command Issue #1

Another day, another script problem. Here it is.

When I call this script using Yanfly's Ace Status Menu v1.02...

Spoiler
#-------------------------------------------------------------------------- # new method: command_name4 #-------------------------------------------------------------------------- def command_name4 SceneManager.call(Scene_EVA) end
It loads the text box fine. Though when I try and close it, nothing happens. Here are the two scripts.

Scene_EVA

Spoiler
class Scene_EVA < Scene_MenuBase def start super @Window_EVA = Window_EVA.new end def dispose super @Window_Eva.dispose if Input.trigger?🙂 && !@Window_Eva.disposed? endend
Window_EVA

Spoiler
class Window_EVA < Window_Base def initialize super(0, 0, 128, 96) self.windowskin = Cache.system("Window") refresh end def refresh draw_text(x, y, 80, line_height, "Hi! 🙂") endend
I've tried changing the dispose thing to return_scene and scenemanager.goto, though I'd prefer to just go back one step to before

I called the script.

This is probably a simple fix, but I am a completely hopeless at scripting (as you might be able to tell just by looking at this).
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.

And where are your handlers set up?

You don't do it in dispose - you need a handler for cancel that returns to the previous scene.
Yeah, as Shaz said, you need :

Spoiler
class Scene_EVA < Scene_MenuBase  def start    super    @window = Window_EVA.new    @window.set_handler🙂cancel, method🙂return_scene))    # ^ This is what you need.    # It sets that if you press :B handler (that means the X button by default) method return_scene    # will be called, and that means the scene will return to the previous scene.    # If you wanted to return the scene with :C handler (the Z, Space and Enter button) you change the :cancel to 😮k  end  # And I think you don't need the disposeend
BUT, in order to use the handlers, you would need to have Window_EVA inherited from Window_Selectable, otherwise use this :

Spoiler
class Scene_EVA < Scene_MenuBase  def start    super    @window = Window_EVA.new  end  def update    super    return_scene if Input.trigger?🙂    # If you want to return scene with :C instead of :B handler, set the :B to :C  endend
I think so.

Original thread: https://forums.rpgmakerweb.com/threads/custom-command-issue-1.44917/