User Tools

Site Tools


lgscript:index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

lgscript:index [2009/09/06 03:28]
telliamed Lua FAQ link changed
lgscript:index [2013/01/23 08:32]
Line 1: Line 1:
-====== LgScript ====== 
-{{ lgslogo1.jpg?​nolink |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?​linkonly}}. 
- 
-__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-like((Mostly the same as regular __Lua__, but with a few extensions. And the ''​io''​ and ''​os''​ libraries are disabled.)) language. 
- 
-===== Example ===== 
-A simple script might looks like this. 
- 
-### I should add "​lgscript"​ to the list of languages 
-<code lua> 
-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 
-</​code>​ 
- 
-In plain English, this means: 
- 
-  - Listen for the message ``SlashStimStimulus``. An object gets this message when a receptron action is ''​Send to Scripts''​. 
-  - Get the destination of a ``ControlDevice`` link. 
-  - Damage the linked object with half the strength of the stimulus. 
- 
-===== Download ===== 
- 
-  * {{lgscript-test1.zip}} 
- 
-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 [[lua|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: 
- 
-  * [[First Script]] 
-  * [[Second Script]] 
-  * [[Third Script]] 
- 
-Useful references when writing scripts: 
- 
-  * [[messages]] 
-  * [[services]] 
-  * {{data-structs.zip}} Lists of property, link, and receptron data with the fields and types you can use. 
- 
-===== Feedback ===== 
- 
-  * [[bugs]] --- Add information about problems or feature requests to this page. 
-  * [[faq]] --- Ask questions. Maybe even answer some if you can. 
-  * [[tips]] --- Share helpful tips and sample scripts for others to learn from. 
- 
-===== External Links ===== 
- 
-  * [[http://​www.lua.org/​]] 
-  * [[http://​batbytes.com/​luafaq|Unofficial Lua FAQ]] 
-  * [[http://​luaforge.net/​frs/?​group_id=377|Lua for Windows]] 
-  * [[http://​www.scintilla.org/​SciTE.html|Scintilla Text Editor]] 
  
lgscript/index.txt · Last modified: 2013/01/23 08:32 (external edit)