How to check player coordinates MV

How do I check the players current coordinates with an events location coordinates in MV. I tried the following code that was meant for rpg maker vx ace in a conditional branch.

$game_player.x == $game_map.events[@event_id].x && $game_player.y == $game_map.events[@event_id].y
simply use the control variable command (game data section), there is absolutely no need for a script code for something that easy.
Control variables > Game Data > Character > Player / Your Event > Map X / Map Y
Load up each of those values into a different variable, then compare your "player x" to "enemy x" and your "player y" to "enemy y" with a pair of conditional statements.

It should end up looking something like this:
upload_2018-5-5_12-8-4.png


As to the script- Code from VX / VXA is going to be written in Ruby, while code for MV is Javascript, so you can't use scripts from one for the other.
Yeah but what if you have like 10 spikes and need to check if the player is over them. I can hard code it with checking every location the spikes are for both x and y but is their an easier way?

Edit: Does the above example work for multiple events or do I need to create new sets of variables for each event to check?
why not just make the spikes an event instead of a tile?

http://yanfly.moe/2015/10/19/yep-17-region-events/
can be good for that so not copying the same event to cover an area
Yeah but what if you have like 10 spikes and need to check if the player is over them. I can hard code it with checking every location the spikes are for both x and y but is their an easier way?

Edit: Does the above example work for multiple events or do I need to create new sets of variables for each event to check?

You could re-use the variables if you want, but if you just want something to happen every time the player steps on a spike, why not just make the event itself do it on touch?
Look at the mechanic in this video, you can use regions along with player location. You can also toggle regions on the same tile if you want the spikes to go up and down.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-check-player-coordinates-mv.94907/