Linden Scripting Language
From Wikipedia, the free encyclopedia
Linden Scripting Language, or LSL, is the programming language used by players in Second Life, a Massive Multiplayer Online Game by Linden Lab. LSL scripts can control the behavior of in-world objects. LSL has a syntax similar to C. LSL allows objects to interact with the Second Life world and the Internet (via email, XML-RPC, and most recently, outbound HTTP requests).
Contents |
[edit] LSL Design
Linden Scripting Language is a state-event driven scripting language. It consists of multiple programming states, each containing a list of events which may be triggered while the program is within that state.
There are over 300 library functions available. Users can also declare additional global functions within programs. The 33 events allow a script to react to various kinds of input such as Mouse clicks, keyboard commands, chat triggers, email, or in-game collisions (from the integrated physics engine). LSL is a strongly typed language that is compiled to bytecode before runtime execution in a virtual machine on one of Linden Lab's servers.
There are a few major limitations that the language presents. Several functions in LSL have built-in delays, which range from a 0.2-second delay when moving an object to a 20-second pause when sending an e-mail message. The delays help prevent developers from writing LSL scripts that could overtax system resources. Users often attempt to circumvent these delays by using multiple scripts working in parallel, triggering events in sequence.
Memory available to LSL scripts is capped at about 16 KB, which places a practical limit on how much a script can do. Users sometimes get around this limitation by distributing actions across multiple scripts that work together.
LSL's native data structures are limited when compared to those of full-fledged programming languages. It does not support true arrays, for example, but instead supports "lists", which are collections of arbitrary length supporting any variable type for each element, similar in design to ArrayLists in .NET or Vectors in Java. Accessing any entry of these lists requires a function call. There are also no built-in databases. LSL developers can work around this by using lists of comma-separated values, keeping parallel lists, or accessing external servers via HTTP.
[edit] Hello World Example
A sample Hello World script looks like:
default { state_entry() { llSay(0, "Hello World!"); } }
[edit] LSL2
Second Life's second version of its scripting system was originally scheduled for release in the first quarter of 2006, but has been pushed back indefinitely. It will use Mono (the open source implementation of the Microsoft .NET framework) as the virtual machine for all the scripts running on the servers. The scripts will be compiled to CLI, or the Common Language Infrastructure, which is similar to Java bytecode and has been widely popularized by its use as one of the core technology standards in Microsoft's .NET framework.
[edit] External links and references
- Second Life official website
- Linden Lab official website
- LSL Wiki, a community effort to supplement the available LSL documentation
- Second Life in Mono Information regarding the move to Mono
- Lang.NET Symposium Videos Official Linden Blog post regarding the video presentation made by James Purbrick and Cory Ondrejka at the 2006 Lang.NET Symposium