- Joined
- Nov 16, 2015
- Messages
- 57
- Reaction score
- 26
- First Language
- English
- Primarily Uses
Hello! 
I'm pretty new here. I just wanted to point out to other newbies the most useful newbie thing I've learned:
The console is [SIZE=12.8px]essential for:[/SIZE]
1) writing code.
2) debugging code
3) play-testing any game.
You can get to the console anytime while playing by pressing f8.
For now, I suggest you look at it in a Battle Test...
(Click on game database, then on troops, then at the top right there's the battle test button that let's you do pretend battles)
Then press f8 and there's the console.
You should see a > cursor where you can type things.
Type: console.log($
At this point you'll see a little drop down list.
Some of the things on the list will begin $data; like $dataItems or $dataMonsters... these are permanent things in your database.
Other things will begin $game -- like $gameParty or $gameTroop or $gameVariables... these are things going on in your current game-- like who's in your party right now, and who are the monsters that you're fighting right now.
But for now, just go with. console.log($gameTroop) And press enter. And don't forget to add the ")"
You'll see something that looks like nonsense.
And you'll get something like this:
But you'll notice a couple things--
_troopId: is the Id of the troop you're fighting.
_TurnCount is what turn it is.
Go ahead on click where it says >enemies: Array[]
And again you'll get a drop down...
These are the enemies you're fighting right now.
Go ahead and click on one.
Next, you can also skip the above steps if you type something like this:
(By the way, if you hit the up arrow, on an empty console box, you'll see the last thing you just typed. Which is makes the whole typing thing go a lot faster!)
"Okay.. neat... but what do I do with this?" I hear you say.
Well for one thing you can see some data that aren't visible to the player, like the monster MP.
(also any $gameVariables, $gameSwitches, other variables, arrays, plugins, invisible states, etc. etc.. ie. anything funky you do behind the scenes.)
So if in your game, you hit a switch but you need to know if that switch is actually hit, this will tell you.
It's also a great first step to writing code, because now you know the names of all the variables!
Anything you write in your console, you can also write in an event script. And anything you write in an event script, can also be written in the console. They both just execute code.
So for example if you type in the console (or an event script):
If you combine this with the most basic java script knowledge-- if(){}... for(){}.. you'll be able to do whatever you want!
[SIZE=12.8px]So for example, maybe you could add that to a common event script that runs every round, and now you get to know how much life your enemies have every round.[/SIZE]
Now during a play-test you don't have to wait to the end of the battle to see how you're doing.
In other words-- with a tiny bit of scripting skill-- you can give yourself a sort of God Mode, allowing you to test everything in the game without having to slog through the whole game.
I'm pretty new here. I just wanted to point out to other newbies the most useful newbie thing I've learned:
The console is [SIZE=12.8px]essential for:[/SIZE]
1) writing code.
2) debugging code
3) play-testing any game.
You can get to the console anytime while playing by pressing f8.
For now, I suggest you look at it in a Battle Test...
(Click on game database, then on troops, then at the top right there's the battle test button that let's you do pretend battles)
Then press f8 and there's the console.
You should see a > cursor where you can type things.
Type: console.log($
At this point you'll see a little drop down list.
Some of the things on the list will begin $data; like $dataItems or $dataMonsters... these are permanent things in your database.
Other things will begin $game -- like $gameParty or $gameTroop or $gameVariables... these are things going on in your current game-- like who's in your party right now, and who are the monsters that you're fighting right now.
But for now, just go with. console.log($gameTroop) And press enter. And don't forget to add the ")"
You'll see something that looks like nonsense.
Now click on that line somewhere with your mouse...>Game_Troop {_inBattle: true, _interpreter: Game_Interpreter, _troopId: 1, _eventFlags: Object, _enemies: Array[4]…}
And you'll get something like this:
Which still looks like nonsense....Game_Troop {_inBattle: true, _interpreter: Game_Interpreter, _troopId: 1, _eventFlags: Object, _enemies: Array[4]…}
>_aiKnownElementRates: Object
>_enemies: Array[4]
>_eventFlags: Object
_inBattle: true
>_interpreter: Game_Interpreter
>_namesCount: Object
_troopId: 1
_turnCount: 0
__proto__: Game_Troop
But you'll notice a couple things--
_troopId: is the Id of the troop you're fighting.
_TurnCount is what turn it is.
Go ahead on click where it says >enemies: Array[]
And again you'll get a drop down...
.0: Game_Enemy
1: Game_Enemy
2: Game_Enemy
These are the enemies you're fighting right now.
Go ahead and click on one.
And boom, a whole lot of details!!! Including all the stats, and states, and everything!Game_Enemy
_actionState: "waiting"
_actions: Array[1]
_animations: Array[0]
_buffTurns: Array[8]
_buffs: Array[8]
_classId: 0
_cooldownTurns: Object_damagePopup: Array[0]
_effectType: null_enemyId: 8
_hidden: false
_hp: 100
_lastTargetIndex: 0
_letter: " A"
_level: 1....
Next, you can also skip the above steps if you type something like this:
Basically, each time you want to dig deeper, just add a period, and then type in the next part.console.log($gameTroop._enemies[0]._hp)
(By the way, if you hit the up arrow, on an empty console box, you'll see the last thing you just typed. Which is makes the whole typing thing go a lot faster!)
"Okay.. neat... but what do I do with this?" I hear you say.
Well for one thing you can see some data that aren't visible to the player, like the monster MP.
(also any $gameVariables, $gameSwitches, other variables, arrays, plugins, invisible states, etc. etc.. ie. anything funky you do behind the scenes.)
So if in your game, you hit a switch but you need to know if that switch is actually hit, this will tell you.
It's also a great first step to writing code, because now you know the names of all the variables!
Anything you write in your console, you can also write in an event script. And anything you write in an event script, can also be written in the console. They both just execute code.
So for example if you type in the console (or an event script):
The first enemy will suddenly have 5 hp. Which is great if your sitting around punching an enemy and you want to get to the next part.$gameTroop._enemies[0]._hp=5
If you combine this with the most basic java script knowledge-- if(){}... for(){}.. you'll be able to do whatever you want!
[SIZE=12.8px]So for example, maybe you could add that to a common event script that runs every round, and now you get to know how much life your enemies have every round.[/SIZE]
for(var i = 0; i< $gameTroop._enemies.length; i++) {
console.log($gameTroop._enemies._hp)
}
Now during a play-test you don't have to wait to the end of the battle to see how you're doing.
In other words-- with a tiny bit of scripting skill-- you can give yourself a sort of God Mode, allowing you to test everything in the game without having to slog through the whole game.
Last edited by a moderator:

