Linden Scripting Language

Linden Scripting Language

Linden Scripting Language, or LSL, is the programming language used by residents of "Second Life", a virtual world by Linden Lab. [ http://wiki.secondlife.com/wiki/Help:Getting_started_with_LSL#What_is_LSL.3F] 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.

LSL design

Linden Scripting Language is a state-event driven scripting language, in the sense of a finite state machine. [http://wiki.secondlife.com/wiki/Category:LSL_Events] A script consists of variables, function definitions, and one or more named states. Each state contains a description of how to react to events which occur while the program is within that state. The system sends events to the script, such as timers, movement, chat (from other agents), email, and collisions (with objects in the virtual world). Scripts can change most aspects of the state of the object and communicate with other objects and agents. As soon as a script is added to an object, and turned on, it begins to execute.

A script is tightly bound to the concept of virtual-world "objects" (in the 3D modeling sense rather than in the object-oriented sense). An object in Second Life represents something like a chair or a wall, or possibly something invisible. Multiple scripts may be placed inside an object, where they all execute simultaneously.

There are over 300 library functions available. [http://wiki.secondlife.com/wiki/Category:LSL_Functions] Users can also define additional functions. LSL is a strongly typed language [http://wiki.secondlife.com/wiki/Category:LSL_Types] that is compiled to bytecode before runtime execution in a virtual machine on one of Linden Lab's servers.

LSL's native data structures includes integers [http://wiki.secondlife.com/wiki/Category:LSL_Integer] , floating point numbers [http://wiki.secondlife.com/wiki/Category:LSL_Float] , strings [http://wiki.secondlife.com/wiki/Category:LSL_String] , keys(UUID) [http://wiki.secondlife.com/wiki/Category:LSL_Key] ,vectors(used for 3D coordinates and RGB color expression) [http://wiki.secondlife.com/wiki/Category:LSL_Vector] , and rotations (quaternions) [http://wiki.secondlife.com/wiki/Category:LSL_Rotation] . There are also heterogeneous lists. There are no arrays, however. Multiple lists functions must be used to adapt programs requiring array structures. [http://wiki.secondlife.com/wiki/List] There is no built-in persistent data storage, such as a file or database. On the other hand, scripts continue to run even when a user is not logged in, and if an object is saved (taken into inventory), and then re-introduced into the world later, it still maintains its previous state. In addition, the mechanisms for communicating via HTTP can be used to store a state externally.

Some functions in LSL have built-in delays, which range from a 0.2-second delay when moving a non-physical 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. Memory available to LSL scripts is capped at about 16 KB, which places a practical limit on how much a single script can do, however the ability to use multiple scripts and to call scripts from another script allows the user to pragmatically work around this 16 KB cap.

Default LSL script

The default script, "Hello, Avatar" [http://wiki.secondlife.com/wiki/Hello_Avatar] , a hello world program that speaks when the script is first saved, initialized or reset (in this case, since the command is in the default "state") or 'touched' (a simple user interaction usually initiated using a mouse click) , looks like:

default { state_entry() { llSay(0, "Hello, Avatar!"); } touch(integer total_number) { llSay(0, "Touched."); } }

LSL's future

Second Life's revised version of its scripting system was originally scheduled for release in the first quarter of 2006, but has been pushed back indefinitely. Linden Lab is still moving forward, however, as evidenced by demonstrations presented at Microsoft. The new engine executing scripts uses Mono (the open source implementation of the Microsoft .NET framework) as the virtual machine for scripts running on the servers. On January 29th, 2008, Linden Lab released the Mono VM to several sims on the Second Life Beta grid, for compatibility testing with the wide range of existing LSL code. On August 20th, 2008, Linden Lab stated with the Mono VM on several sims on the Second Life production grid. [http://blog.secondlife.com/2008/08/20/mono-launch/] On August 29th, 2008, the entire production grid was updated to being able to use the Mono VM.

The LSL scripting language remains the same, but executing on the Mono underpinnings gives up to 220 times speed increase. An additional benefit of this change is that any language that compiles to the Mono virtual machine can potentially be uploaded to execute in "Second Life."

External links

* [http://forums.secondlife.com/forumdisplay.php?f=54 LSL forum] —Second Life LSL forum
* [http://www.lslwiki.net/ LSL Wiki] —A community effort to supplement the available LSL documentation
* [http://wiki.secondlife.com/wiki/LSL_Portal LSL Portal] —A new Wiki hosted by Second Life
* [http://wiki.secondlife.com/wiki/Mono Mono for Second Life] – Information regarding the move to Mono
* [http://blog.secondlife.com/2006/09/14/langnet-symposium-videos/ 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

Notes


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • Linden Scripting Language — (или LSL)  скриптовый язык программирования, используемый при создании контента резидентами виртуального мира Second Life, созданного компанией Linden Lab.[1] С помощью LSL скриптов можно управлять поведением объектов виртуального мира.… …   Википедия

  • Linden Scripting Language — Second Life Pour les articles homonymes, voir SL. Second Life …   Wikipédia en Français

  • Linden Scripting Language — Die Linden Scripting Language (oder kurz LSL) ist eine von Linden Lab entwickelte imperative Skriptsprache, die der Steuerung von Objekten in der virtuellen 3D Welt Second Life dient. Inhaltsverzeichnis 1 Aufbau und Eigenschaften 1.1 Zustände 1.2 …   Deutsch Wikipedia

  • Linden Dollar — Second Life Entwickler: Linden Lab Publikation: 2003 …   Deutsch Wikipedia

  • Second Life — Developer(s) Linden Research, Inc Engine Proprietary …   Wikipedia

  • Culture of Second Life — Contents 1 Activities of residents 1.1 Subcultures 1.2 Resident created content …   Wikipedia

  • Second Life — Логотип Second Life Разработчик Linden Research, Inc,США …   Википедия

  • Resident (Second Life) — In the context of Second Life, the term Resident is applied to people who have a stake in the world :Cite web url=https://wiki.secondlife.com/wiki/Origin of the term %27Resident%27 title=Origin of the term Resident author=Linden, Robin… …   Wikipedia

  • Criticism of Second Life — Due to constant development, and as an open environment accessible by almost anyone with access to the Internet,[1] a number of difficult issues have arisen around Second Life. Issues range from the technical (budgeting of server resources), to… …   Wikipedia

  • Second Life — Entwickler …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”