Change Script file location

Spoiler: 8dir controlled by switch
Ruby:
module WSAD_Move
  #switch to turn the script on
  Turn_ON = 12
end

module Input
  class << self
    alias r2_4dir_wasd  dir4
    alias r2_8dir_wasd  dir8
  end
  #---------------------------------------------------------------------------
  # Dir4 Using $D13x Key Input
  #---------------------------------------------------------------------------
  def self.dir4
    return old_key_original_dir4 if $game_switches[WSAD_Move::Turn_ON] == false
    r2_4dir_wasd
  end
  #---------------------------------------------------------------------------
  # Dir4 using default Vx Ace Key Input
  #---------------------------------------------------------------------------
  def self.old_key_original_dir4
    return 2 if Input.press?(:DOWN)
    return 4 if Input.press?(:LEFT)
    return 6 if Input.press?(:RIGHT)
    return 8 if Input.press?(:UP)
    return 0
  end
  #---------------------------------------------------------------------------
  # Dir8 using $D13x Key Input
  #---------------------------------------------------------------------------
  def self.dir8
    return old_key_original_dir8 if $game_switches[WSAD_Move::Turn_ON] == false
    r2_8dir_wasd
  end
  #---------------------------------------------------------------------------
  # Dir8 using default Vx Ace Key Input
  #---------------------------------------------------------------------------
  def self.old_key_original_dir8
    d = Input.press?(:DOWN)
    l = Input.press?(:LEFT)
    r = Input.press?(:RIGHT)
    u = Input.press?(:UP)
    return 1 if d && l
    return 3 if d && r
    return 7 if u && l
    return 9 if u && r
    return 2 if d
    return 4 if l
    return 6 if r
    return 8 if u
    return 0
  end
 
end
Thanks for your help, I will check if it can work properly.

Original thread: https://forums.rpgmakerweb.com/threads/change-script-file-location.170828/