Times a function is called.

Hi people!
I'm testing a function that only execute when the player moves, and I want to check how many times it is called.
So I put two console logs in different places.

One in SceneMap Update:
if($gameplayer.isMoving(){
console.log("times")}

Other in Game_Player increase Steps:
console.log("$gamePlayer.increasesteps")

JVr2rHg.png

So, according to this, times are called 15 times per moving. And $gamePlayer.increasesteps only once.
Did I get it right?
There is another way to check how many times a function is executed?
The map scene updates once per frame; the increaseSteps method is called once per "step", i.e. a full transition from one tile to the next.

The default player speed is 4, which equals 2**(8 - 4) = 16 frames per tile. However, on the sixteenth frame the player character will not register as "moving" (check the isMoving function for details), so you're seeing 15 frame updates, then one increaseSteps call. Try dashing: the number will be reduced because you're taking fewer frames per step! 😤

And yes, this is probably the easiest way to check when a function is called. 🙏

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/times-a-function-is-called.119166/