Exist an condition script for when event is on off screen?

Hello Good morning / afternoon or night! I have an ambitious project that is demanding as much as I can take advantage of the MV and currently I have a huge "wall", I would like to make a condition in a parallel process that when an event is off the screen an action will happen that I wish.

That's basically it, I would like a script to use as a condition when the event is off the screen.

I looked inside the MV code itself but I didn't find anything that made sense to me (I have very little knowledge of JS however, I tried).

I will be waiting for an answer and in advance, thank you very much to everyone who tries to help me! <3

(Sorry if the post was not posted in the correct place)
You can set variables= to the players X and Y coordinates. Then check if an events coordinates are a certain amount greater or less than those variables.
Hi!
I did not try, but maybe you can use this script call:
$gameMap.event(id).isNearTheScreen();

I think this will return true if the event is INSIDE the game screen. And false if it is outside.

So you can put this on your conditional branch script:
!$gameMap.event(id).isNearTheScreen();
Which means if he is outside, do your thing.

Original thread: https://forums.rpgmakerweb.com/threads/exist-an-condition-script-for-when-event-is-on-off-screen.127288/