T4 Modules Howto Guide/Getting Started
In order to start your own module, you need to create a new directory in the /game/modules/ directory, into which you copy the contents of either /game/modules/example/ or /game/modules/example_realtime/, which will give you bare-bones but working base to work off of.
init.lua
The first file you need to customize is the init.lua file. This file has a few things you need to edit to make this module your own:
Setting | Effect |
---|---|
name | This is the official name of the module as seen in module selection list. |
long_name | This is the long name of the module that appears is descriptions. |
short_name | This is a short name used internal to the module. Preferred to be lower case and should be the same as the folder name. |
author | Your name or pseudonym and email address. |
homepage | Optional homepage of the module. |
version | Module version. Does not automatically update. Change this between releases to differentiate them. |
engine | Expected engine version. |
description | A description of your module. Can be multiple lines and paragraphs. |
starter | Only change if you know what you are doing. And if you have to ask, you don't. |
show_only_on_cheat | If true, prevents this module from appearing in the mods list normally. This is enabled by default on the example module and should be disabled in your module. |
no_get_name | Prevents the new character name dialog from showing up for your module. Use this if you set the character name yourself in your module. |
allow_userchat | Registers 'space' as a key to talk, joins a channel named "module", and inits the chat system. If the game implements a game.logChat(str, ...) method it'll send chat listens to there. |
background_name | A list of filenames (without the extension) of PNG images under the data/gfx/background directory to use as startup screen backgrounds. The game will load a logo file for each background at data/gfx/background/background_name.png if it is there |
Launching your module using command line parameters
By now you should be able to start t-engine normally and see your module in the list when you select new game. However, when changing features then quickly wanting to see its effects, this process involves a lot of unneeded clicks and wasted time. For this reason t-engine.exe supports various command line parameters.
Parameter | Effect |
---|---|
-M<Module> | Auto-loads the specified module (using the module's short_name). |
-u<name> | Uses the specified name for the character. |
-n | Forces a new character, overwriting any old saves with the same name. |
To take advantage of this in windows, you need to right-click on t-engine.exe and select 'Create Shortcut'. On the created shortcut right-click again and select properties. In the dialog add the following to the Target field:
.../t-engine.exe -MMyModule -udefault -n
Replacing MyModule with your module name and default with whichever character name you desire. Using this shortcut now will launch your module directly, saving you some time while prototyping.
Go back to T4 Modules Howto Guide.