From Tales of Maj'Eyal
Revision as of 21:26, 30 November 2019 by HenryEx (Talk | contribs)

Jump to: navigation, search

Debugging: Figuring out what went wrong

Updating your configuration

Enabling cheat/development mode will grant you access to the internal Lua console and some additional dialogs/options useful for debugging. It will stop you from uploading characters online, though, but you can always turn this mode off.

  • Navigate to the corresponding configuration directory (replace HOME with your home directory).
    Windows HOME\T-Engine\4.0\settings For example C:\Users\USERNAME\T-Engine\4.0\settings
    Linux HOME/.t-egine/4.0/settings
    Mac OSX HOME\Library\Application Support\T-Engine\4.0\settings
  • Create a file called cheat.cfg in that directory, and put the following text in that file.
     cheat = true
  • To turn cheat/development mode off, just change true to false or delete the cheat.cfg file.

Inside of ToME

Enabling cheat mode gives you the following functions:

Key Shortcut Result
Ctrl+L Lua console
(not assigned by default) Debug menu
Ctrl+S Save the game
Ctrl+Alt+Shift+R Reload the last save
Ctrl+G Hit yourself for ~100 damage
Mouse Result
Ctrl-Left click Teleport to the targeted square
Right click Right-clicking a monster offers several debug functions, such as the ability to inspect inventory.
Shift-Ctrl-Right click Instantly kill the targeted creature. This does work on yourself.

Debug menu

Debug menu (aka debug mode) offers a menu with various options like changing zones, creating items, altering quests, etc. All of this can also be done via the Lua console, but the debug menu is much easier to use.

The keybinding for debug mode may not be assigned by default. Press Esc and go under Key Bindings to assign it.

Lua console

Summary of features:

  • Inspect values and execute code
  • Cursor positioning
  • Tab auto-completion
  • Copy and paste with system clipboard

The Lua console drops you into the global namespace and gives you access to the engine. If you want to inspect values, start the line with an equal sign. For example, say you want to inspect the player:


The console has cursor positioning so you can use the Left and Right arrows, as well as Home and End to move to the beginning and end of the current line, respectively. You can paste the clipboard's contents to the cursor position with Ctrl+V (note, not Apple+V on Mac). The current line can be copied to the clipboard with Ctrl+C (again, not Apple+C).

Here are some useful commands to know.

Level up to level 50


Remove godmode invulnerability


Change your damage bonus


Change your resistance


Learn a new talent (1 level in Slash in the example)

game.player:learnTalent(game.player.T_SLASH, true, 1)

Learn a new talent type (wild-gift/harmony in the example)

game.player:learnTalentType("wild-gift/harmony", true)

Change category mastery

game.player:setTalentTypeMastery("cunning/survival", 1.5)

Change base stat - up to 100 max (reduce strength by 20 in the example)

game.player:incStat("str", -20)

Change stat bonus (set Cunning bonus to 50 in the example)

game.player.inc_stats[game.player.STAT_CUN] = 50

Apply an effect on the player (frozen for 10 turns)

game.player:setEffect(game.player.EFF_FROZEN, 10, {})

Change your max HP

game.player.max_life=1 game.player:resetToFull()

Teleport (to the Assassin Lord)


Add 5000 gold


Give yourself 10 unassigned class skills


Give yourself 10 unused stat points


Give yourself an extra stat point each level (default=3)


Give yourself 10 unused generic points


Give yourself 10 unused prodigies points


Give yourself 10 unused category points


Give yourself 10 lives


Lua code

To output values into the log file you can use 2 different functions:

Print any text


Display the content of an object. This lists all variables contained in the object foo.


Output log text to file immediately (only needed on Windows)

Without this, you have to close the game for the log file to be updated!


  1. Create a shortcut to t-engine.exe.
  2. Right-click the shortcut and select Properties.
  3. Add the command to the end of the "Target" line: --flush-stdout
The end of the Target line should look like this then:
\t-engine.exe --flush-stdout

This can be used in combination with a tail program that shows the content of the log file in realtime.

Load module and create character on startup

You can create a character once then use the premade from the command line:

t-engine -Mtome -n -E"auto_quickbirth='player'"

if your premade was named "player." (Or create a shortcut in Windows, similarly to the instructions above for outputting log text to a file.)