Speedy Input.repeat for Menu

Speedy Input.repeat for Menu+2011/12/25

Creator name: Ru/むっくRu (Rutan) | (English Translation by tale)​

Introduction
A script that speeds up the scrolling in the menu. Also it can slow down if you want to.

Features
- Adjustable scrolling speed for menu

For more details, see the item settings in the script. Despite how awful the item setting description, it's short though.

Video


How to Use
Paste this script above Main.

Script link
https://raw.githubusercontent.com/ovate/torigoya-rgss3/main/torigoya_SpeedyInput.rb

Code:
# coding: utf-8
#===============================================================================
# ■ Speedy Input.repeat for Menu for RGSS3
#-------------------------------------------------------------------------------
# 2012/01/02 Ru/むっくRu | English translation by tale 2017/02/16
# License - Public Domain, allows commercial use and credit is not necessary
#-------------------------------------------------------------------------------
#  Input.repeat? Speeds up the intervals.
#  (※Depends on the setting, you can slow down!)
#
#  ● Following features added
#  Input.repeatEx?(key) …… Faster Input.repeat?
#
#  ● Following features changed
#  Input.repeat?(key)   …… Faster than usual
#
#-------------------------------------------------------------------------------
# 【Issues】
#  Awful item setting description...
#-------------------------------------------------------------------------------
# 【Changelogs】
# 2012/01/02 Function extended where it can be reflected on the base script upon usage.
# 2011/12/25 Fixed an error that occurred after startup
# 2011/12/21 Released
#-------------------------------------------------------------------------------

#===============================================================================
# ● Item settings
#==============================================================================
module HZM_VXA
  module InputRepeatEx
    # First waiting time to second then repeat
    # (Time: Start to finish.)
    WAIT1 = 20
    # Second waiting time after repeat
    # (Time: Inbetween)
    WAIT2 = 1
   
    # Do you want to replace the default Input.repeat with a faster repeat?
    REPLACE_REPEAT_FLAG = true
  end
end

#===============================================================================
# ↑   Setup goes here   ↑
# ↓  Script down there  ↓
#===============================================================================

module HZM_VXA
  module InputRepeatEx
    LIST = [:DOWN, :LEFT, :RIGHT, :UP, :A, :B, :C, :X, :Y, :Z, :L, :R, :SHIFT, :CTRL, :ALT, :F5, :F6, :F7, :F8, :F9]
  end
end
module Input
  @hzm_vxa_inputrepeatex_repeatex_cnt  = {}
  @hzm_vxa_inputrepeatex_repeatex_flag = {}
  HZM_VXA::InputRepeatEx::LIST.each do |key|
    @hzm_vxa_inputrepeatex_repeatex_cnt[key] = 0
    @hzm_vxa_inputrepeatex_repeatex_flag[key] = false
  end
end

class << Input
  #-----------------------------------------------------------------------------
  # ● Update
  #-----------------------------------------------------------------------------
  alias hzm_vxa_inputrepeatex_update update
  def update
    hzm_vxa_inputrepeatex_update
    HZM_VXA::InputRepeatEx::LIST.each do |key|
      if trigger?(key)
        @hzm_vxa_inputrepeatex_repeatex_cnt[key] = HZM_VXA::InputRepeatEx::WAIT1
        @hzm_vxa_inputrepeatex_repeatex_flag[key] = true
      elsif press?(key)
        if @hzm_vxa_inputrepeatex_repeatex_cnt[key] <= 0
          @hzm_vxa_inputrepeatex_repeatex_cnt[key] = HZM_VXA::InputRepeatEx::WAIT2
          @hzm_vxa_inputrepeatex_repeatex_flag[key] = true
        else
          @hzm_vxa_inputrepeatex_repeatex_cnt[key] -= 1
          @hzm_vxa_inputrepeatex_repeatex_flag[key] = false
        end
      else
        @hzm_vxa_inputrepeatex_repeatex_cnt[key] = 0
        @hzm_vxa_inputrepeatex_repeatex_flag[key] = false
      end
    end
  end
  #-----------------------------------------------------------------------------
  # ● Speed repeat
  #-----------------------------------------------------------------------------
  def repeatEx?(key)
    @hzm_vxa_inputrepeatex_repeatex_flag[key]
  end
  #-----------------------------------------------------------------------------
  # ● repeat?(Redefined)
  #-----------------------------------------------------------------------------
  if HZM_VXA::InputRepeatEx::REPLACE_REPEAT_FLAG
    def repeat?(key)
      repeatEx?(key)
    end
  end
end

# When the base script is present, repeatEX is supported
if defined?(HZM_VXA::Input)
  module HZM_VXA
    module Input
      def self.wait1
        HZM_VXA::InputRepeatEx::WAIT1
      end
      def self.wait2
        HZM_VXA::InputRepeatEx::WAIT2
      end
    end
  end
end

Credit and Thanks
- Original Author: Rutan
- English translation: tale

License - Public Domain, this means commercial use is allow and credit is not necessary

Source
https://torigoya.hatenadiary.jp/entry/20111220/repeat

Original thread: https://forums.rpgmakerweb.com/threads/speedy-input-repeat-for-menu.74972/