Check if battle is escapable

I am trying to make a skill that makes the party escape the battle, so I made it call a common event and use the abort battle command. But when I am on a Boss Battle, I set to battle so the actors can't escape. How do check that in a "if" statement?

I tried if script "$gameParty._canEscape = true" and "BattleManager._canEscape = true", but none seem to work, it always returns true.
Because you are setting these attributes and receive their assigned values. Comparison is done with "==" or "===". Since you are comparing to if, you can leave it out completely and just write:

if(BattleManager.canEscape()) { ... }Attributes prefixed with "_" are intented for private usage and you should not use them, unless there is no other option.
@Iavra

Thank you so much. It worked. I'm a real newbie in javascript so all the commands confuse me. Thanks for the help.

Original thread: https://forums.rpgmakerweb.com/threads/check-if-battle-is-escapable.54634/