Developer Console
All major browsers have a built in developer console. You can use this to modify the game much more than you can with the developer tools. It's especially useful if you're developing. In chrome, you can open it with ctrl+shift+j and then select the console tab.
If you type "game" and hit enter, you can explore the main game object and its properties. To call a method on it, you'd type something like "game.save()" or if you wanted to access a method from an object linked to game you could do something like "game.ui.rollDice(10, 15, -3)".
Useful objects attached to game:
Sub object | Description |
---|---|
game.ui | Controls most of the UI, except the 3D stuff |
game.renderer | The WebGL 3d engine. |
game.players | An array of players. |
game.roleplay | Active roleplay dialogue |
game.dungeon | Active dungeon. |
game.quests | Array of active quests. |
Useful methods for modding:
Method | Description |
---|---|
game.ui.draw() | If you manually change values with the console, you'll want to call this to refresh the UI. |
glib | See all from the game's database, including mods. |
game.addPlayer(str label) | Adds a player from the glib database by label. |
game.setDungeon(str label, int room, bool resetSaveState, int difficulty) | Move to a different dungeon. Everything except label are optional. Room is the integer room index, resetSaveState resets encounters and roleplays tied to encounters, difficulty is the nr of players on the player team (leave as undefined to auto detect). |
game.setRoleplay(str label, bool force, Player player) | Change the roleplay dialogue. Fails if you're in a persistent roleplay unless force is true. Player is the player who triggered it such as game.players[0] for the first player. |
game.clearQuestAndDungeonHistory() | Resets all dungeons and completed quests. |
game.clearRoleplay(bool force) | Lets you exit out of a roleplay. Force is needed if your active roleplay is marked as persistent. |
game.refetchActions() | Actions are copied onto players when they learn them, in order to allow on the fly action changes by the DM. However, that also means actions won't be automatically updated when changed in your mod. If you change an action that a player already knows, you have to call game.refetchActions(). Do not call this function mid combat or you may end up with errors. |