compare all indices in an array with a specific variable

Hello guys,

ich want to save the x and y values from the player. Then i want to compare the coordinates in the array with the ones of a specific event.

I would be glad if someone could help me.
Why do it as an array?

Using event commands:
Code:
Control Variables 1 = Game Data > Character > Player's > Map X
Control Variables 2 = Game Data > Character > Event's > Map X
If Variable 1 = Variable 2
  Control Variables 1 = Game Data > Character > Player's > Map Y
  Control Variables 2 = Game Data > Character > Event's > Map Y
  If Variable 1 = Variable 2
    // the player is on the same tile as the event.  Do your stuff
  End
End

Using a script call:
Code:
If Script: $gamePlayer.x === $gameMap.event(id).x && $gamePlayer.y === $gameMap.event(id).y
  // the player is on the same tile as the event.  Do your stuff
End

Or just make the event's priority Below Characters and set the trigger to Event Touch, and whatever code is in the event will run when the player and the event are on the same tile.

If your event doesn't move, you could also use regions and not worry about the coordinates.
In first place.... thanks for your fast awnser.

The thing is, i dont want to compare the coordinates like this.

I actually want to save the route (x,y coordinates after each step) and compare if the event does cross the way.
Would events checking proximity to the player be what your looking for? Or are you making something like the bike thing from Tron? Or something like "snake"?
Yeah, maybe explain what you're trying to achieve so we can understand your requirements. Might have saved a bit of time.

How many steps do you want to remember? How many events do you want to check? What's going to happen if one/more events does cross the path - turn on a switch/activate that event?
Okay.

Actually i want to make different things with it.

Maybe place some mines wich bombs the event.

Or a type of a* algo or a own pathfinding system.

Or use it to make a sneak game.

Save the coordinates is not the problem for me, but i dont know how to compare each index place with the x (and y) coordinate from the event.

thats what i have so far:

Original thread: https://forums.rpgmakerweb.com/threads/compare-all-indices-in-an-array-with-a-specific-variable.113707/