Times a function is called.

Status
Not open for further replies.

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,708
Reaction score
1,127
First Language
Portuguese - Br
Primarily Uses
RMMZ
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")


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?
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,113
Reaction score
1,524
First Language
EN
Primarily Uses
RMMZ
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! :kaopride:

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

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,862
Reaction score
5,240
First Language
Dutch
Primarily Uses
RMXP

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.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,017
Messages
1,018,356
Members
137,802
Latest member
rencarbali
Top