Hotkey Cancel Fix Please

So there was something I was trying to do by meshing together Sixth's Config Setup, Himeworks's Command Manager and Yanfly Battle Engine: hotkeying items by pressing a number on the keyboard.

It does work - using a hotkeyed item works, even with selection.

Where it stops working is when you cancel out of giving anybody an item, and with different variations of errors to boot:

  • The error that happens when you cancel out while hovering over Attack or Guard symbols (actor window disappears but you can still like, access the buttons. Guard softlocks the game.):
Htj2c42.png


  • The errors that happen when you cancel while hovering over the Item symbol (the item window shows up but it's completely blank even if you do have items):
PzkWDT7.png

  • The error that happens when you cancel while hovering over any skill list symbol (game crash):
fzQUowf.png


All of this coupled with the top of the screen having the recipient's name stuck on top of the screen until you choose an actual attack/skill/item the normal way.

And I'm just thinking to myself: There has to be a smart way to fix all of this without breaking Scene_Battle to pieces, since I can't quite grasp what goes where or how this is even happening to begin with.

To better streamline the process, I have made a dummy demo that contains all of the necessary scripts for bug-fixing this, complete with comment markers to tell you where my modifications begin and end.

It has the same set-up that invokes the glitches I mentioned above.

I'm at the end of my rope here and this is an important function I want to include, so I will be eternally grateful for any way to make these all work together, even if the method is completely different from what I've tried to do.
Kicking this back up because I really need this to work.
I really need this to work
After some trial and error, I found the problem.
When cancelling from using the key command it runs on_actor_cancel
Which closes the actor Window.
Problem is then (if you commented out that line), it creates a new actor window when doing the next actor command.
After some more trial and error I found that this works.
Yanfly Battle Engine (2) line 1572

Ruby:
  #--------------------------------------------------------------------------
  # alias method: on_actor_cancel
  #--------------------------------------------------------------------------
#~   alias scene_battle_on_actor_cancel_abe on_actor_cancel
#~   def on_actor_cancel
#~     BattleManager.actor.input.clear
#~     @status_aid_window.refresh
#~     $game_temp.battle_aid = nil
#~     scene_battle_on_actor_cancel_abe
#~     case @actor_command_window.current_symbol
#~     when :skill
#~       @skill_window.show
#~     when :item
#~       @item_window.show
#~     end
#~   end
  def on_actor_cancel
    BattleManager.actor.input.clear
    @status_aid_window.refresh
    $game_temp.battle_aid = nil
    @actor_window.hide
    case @actor_command_window.current_symbol
    when :skill
      @skill_window.activate
      @skill_window.show
    when :item
      @item_window.activate
      @item_window.show
    else
      next_command
      prior_command
    end
  end
After some trial and error, I found the problem.
When cancelling from using the key command it runs on_actor_cancel
Which closes the actor Window.
Problem is then (if you commented out that line), it creates a new actor window when doing the next actor command.
After some more trial and error I found that this works.
Yanfly Battle Engine (2) line 1572

Ruby:
  #--------------------------------------------------------------------------
  # alias method: on_actor_cancel
  #--------------------------------------------------------------------------
#~   alias scene_battle_on_actor_cancel_abe on_actor_cancel
#~   def on_actor_cancel
#~     BattleManager.actor.input.clear
#~     @status_aid_window.refresh
#~     $game_temp.battle_aid = nil
#~     scene_battle_on_actor_cancel_abe
#~     case @actor_command_window.current_symbol
#~     when :skill
#~       @skill_window.show
#~     when :item
#~       @item_window.show
#~     end
#~   end
  def on_actor_cancel
    BattleManager.actor.input.clear
    @status_aid_window.refresh
    $game_temp.battle_aid = nil
    @actor_window.hide
    case @actor_command_window.current_symbol
    when :skill
      @skill_window.activate
    when :item
      @item_window.activate
    else
      next_command
      prior_command
    end
  end

It fixes some of it. It stops the actor window from disappearing when using Attack or Guard. I have also conjured a fix to make the enemy name window disappear, as well as to take you back directly to the actor command (since I plan to have this controlled with switches)

But the actor window still does the disappearing thing when hovering over skill and item. This is because of the @actor_window.hide command.

We can't put an @actor_window.show command because then it creates a non-functional duplicate of the actor face window that's stuck to the scene no matter what's happening.
But the actor window still does the disappearing thing when hovering over skill and item. This is because of the @actor_window.hide command.
All of my tests did not do that.
I had no idea what the issue could have been since the demo provided did not give me that result. I pressed every key on the keyboard to find the '4' key to use an item and found that issue.
But when you say hovering is that with the mouse? Otherwise you would mean selecting with the arrow keys. And it did not do anything when I selected skills or items. It all worked exactly as it should.

*update
Just found the item selection issue.
it's when you select an item and then cancel.
Same for skills.

Tested an option. works. code above updated

Original thread: https://forums.rpgmakerweb.com/threads/hotkey-cancel-fix-please.150834/