Jump to content
Sign in to follow this  
rnorzsrpir

Estriole's NameInput taking previous 'z' key as input

Recommended Posts

The following is regarding changes to the behavior of the original Window_NameInput, which I will henceforth call NameInput for short.

 

I'm using Estriole's code that allows the user to type into NameInput instead of selecting each letter via selection window.

NameInput is the second window that deals with drawing the table with the letters and process handling user's input to add or delete letters from NameEdit, which in whole is the "Name Input Processing Event"

 

The problem I'm having is when a new NameEdit & NameInput window is initialized into another scene with Estriole's NameInput code, it takes the previous command into the newly created window.

Such as if you were to either hit 'z' key or the 'enter' key to progress to the new NameEdit & NameInput, it'll take that key and apply its action onto the newly created NameEdit & NameInput.

Such as, in terms of hitting 'z' it'll add the letter 'z' into the NameEdit, or if you hit 'enter' it'll attempt to call the process_ok handler.

 

If I were not to apply Estriole's modified code for NameInput, it'll work fine with the original NameInput text selection window without any keys flowing over from the previous handler.

So, I don't think I'm missing anything with the intialization of the windows in my code that might break the process handling.

 

If I were to use Estriole's code, and call the event "Name Input Processing" in a dialog window, Estriole's code would process fine though.

So, maybe there's an extra bit of code for process handling outside of NameInput?

 

I'm not sure why when using Estriole's code to call the event "Name Input Processing" wouldn't have the same issue as initializing a new NameEdit & NameInput window.

 

http://www.rpgmakervxace.net/topic/12619-est-name-input-using-keyboard/

Estriole's code requires http://forums.rpgmakerweb.com/index.php?/topic/3456-developer-console/#entry37268

 

Also to just make the NameEdit window look proper without the actor's face, I've used TextEdit window from;

http://www.rpgmakervxace.net/topic/4238-simple-text-input/

It's just visual changes to original NameEdit window, nothing to do with user input.

 

 

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------

  # * Create Enemy Window

  #--------------------------------------------------------------------------
  alias create_enemy_window_orig create_enemy_window
  def create_enemy_window

    @enemy_window = Window_BattleEnemy.new(@info_viewport)

    @enemy_window.set_handler(:ok,     method(:on_enemy_name))

    @enemy_window.set_handler(:cancel, method(:on_enemy_cancel))

  end

  #--------------------------------------------------------------------------

  # * Create Enemy Name Prompt

  #--------------------------------------------------------------------------

  def on_enemy_name

    @enemytarget = @enemy_window.enemy.original_name

    @edit_window = Window_TextEdit.new('Spell '+@enemytarget+' name', 15)

    @input_window = Window_NameInput.new(@edit_window)

    @input_window.set_handler(:ok,      method(:on_enemy_ok))

    @input_window.set_handler(:cancel,  method(:on_enemy_cancel))

  end

  #--------------------------------------------------------------------------

  # * Enemy [OK]

  #--------------------------------------------------------------------------

  alias on_enemy_ok_orig on_enemy_ok

  def on_enemy_ok

    @edit_window.close

    @input_window.close

    @inputname = @edit_window.name

    if @inputname == @enemytarget then

      #Sound.play_ok

      BattleManager.actor.input.target_index = @enemy_window.enemy.index

      @enemy_window.hide

      @skill_window.hide

      @item_window.hide

      next_command

    else

      Sound.play_buzzer

      @edit_window.close

      @input_window.close

      @enemy_window.hide

      @skill_window.hide

      @item_window.hide

      command_guard

    end

  end

  #--------------------------------------------------------------------------

  # * Enemy [Cancel]

  #--------------------------------------------------------------------------

  alias on_enemy_cancel_orig on_enemy_cancel

  def on_enemy_cancel

    @edit_window.close

    @input_window.close

    @enemy_window.hide

    case @actor_command_window.current_symbol

    when :attack

      @actor_command_window.activate

    when :skill

      @skill_window.activate

    when :item

      @item_window.activate

    end

  end

end
 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted