Difference between revisions of "Debugging"

From Tales of Maj'Eyal
Jump to: navigation, search
(Game options: Debug menu is now Ctrl+A by default.)
(Game options: The other reboot command. Rebinding these commands. "Options" sounds wrong. More commands and info. TODO: Many cheat commands/behavior that don't fit in this section. Ctrl+S to save isn't dev only.)
Line 27: Line 27:
 
|}
 
|}
  
=Game options=
+
=Game commands=
  
Enabling cheat mode gives you the following options:
+
Enabling cheat mode gives you the following commands:
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 38: Line 38:
 
| <kbd><kbd>Ctrl</kbd>+<kbd>A</kbd></kbd> || Debug menu
 
| <kbd><kbd>Ctrl</kbd>+<kbd>A</kbd></kbd> || Debug menu
 
|-
 
|-
| <kbd><kbd>Ctrl</kbd>+<kbd>S</kbd></kbd> || Save the game  
+
| <kbd><kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>R</kbd></kbd> || Reboot the game and reload the last save
 
|-
 
|-
| <kbd><kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>R</kbd></kbd> || Reload the last save
+
| <kbd><kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>N</kbd></kbd> || Reboot the game, delete the previous character, and start a new character with the same name{{verify}}
 
|-
 
|-
| <kbd><kbd>Ctrl</kbd>+<kbd>G</kbd></kbd> || Hit yourself for ~100 damage
+
| <kbd><kbd>Ctrl</kbd>+<kbd>P</kbd></kbd> || Display talent scaling chart, if pressed when mouse hovered over talent.
 
|-
 
|-
| <kbd><kbd>Ctrl</kbd>+<kbd>P</kbd></kbd> || Display talent scaling chart when mouse hovered over talent.
+
| <kbd><kbd>Ctrl</kbd>+<kbd>D</kbd></kbd> || Prints information about the tile the player is standing on to the log?{{Verify}}
 +
|-
 +
| <kbd><kbd>Ctrl</kbd>+<kbd>G</kbd></kbd> || There are many dummied-out experiments here. The currently active one is:
 +
 
 +
Reloads the chat system, then tries to start a chat with an Imperium courrier. It appears the chat test is part of the upcoming expansion [[The Lost Land]].
 +
|-
 +
| <kbd><kbd>Ctrl</kbd>+<kbd>F</kbd></kbd> || There are some dummied-out experiments here. The currently active one is:
 +
 
 +
Summons a [[Krog]] NPC near the player.
 
|-
 
|-
 
! Mouse !! Result
 
! Mouse !! Result
Line 50: Line 58:
 
| <kbd><kbd>Ctrl</kbd>+Left click</kbd> || Teleport to the targeted square
 
| <kbd><kbd>Ctrl</kbd>+Left click</kbd> || Teleport to the targeted square
 
|-
 
|-
| <kbd>Right click</kbd> || Right-clicking a monster offers several debug functions, such as the ability to inspect inventory.
+
| <kbd>Right click</kbd> || Right-clicking a tile offers several debug functions: if there's an actor on that tile, you can make it target the player, or you can look at its inventory. You can also open the Lua console to inspect the actor, terrain, trap, or projectile layers at that tile.
 +
 
 +
Right-clicking any effect icon allows you to cancel it. (Normally you could only cancel beneficial effects, minus a few exceptions.)
 
|-
 
|-
| <kbd><kbd>Shift</kbd>+<kbd>Ctrl</kbd>+Right click</kbd> || Instantly kill the targeted creature. This does work on yourself.
+
| <kbd><kbd>Shift</kbd>+Left click</kbd> || Click on any effect icon to increase the effect's duration by 1 turn. (Minimalist UI only.)
 +
|-
 +
| <kbd><kbd>Shift</kbd>+Right click</kbd> || Click on any effect icon to decrease the effect's duration by 1 turn. (Minimalist UI only.)
 +
|-
 +
| <kbd><kbd>Ctrl</kbd>+<kbd>Shift</kbd>+Right click</kbd> || Instantly kill the targeted creature. This does work on yourself.
 +
|-
 +
| <kbd><kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Alt</kbd>+Right click</kbd> || Use once to target a creature, then use again to move it to the targeted location.
 
|-
 
|-
 
!Menu!! Result
 
!Menu!! Result
 
|-
 
|-
|Reboot||Reloads the game.
+
| Reboot || Reboots the game, starting at the main menu.{{Verify}}
 
|}
 
|}
 +
 +
Of these commands, only the "Show Lua console" and "Debug Mode" (debug menu) key bindings can be rebound, and they can only be rebound while Developer Mode is enabled.
 +
 +
You can also, when using at item in the inventory, open the Lua console to inspect it.
  
 
=Debug menu=
 
=Debug menu=

Revision as of 16:45, 8 May 2022

Developer Mode (also known as "cheat") is a special game mode geared towards development of modules and addons for the game.

The easiest way to enable this mode is to select Developer Mode from the Options menu.

Overview

Developer mode grants the user several privileges and disables others to prevent abuse.

Pros:

  • The ability to see hidden modules
  • Access to the internal Lua console
  • Additional debugging dialogs/options

Cons:

  • Disables uploading characters online
  • Invalidates game saves loaded while enabled, making them permanently ineligible for achievements.

Config location

Developer Mode is saved as a setting in cheat.cfg in one of the following directories based off your OS. Deleting this file will disable Developer Mode. If enabled, the value for the cheat key is either true or false.

Windows HOME\T-Engine\4.0\settings For example C:\Users\USERNAME\T-Engine\4.0\settings
Linux HOME/.t-engine/4.0/settings
Mac OSX HOME\Library\Application Support\T-Engine\4.0\settings

Game commands

Enabling cheat mode gives you the following commands:

Key Shortcut Result
Ctrl+L Lua console. Click on the console title bar or outside the window to exit.
Ctrl+A Debug menu
Ctrl+Alt+Shift+R Reboot the game and reload the last save
Ctrl+Alt+Shift+N Reboot the game, delete the previous character, and start a new character with the same name

Needs verification

Ctrl+P Display talent scaling chart, if pressed when mouse hovered over talent.
Ctrl+D Prints information about the tile the player is standing on to the log?

Needs verification

Ctrl+G There are many dummied-out experiments here. The currently active one is:

Reloads the chat system, then tries to start a chat with an Imperium courrier. It appears the chat test is part of the upcoming expansion The Lost Land.

Ctrl+F There are some dummied-out experiments here. The currently active one is:

Summons a Krog NPC near the player.

Mouse Result
Ctrl+Left click Teleport to the targeted square
Right click Right-clicking a tile offers several debug functions: if there's an actor on that tile, you can make it target the player, or you can look at its inventory. You can also open the Lua console to inspect the actor, terrain, trap, or projectile layers at that tile.

Right-clicking any effect icon allows you to cancel it. (Normally you could only cancel beneficial effects, minus a few exceptions.)

Shift+Left click Click on any effect icon to increase the effect's duration by 1 turn. (Minimalist UI only.)
Shift+Right click Click on any effect icon to decrease the effect's duration by 1 turn. (Minimalist UI only.)
Ctrl+Shift+Right click Instantly kill the targeted creature. This does work on yourself.
Ctrl+Shift+Alt+Right click Use once to target a creature, then use again to move it to the targeted location.
Menu Result
Reboot Reboots the game, starting at the main menu.

Needs verification

Of these commands, only the "Show Lua console" and "Debug Mode" (debug menu) key bindings can be rebound, and they can only be rebound while Developer Mode is enabled.

You can also, when using at item in the inventory, open the Lua console to inspect it.

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:

=game.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 CMD+V on Mac). The current line can be copied to the clipboard with Ctrl+C (again, not CMD+C on Mac).

Here are some useful commands to know.


Level up to level 50

game.player:forceLevelup(50)


Remove godmode invulnerability

game.player.invulnerable=0


Change your damage bonus

game.player.inc_damage.all=


Change your resistance

game.player.resists.all=


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)

game:changeLevel(2,"thieves-tunnels")


Add 5000 gold

game.player:incMoney(5000)


Give yourself 10 unassigned class skills

game.player.unused_talents=10


Give yourself 10 unused stat points

game.player.unused_stats=10


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

game.player.stats_per_level=4


Give yourself 10 unused generic points

game.player.unused_generics=10


Give yourself 10 unused prodigies points

game.player.unused_prodigies=10


Give yourself 10 unused category points

game.player.unused_talents_types=10


Give yourself 10 lives

game.player.easy_mode_lifes=10


Change another actor's physical resistance to 50
  1. Right-click then Lua inspect [Actor] to get their actor ID
  2. __uids[ActorID here].resists.PHYSICAL=50


Lua code

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

Print any text

print("your message")


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

table.print(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!

Instructions:

  • Create a shortcut to t-engine.exe.
  • Right-click the shortcut and select Properties.
  • 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.)