Check if player is looking at event?

So in RPG Maker VX Ace how do i check if player is looking at event?
If player facing a event, a message shows.
check for the event location relative to the player:

ex = event.x
ey = event.y
px = player.x
py = player.y

rx = ex - px
ry = ey - py

if rx > 0, the event is to the right of the player.
if ry > 0, the event is down from the player position.
if rx = 0, both are in the same column
if ry = 0, both are in the same row.

now with that, check for facing direction:
if rx > 0 and player direction is 6, then the player is facing right.
if rx < 0 and player direction is 4, then the player is facing left
same for ry, 8 for up, 2 for down.

if you want a script implementation, look for the function turn_toward_character
it's basically the same thing.
In the Conditional Branch, page 3, there is a "Character facing" option. This could work if your event is stationary and limited in which directions it could be viewed from. However, you don't give a lot of detail as to what you are trying to accomplish, so it's hard to know if there is a simple solution or not.
what event? If it's the event that's doing the checking, and the trigger is action button, the player HAS to be looking at the event to trigger it, so you don't even need to check.

https://forums.rpgmakerweb.com/index.php?threads/check-if-player-facing-an-event.91458/

Original thread: https://forums.rpgmakerweb.com/threads/check-if-player-is-looking-at-event.94816/