check if tile in a particular direction is walkable?

Hi, so I'm making an event where the player is given a choice of walking up, down, left, or right. This happens several times in a row. So for each time the player is given the choice, I want to create a conditional branch that checks if taking a step in that particular direction is possible, i.e., if the tile is walkable (and if it's not, in the "else" branch I'll just give the player a text message to make a different choice and jump back to label). In other words, if the terrain is unwalkable whether because of the tile type or there's another event on the same layer as the player, I want it to return this as an invalid choice and prevent the player from just walking into a wall or on the same tile as an enemy or evented object or whatever. Is there an easy way to do this within the event editor? Thanks so much in advance.
@jonthefox There are ways. Some require more events and some require a little help from outside the editor. One that works in editor would require a simple event you would duplicate on every unavailable square to create a "border", set to activate on Player Touch that has priority Above Player that produces the text message. You could also get complicated with terrain tags or regions and using scripting with the terrain tags or Yanfly plugins for regions, but if the number of events you need to set up the border is available, I think that's your best (and easiest) option.
yes, it can be evented.

Use control variable (game data section) to get current player position (two variables)
calculate the target position you want to check from there
use get location info to read whatever you want from the tile in that direction (one more variable)
check the results of the info in a conditional branch

it's only tricky if you need several information values to be checked for one position

EDIT: and that is in the event that selects the move - contrary to what @mathmaster74 said it can be done without additional events if you're willing to put in that event structure I described.
There's a method passable?(x,y,d) in class Game_CharacterBase that apparently checks if the tile is passable by map or event, but whenever I try to check it it gives off an undefined method error.
There's a method passable?(x,y,d) in class Game_CharacterBase that apparently checks if the tile is passable by map or event, but whenever I try to check it it gives off an undefined method error.
How are you using it? Because I constantly use that method in my script calls and it works perfectly fine. Just use
Code:
$game_player.passable?($game_player.x, $game_player.y, direction_you_want_to_check)
If the code is too long to fit in the script call box you can just split it this way:
Code:
c = $game_player
c.passable?(c.x, c.y, dir) #change dir to be your direction
The optimal solution would be to store the direction in a variable using conditional branches and then use that variable. Direction is 2, 4, 6, 8 for (respectively) DOWN, LEFT, RIGHT, UP. Since this is a built-in method I think a script call proves to be the best option here, no unnecessary code used. However, as @Andar said, there is no need to use another event to do this, just one event that checks the tile and moves the player is enough.

Original thread: https://forums.rpgmakerweb.com/threads/check-if-tile-in-a-particular-direction-is-walkable.109168/