User Tools

Site Tools


This is an old revision of the document!


So easy a Dromeder can do it

:?: Like the logo? Other slogans could be “So easy a pagan can do it.” or “So easy even Benny can do it.”
I’ve also tried a different layout in lgslogo1b.jpg.

LgScript is a custom script module for Thief, Thief 2, and System Shock 2. With it you can create your own scripts using a Lua-like1) language.


A simple script might looks like this.

function SlashStimStimulus(message)
    local link = lgs.LinkSrv.GetOne("ControlDevice", script.objid)
    local dest = lgs.LinkToolsSrv.LinkGet(link)
    lgs.DamageSrv.Damage(dest, 0, message.intensity / 2, message.stimulus)
    return true

In plain English, this means:

  1. Listen for the message SlashStimStimulus. An object gets this message when a receptron action is Send to Scripts.
  2. Get the destination of a ControlDevice link.
  3. Damage the linked object with half the strength of the stimulus.


The first thing you want to do when you unpack the archive is to run the QuickTour.bat file. This will introduce you to the Lua language and some of the extensions provided by LgScript. The interactive interpreter lgscript.exe can be used to test your scripts. However, the services available when using scripts in-game aren’t in the interactive interpreter. NOTEME Eventually there will be an emulated environment for simulating a script running in the game.

The other files in the archive are lgs.osm which is the script module that you copy to the game directory. In the scripts folder is an example of a complete script. In your fan-missions, you will include the OSM and any necessary scripts.

How to Use

FIXME Please read and critique all of these tutorials.

The language reference describes Lua as implemented by LgScript. Read it if you have never used a programming language before, or are unfamiliar with Lua.

To begin writing scripts for games, read Getting Started, then the script examples:

Useful references when writing scripts:


  • bugs — Add information about problems or feature requests to this page.
  • Questions — Ask questions. Maybe even answer some if you can.
  • Useful Tips — Share helpful tips and sample scripts for others to learn from.
Mostly the same as regular Lua, but with a few extensions. And the io and os libraries are disabled.
lgscript/index.1252022978.txt.gz · Last modified: 2009/09/04 00:09 by telliamed