Filename prefix for IF statement

I need to modify a plugin, i'm not a developer my javascript knowledge is very basic.
This plugin is from a Japanese guy, there's no documentation, anyway, everything works correctly.

It's a sort of platform/adventure plugin, it works but the character doesn't change graphic when do actions, so, jumping, dashing, etc etc it's really bad without custom graphic.

I have two ways to do that, one is with parallel process, and conditional branch but i cant identify wich string put in the "script" something like

Game_Player.prototype.dash()Doesn't work

Or o think (is way better) add a prefix and say to change filename when jump, for example
if Dash use filename hero_dash.png instead hero.png

There's a part in the code where there's a sound effect for the action i think down below is the best place to put (change filename etc etc)

Code here:

// ボタン入力によるダッシュ処理Game_Player.prototype.dashByInput = function() { if (this._dashDelay > 0) { this._dashDelay--; } else { if (Input.isTriggered('dash') && !this.isSwimming()) { if (!$gameMap.isDashDisabled()) { if (this._ladder) { this.getOffLadder() if (Input.isPressed('left')) { this.setDirection(4); } else if (Input.isPressed('right')) { this.setDirection(6); } } else { if (!this._direction == 4) { this.setDirection(6); } } this.dash(this._direction); this._dashDelay = this._dashDelayTime; AudioManager.playSe(Tomoaky.Param.JASeDash); // HERE I CAN PUT THE FILENAME CHANGES } } }};Wich function is that who let change actor filename from hero.png to hero_dash.png?

You can find the full script here

Best Regards
I have two ways to do that, one is with parallel process, and conditional branch but i cant identify wich string put in the "script" something like

Game_Player.prototype.dash()Doesn't work
That is the class, not the object that's instantiated from that class. Use this:

$gamePlayer.isDashing()For the other approach, you've only got half the logic. You've got something that might change their sprite when they're dashing, but you haven't got something to change them back again when they're not.

tbh I would put it in a different place. It would probably be in Game_Player.prototype.update and would be along the lines of this (this is pseudocode, not javascript, so don't key this in and expect it to work):

Code:
if (dashing and !dashingsprite)  change sprite to dashingelse if (dashingsprite and !dashing)  change sprite to walkingend
I understand, thank you Shaz!!!
 

Original thread: https://forums.rpgmakerweb.com/threads/filename-prefix-for-if-statement.50069/