¿Add on/off option to a script by means of a switch?

I'll be straightforward, I'm using this script that allows to use dash sprites when performing this action.

The problem comes in that this script is always active, and this causes in problems like in events where the character should not move, in case of pressing the shift key, the character will change spritesheet no matter what, and this is worse when it is in a scene with special sprites.

That is why to try to avoid this bug, I am looking for a way to make this script not to make effect in events, being my solution to activate or deactivate the script by means of a switch.

Although it sounds something not very practical to have to add the switch in each event, it is the only solution that I can think of.
Programming doesn't work that way.

turning a script on or off can be best described as working on the engine of your car - which isn't possible while you're driving at 30 mph on the highway (while playing your game).

What is possible is to turn on and off specific functions of a script, but only if the programmer provides the method for this (only if your car mechanic installed a control at your driver cockpit for it).

But since the original programmer is still active and usually helpfull, that should be no problem to add
@kyonides
It makes no sense. The script asks the actor if Input.dir4 (an arrow) is active. Unless you are pushing any of those arrows, the sprite should not change.

I could add some parentheses to one of the conditions to check if they were missing and causing the issue. If that fix doesn't work, you'd have to ask yourself if you've included another script that modifies either the Game_Actor or Spriteset_Character class.

Just in case you didn't notice it, I've already updated the script.
It makes no sense. The script asks the actor if Input.dir4 (an arrow) is active. Unless you are pushing any of those arrows, the sprite should not change.

I could add some parentheses to one of the conditions to check if they were missing and causing the issue. If that fix doesn't work, you'd have to ask yourself if you've included another script that modifies either the Game_Actor or Spriteset_Character class.

Just in case you didn't notice it, I've already updated the script.
Well yes, the script as such if it detects when input.dir4 is pressed, that works, but the problem is that in events is still active, and as I said, in events that can break several things, so I'm looking for a way to avoid that in events the game breaks by pressing that arrow.

I was checking, and so far, it is the only script that affects the dash.
I hope I have explained myself well.
The problem seems not to be about the explanation but the lack of knowledge on my behalf about what kind of SPECIFIC events might break it so easily. Some screenshots of the event commands might help, I guess.

Well, I think I've got an idea...or a brand new add-on.

Ruby:
# * Character's Dash Animation - Editable Dash Add-On * #
#   Scripter : Kyonides Arkanthes
#   2025-07-16

# * Script Calls * #
# To Disable Dashing:
#   $game_map.disable_dashing = true
# To Use the Usual Map Dashing Setup:
#   $game_map.disable_dashing = nil

class Game_Map
  attr_accessor :disable_dashing
  def disable_dash?
    @disable_dashing || @map.disable_dashing
  end
end
The problem seems not to be about the explanation but the lack of knowledge on my behalf about what kind of SPECIFIC events might break it so easily. Some screenshots of the event commands might help, I guess.

Well, I think I've got an idea...or a brand new add-on.

Ruby:
# * Character's Dash Animation - Editable Dash Add-On * #
#   Scripter : Kyonides Arkanthes
#   2025-07-16

# * Script Calls * #
# To Disable Dashing:
#   $game_map.disable_dashing = true
# To Use the Usual Map Dashing Setup:
#   $game_map.disable_dashing = nil

class Game_Map
  attr_accessor :disable_dashing
  def disable_dash?
    @disable_dashing || @map.disable_dashing
  end
end
I just tested it, and it really works!!!!
Finally now I can avoid this bug in a simpler way.

Thanks a lot again!

Original thread: https://forums.rpgmakerweb.com/threads/add-on-off-option-to-a-script-by-means-of-a-switch.178971/