Linden Scripting Language
Linden Scripting Language, or LSL, is the programming language used by residents of Second Life, a virtual world by Linden Lab.[1] 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.[2] 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.[3] Users can also define additional functions. LSL is a strongly typed language[4] 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,[5] floating point numbers,[6] strings,[7] keys(UUID),[8]vectors(used for 3D coordinates and RGB color expression),[9] and rotations (quaternions).[10] There are also heterogeneous lists. There are no arrays; multiple list functions are used to adapt programs requiring array structures.[11] 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 64 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 64 KB cap.
Permission system
Certain actions in LSL require permissions:
- take money from agent's account
- take agent's controls
- start or stop Animations on agent
- attach/detach from agent
- change links
- track the agent's camera position and rotation
- control the agent's camera
The permission system, however, has an issue scripts owned by the land owner: Those scripts can modify the parcel settings without requiring permissions. A malicious script can unsit avatars, ban and unban avatars, destroy the terrain which includes returning of objects by letting them fall out of the world, and gather the ip adresses of avatars by manipulating the media settings for that avatar.
Default LSL script
The default script, "Hello, Avatar",[12] 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 29 January 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 20 August 2008, Linden Lab started deploying the Mono VM on several sims on the Second Life production grid.[13] On 29 August 2008, the entire production grid was updated to use the Mono VM.
The LSL scripting language remains the same, but executing on the Mono underpinnings gives up to 220[14] times speed increase, at the cost of a somewhat higher overhead when creating (rezzing) scripted objects and moving them from simulator to simulator [15]
See Also
External links
- LSL forum—Second Life LSL forum
- LSL Wiki—A community effort to supplement the available LSL documentation
- LSL Portal—A new Wiki hosted by Second Life
- Mono for Second Life – Information regarding the move to Mono
- Linden Scripting Language Problems Criticism by Xah Lee
- Linden Scripting Language Script Repository - Anyone can edit and contribute scripts.
Notes
- ↑ http://wiki.secondlife.com/wiki/Help:Getting_started_with_LSL#What_is_LSL.3F
- ↑ http://wiki.secondlife.com/wiki/Category:LSL_Events
- ↑ http://wiki.secondlife.com/wiki/Category:LSL_Functions
- ↑ http://wiki.secondlife.com/wiki/Category:LSL_Types
- ↑ http://wiki.secondlife.com/wiki/Category:LSL_Integer
- ↑ http://wiki.secondlife.com/wiki/Category:LSL_Float
- ↑ http://wiki.secondlife.com/wiki/Category:LSL_String
- ↑ http://wiki.secondlife.com/wiki/Category:LSL_Key
- ↑ http://wiki.secondlife.com/wiki/Category:LSL_Vector
- ↑ http://wiki.secondlife.com/wiki/Category:LSL_Rotation
- ↑ http://wiki.secondlife.com/wiki/List
- ↑ http://wiki.secondlife.com/wiki/Hello_Avatar
- ↑ http://blog.secondlife.com/2008/08/20/mono-launch/
- ↑ https://jira.secondlife.com/browse/SVC-1341
- ↑ http://jira.secondlife.com/browse/SVC-3895
Template:Second Life Template:Vector graphics markup languages
de:LSL es:LSL fr:Linden Scripting Language it:LSL nl:LSL ja:Linden Scripting Language pt:LSL ru:Linden Scripting Language simple:LSL
If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...