Craig Martin

TM Lua Tutorial - The Script Editor

This tutorial will go through the main features of the script editor.

Contents

To be added:


Creating a New script

To create a new script, click the New Script button.

New Script

The editor will open with an empty script.

Empty Editor

Click anywhere in the gray editor area to start entering your script.

Back To Top


Editing an Existing script

To edit/change an existing script, ensure the Mode button is set to Mode:Edit and then click the script you want to edit in the main list.

New Script

The editor will open with the script loaded, and you can start editing the script.

Editor Loaded

Back To Top


Editing Multiple scripts

You can edit multiple scripts at the same time.

Click the New button on the Tool Pane to edit a new script. Click the Copy Script button on the Tool Pane to edit a copy of the current script.

The current script(s) will remain in the editor.

To switch between scripts, click the arrow at the Script Name field and select the script from the drop down.

Multiple Scripts

Back To Top


Saving a script

To save a new script or to save edits to an existing script, either click the Save button on the Tool Pane or press the <Ctrl-S> keys.

If the Save button on the Tool Pane is disabled, then there are no edits to save.

When edits to an existing script are saved, if there is an instance of that script currently executing, that instance will be cancelled.

After a script is saved, it is not recompiled. It will only be recompiled the next time it is executed.

Saving a script in the edtior does not save the script to disk or permanent storage, it just makes it the current version of the script that will be executed during this game session. Scripts are saved to permanent storage as part of the world save on the Game tab.

If there are unsaved edits to a script when exiting the editor, a message box will prompt you to either Save or Discard the changes.

Back To Top


Editor Keys

Hot Keys

Back To Top


Using the Old Script Editor

If you prefer to use the old script editor screen, click the Old Screen button on the Tool Pane and the old script editor will be opened with the currently loaded script.

Editor Loaded

NB. The old script editor has specific support for editing scripts in the old TM script syntax, but does not have support for writing scripts in Lua.

Editor Loaded

Back To Top