Question of the "Input" for condition.

Hello.

I am struggling to create conditions for the "input".

My idea is to use all the keyboard letters, but to create conditions for "When pressed another button besides the determined".

use many "or" let the very large code.
 

Teste 1: Large line Code...

Spoiler
class Game_Player < Game_Character   alias tms_base_update update   def update    tms_base_update    if Input.trigger?🙂X)      p "A"    elsif Input.trigger?🙂A) or Input.trigger?🙂 or Input.trigger?🙂C) or Input.trigger?🙂Y) or Input.trigger?🙂Z) or Input.trigger?🙂Left) #continue...      p "S or D"    end  endend




Test 2: Fail

Spoiler
class Game_Player < Game_Character   alias tms_initialize initialize  alias tms_base_update update   def initialize    tms_initialize    @lyrics_off_X = [:A, :B, :C, :Y, :Z]    @lyrics_off_Y = [:A, :B, :C, :X, :Z]    @lyrics_off_Z = [:A, :B, :C, :X, :Y]  end         def update    tms_base_update    if Input.trigger?🙂X)      p "A"    elsif Input.trigger?(@lyrics_off_X)      p "S or D"    end  endend
Could someone help me?
Number 2 failed because Input.trigger? only accept a symbol, not array.

Instead, you could create a new method in Input module, maybe like this:

module Input def self.trigger_any? keys = [:A, :B, :C, :X, :Y, :Z, :L, :R] keys.each do |sym| return true if trigger?(sym) end return false endendAnd then use that, so you only have to write it once

Code:
class Game_Player < Game_Character   alias tms_base_update update   def update    tms_base_update    if Input.trigger?(:X)      p "A"    elsif Input.trigger_any?      p "S or D"    end  endend
I found a solution to the problem, but the solution you offer is MUCH BETTER.

xD

Spoiler
class Game_Player < Game_Character   alias tms_base_update update   def update    tms_base_update    checkpress    pressionar  end   def checkpress    @botao = 0    @botao = 1 if Input.trigger?🙂A)    @botao = 2 if Input.trigger?🙂    @botao = 3 if Input.trigger?🙂C)    @botao = 4 if Input.trigger?🙂X)    @botao = 5 if Input.trigger?🙂Y)    @botao = 6 if Input.trigger?🙂Z)    @botao = 7 if Input.trigger?🙂L)    @botao = 8 if Input.trigger?🙂R)  end   def pressionar    if @botao == 1      p "A"    elsif @botao != 1 && @botao != 0        p "S or D"    end  endend
ps- What does mean "each do |sym|" ?

Original thread: https://forums.rpgmakerweb.com/threads/question-of-the-input-for-condition.39666/