A script that allows for the escape option to be disabled mid-battle?

What I'm looking for is fairly simple in concept. There is a timer in my game that is constantly ticking down. If it reaches 0, the player is either forced to fight a strong enemy, or the enemy is suppose to join the battle, if the player is in one when the timer runs out. All of this works through a combination of scripts. I am only missing one piece of the puzzle. Stopping the player from running away. I've tried messing around with escape chances, but soon got annoyed and decided to throw in the towel and finally ask for help

Is there any script that allows me to change the availability of escape option mid-battle? Not before battle, IN battle, likely through a script call on a troop event page. I looked all around and couldn't find anyone with this request. Please, if you can help me here, I'd greatly appreciate it. Thanks in advance.
bump
Try this little script:
Spoiler
Code:
module BattleManager

  def self.can_escape=(val)
    @can_escape = val
  end
 
end
Place it anywhere between the Materials and Main slots.

With this installed, you should be able to use this script call:
Spoiler
Code:
BattleManager.can_escape = true  # Enable escape option
BattleManager.can_escape = false # Disable escape option

But depending on your battle scripts (if you use any), it may need some additional tweaks to make it work.
Try this little script:
Spoiler
Code:
module BattleManager

  def self.can_escape=(val)
    @can_escape = val
  end

end
Place it anywhere between the Materials and Main slots.

With this installed, you should be able to use this script call:
Spoiler
Code:
BattleManager.can_escape = true  # Enable escape option
BattleManager.can_escape = false # Disable escape option

But depending on your battle scripts (if you use any), it may need some additional tweaks to make it work.
THANK YOU SO MUCH!!! This works PERFECTLY!
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/a-script-that-allows-for-the-escape-option-to-be-disabled-mid-battle.133913/