Character Direction checking? (script)

Hello, i tried many different expressions but i can't find anyway to get character direction (player/event)
I know this can be done via Condition Branch but i want to do it via Script because i have bunch of another scripts there

All of these didn't work, please HELP T.T i am out of ideas
function(character) {character.direction();}
this.direction();
$gamePlayer.direction
Thank you,
Don't know if it's what you're looking for, but Yanfly Event Encounter Aid might help you. 🙂
$gameParty.members()[0]._direction returns leader's direction.
$gameMap.event(1)._direction returns event 1's direction.
Thanks @Poryg, event scirpt worked but $gameParty.members()[0]._direction return undefined

Btw i want to ask that i did see "this._direction" while checking data files but how did you know
to replace "this" with "$gameMap.event()" :|
Oh, sorry, my bad.
$gamePlayer._direction returns player's direction.


Btw i want to ask that i did see "this._direction" while checking data files but how did you know
to replace "this" with "$gameMap.event()" :|
Object oriented programming in short.
I can't teach you knowledge about programming languages here, since it's got nothing to do with teaching stuff about RPG maker. If you want to, take a look at object oriented languages like C#, C, C++ or Java. Sololearn has free lessons for these languages.
Object oriented programming has same logic regardless of programming language, so even if you learn about C++, the same logic is applicable to Javascript's object oriented programming.

Original thread: https://forums.rpgmakerweb.com/threads/character-direction-checking-script.90548/