Editing Tuxemon Debug Console
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
Tuxemon comes with command line that you can use for debugging purposes. The Tuxemon command line console provides you with a *full* python shell and access to all in-game functions and variables. This page will give you some examples on how you can use the Tuxemon CLI to do things like give yourself monsters or start battles | Tuxemon comes with command line that you can use for debugging purposes. The Tuxemon command line console provides you with a *full* python shell and access to all in-game functions and variables. This page will give you some examples on how you can use the Tuxemon CLI to do things like give yourself monsters or start battles. | ||
== Enabling the CLI == | == Enabling the CLI == | ||
Line 15: | Line 15: | ||
<code>Tuxemon>> </code> | <code>Tuxemon>> </code> | ||
To start a python shell, enter the following command: | To start a python shell, enter the following command: | ||
Line 29: | Line 26: | ||
From here, you can execute arbitrary Python code. To access the game's objects and variables, use <code>self.app</code>. | From here, you can execute arbitrary Python code. To access the game's objects and variables, use <code>self.app</code>. | ||
**Examples** | |||
python | python | ||
Line 60: | Line 57: | ||
=== Adding Monsters === | === Adding Monsters === | ||
You can add a monster to your party by typing the following into the Tuxemon | You can add a monster to your party by typing the following into the Tuxemon python shell: | ||
python | python | ||
>>> | >>> from core.components.event.actions.player import Player | ||
>>> | >>> Player().add_monster(self.app, (None, 'Fruitera,20')) | ||
In this example, we add the monster "Fruitera" at level 20 to the player's monsters. | |||
In | |||
=== Adding Items === | === Adding Items === | ||
You can add an item to your inventory by typing the following into the Tuxemon shell: | You can add an item to your inventory by typing the following into the Tuxemon python shell: | ||
python | python | ||
>>> | >>> from core.components.event.actions.player import Player | ||
>>> | >>> Player().add_item(self.app, (None, 'Potion')) | ||
In this example, we add the item "Potion" to the player's inventory. | In this example, we add the item "Potion" to the player's inventory. | ||
=== Start NPC Battle === | === Start NPC Battle === | ||
You can start combat by typing the following into the Tuxemon shell: | You can start combat by typing the following into the Tuxemon python shell: | ||
python | python | ||
>>> from | >>> from core.components.event.actions.combat import Combat | ||
>>> Combat().start_battle(self.app, (None, '1')) | |||
>>> | |||
This example starts a battle with the NPC with | This example starts a battle with the NPC with ID "1". | ||
=== Start Random Battle === | === Start Random Battle === | ||
You can start a random battle by typing the following into the Tuxemon shell: | You can start a random battle by typing the following into the Tuxemon python shell: | ||
python | python | ||
>>> | >>> from core.components.event.actions.combat import Combat | ||
>>> | >>> Combat().random_encounter(self.app, (None, '1')) | ||
This example will possibly start a battle with monsters from encounter group "1". Executing this is the same as stepping into a random encounter area, which may or may not trigger a battle depending on the monster's encounter rate in the encounter group. | |||