User Tools

Site Tools


lgscript:index

This is an old revision of the document!


LgScript

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.

Example

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
end

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.

Download

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

To begin using LgScript, read Getting Started, then the script examples:

Useful references when writing scripts:

Feedback

  • 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.
1)
97% the same as regular Lua, but with a few extensions. And the io and os libraries are disabled.
lgscript/index.1251242554.txt.gz · Last modified: 2009/08/25 23:22 by telliamed