beetlesheII

reese
Member
Joined
Oct 4, 2020
Messages
12
Reaction score
0
First Language
English
Primarily Uses
RMVXA
When you hold down the up or down key in a menu, the cursor scrolls automatically. How do I change the speed at which this scroll happens? It's a bit uncomfortably slow for me
 

AkiraKotatsuhime

炬燵姫
Veteran
Joined
Jan 2, 2013
Messages
285
Reaction score
200
First Language
DE / ドイツ語
Primarily Uses
N/A
Interesting, never thought it could be considered slow.

You would have to replace the Input.repeat? function which all interactive windows use to navigate through lists. For that, it uses a long initial interval and a repeating shorter interval rooted to the game's target framerate (60) to only confirm inputs when a key is pressed for time long enough.

While that's possible to do, the official Input module is not a part of the engine-code that is available open-for-edit. Did a little try on this task, written in Notepad. This is completely untested.

Config:
_BASE is initial (set to 12 frames), …_INTERVAL is short (set to 3 frames).

Ruby:
#==============================================================================
# ** Custom Input Repeat Intervals for Directions
#------------------------------------------------------------------------------
#  © 2023 KotatsuAkira
#  Do not redistribute without this copyright notice intact.
#------------------------------------------------------------------------------
#  Made for RPGVXAce. For compatibility with RPGXP/VX, try replacing the syms
#  (e.g. ":DOWN") with constants (e.g. "DOWN") in directions and repeats list.
#==============================================================================

module Input
  #--------------------------------------------------------------------------
  # * Module Constants
  #--------------------------------------------------------------------------
  REPEAT_BASE = 12
  REPEAT_INTERVAL = 3
  REPEAT_INIT = REPEAT_INTERVAL - REPEAT_BASE
  DIRECTIONS = [ :DOWN, :LEFT, :RIGHT, :UP ]
  #--------------------------------------------------------------------------
  # * Module Variables
  #--------------------------------------------------------------------------
  @@_repeats = { :DOWN => nil, :LEFT => nil, :RIGHT => nil, :UP => nil }
  #--------------------------------------------------------------------------
  # * Method Redirects
  #--------------------------------------------------------------------------
  class << self
    alias_method(:__original_update__, :update) unless $@
    alias_method(:__original_repeat__, :repeat?) unless $@
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def self.update
    __original_update__
    DIRECTIONS.each do |sk|
      unless press?(sk)
        @@_repeats[sk] = nil
        next
      end
      @@_repeats[sk] ||= (trigger?(sk) ? REPEAT_INIT : 0) - 1
      @@_repeats[sk] += 1
      @@_repeats[sk] %= REPEAT_INTERVAL if @@_repeats[sk] > 0
    end
  end
  #--------------------------------------------------------------------------
  # * Check if Key repeats
  #--------------------------------------------------------------------------
  def self.repeat?(sk)
    return __original_repeat__(sk) unless DIRECTIONS.include?(sk)
    return @@_repeats[sk] == REPEAT_INIT || @@_repeats[sk] == 0
  end
end

~炬燵あ
 

beetlesheII

reese
Member
Joined
Oct 4, 2020
Messages
12
Reaction score
0
First Language
English
Primarily Uses
RMVXA
Thanks, this is exactly what I needed!

The thing about the slow menu is probably just a personal thing, I just like making menus as snappy as possible. Weird how this interval isn't a part of any of the given code, but this script def does the trick.

You wouldn't mind if I used this? Given credit ofc.
Thanks again !
 

Latest Threads

Latest Profile Posts

oneOfUs.jpg
Streaming more Poppet Quest game even in about 12 minutes.
Some dog owners really impress me. I'm pushing 2-3 metric tons of garbage containers that destroy everything they hit. What do you think is going to happen to your tiny dog when I run it over? And why are you crossing my path to argue with me? Have you never been hit by 200kgs of garbage?

Lesson for you folks. Never mess with an angry garbage container. Or its driver.
I didn't dispose of a file properly and now my whole game won't start: I get a script error in the Scene Manager stage of game launch. What to do? Transfer it all to a new project? That's going to be tedious. Fortunately I am only nine workdays into it.

Forum statistics

Threads
131,679
Messages
1,222,170
Members
173,427
Latest member
gkgk
Top