- Joined
- Apr 12, 2012
- Messages
- 6,554
- Reaction score
- 7,117
- First Language
- English
- Primarily Uses
- RMMZ
Hi everyone! Answering a recent post has reminded me that a lot of users don't understand how powerful the console is and how you can use it to better understand what makes your game tick, so I decided to extract that part of the answer into its own post.
For anyone who doesn't know, when you're playing the game you can hit F8 to open the developer console, which allows you to run JS code immediately. You can use this to trace source code, check that a function works as expected, find out what values are held in a particular object at the time etc.
Let's say I have a fairy on my map that fully recovers the party (and has no other event command in it), and I want to know exactly what that's doing due to plugins that might affect it. The event's ID is 1. If I open the console, I can do this:

Then I can open up that object (the little arrow pointing right) and see the properties/functions it has access to:

If you scroll down and open "__proto__" you can see the details of its parent class:

One of these is "page", which contains the event code:

This is where you need to know a bit about the interpreter and event codes, but since we only have one command, it's obvious that the 0 element in "list" is our "Recover All" meaning that command has a code of 314. From there, you can open up rpg_objects.js and look up command314:

Now that we know it's calling the recoverAll function, we can enter that in the console on an actor to see what it does (if you enter a function name without the (), it'll show you the function itself:

Then click the f () { part to be taken to the actual source that it's referring to:

So here we can see that the "most recent" version of the function is in YEP_BattleEngineCore.js, and you can see from there what changes the overwrite has made.
This is invaluable for debugging, and can often show up the sources of bugs way more easily than trawling through the individual js files will.
Let me know if you have any comments or questions about this!
For anyone who doesn't know, when you're playing the game you can hit F8 to open the developer console, which allows you to run JS code immediately. You can use this to trace source code, check that a function works as expected, find out what values are held in a particular object at the time etc.
Let's say I have a fairy on my map that fully recovers the party (and has no other event command in it), and I want to know exactly what that's doing due to plugins that might affect it. The event's ID is 1. If I open the console, I can do this:

Then I can open up that object (the little arrow pointing right) and see the properties/functions it has access to:

If you scroll down and open "__proto__" you can see the details of its parent class:

One of these is "page", which contains the event code:

This is where you need to know a bit about the interpreter and event codes, but since we only have one command, it's obvious that the 0 element in "list" is our "Recover All" meaning that command has a code of 314. From there, you can open up rpg_objects.js and look up command314:

Now that we know it's calling the recoverAll function, we can enter that in the console on an actor to see what it does (if you enter a function name without the (), it'll show you the function itself:

Then click the f () { part to be taken to the actual source that it's referring to:

So here we can see that the "most recent" version of the function is in YEP_BattleEngineCore.js, and you can see from there what changes the overwrite has made.
This is invaluable for debugging, and can often show up the sources of bugs way more easily than trawling through the individual js files will.
Let me know if you have any comments or questions about this!