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 60: Line 57:


=== Adding Monsters ===
=== Adding Monsters ===
You can add a monster to your party by typing the following into the Tuxemon shell:
You can add a monster to your party by typing the following into the Tuxemon python shell:
 
    add_monster rockitten 20
 
Or in the python shell:


     python
     python
     >>> action = self.app.event_engine.execute_action
     >>> from core.components.event.actions.player import Player
     >>> action("add_monster", ("rockitten", 20))
     >>> 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 these examples, we add the monster "rockitten" at level 20 to the player's monsters.


=== 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:


    add_item Potion
Python shell equivalent:
     python
     python
     >>> action = self.app.event_engine.execute_action
     >>> from core.components.event.actions.player import Player
     >>> action("add_item", ("potion",))
     >>> 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:
    trainer_battle professor-rockitten


Python shell equivalent:
     python
     python
     >>> from tuxemon.event.actions.start_battle import StartBattleActionParameters
     >>> from core.components.event.actions.combat import Combat
    >>> action = self.app.event_engine.execute_action
     >>> Combat().start_battle(self.app, (None, '1'))
    >>> trainer = "professor-rockitten"
     >>> action("create_npc", (trainer,7,6))
    >>> action("start_battle", (StartBattleActionParameters(npc_slug=trainer)))
    >>> action("remove_npc", (trainer,))


This example starts a battle with the NPC with name "professor-rockitten".
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:


  random_encounter
Python shell equivalent:
     python
     python
     >>> action = self.app.event_engine.execute_action
     >>> from core.components.event.actions.combat import Combat
     >>> action("random_encounter", ("default_encounter",100))
     >>> Combat().random_encounter(self.app, (None, '1'))
 
This example will start a battle with monsters from encounter group "default_encounter". Executing this is the same as stepping into a random encounter area, which will trigger a battle depending on the monster's encounter rate in the encounter group.
 
 
----


You can use the following commands (in the "normal" shell, not in the python one.):
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.
    • help — shows all commands
    • credits — shows the copyright text
    • exit — exits the game
    • add_item <slug> [amount] — Adds the item (defined in slug parameter)
    • set_health <target_level> [slot] — Sets the health of the monster in your party. Must be a number between 0 and 100. If slot argument isn't specified, all monsters in your party will be affected.
    • random_encounter — Sets you in a wild tuxemon battle, similar to walking in tall grass.
    • trainer_battle <npc_slug> — Sets you in a trainer battle with specified npc.
    • trainer_battle list — Gives you a list of fightable trainers.
    • teleport <x> <y> [map_file] — Teleports you to the specific tile. If map_file argument is specified, you'll get teleported to a selected map file.
    • whereami — Prints out the map filename
    • python — Starts the python shell, that you can use to modify the game directly. For advanced users, used in some examples above.
    • event_sh — Event shell, used to execute event actions manually.

Please note that all contributions to Tuxepedia are considered to be released under the Creative Commons Attribution-ShareAlike (see Tuxepedia:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)