Misplaced Pages

Linden Scripting Language: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editContent deleted Content addedVisualWikitext
Revision as of 05:39, 18 December 2011 editFred Gandt (talk | contribs)Extended confirmed users, New page reviewers, Template editors15,084 edits attempt to clarify a few points. Greater expansion would be needed to do a better job, and I'm knackered← Previous edit Latest revision as of 16:39, 13 June 2024 edit undoMika1h (talk | contribs)Autopatrolled, Extended confirmed users, File movers, New page reviewers, Rollbackers119,574 edits Changed redirect target from Second Life to Second Life#ContentTag: Redirect target changed 
(30 intermediate revisions by 21 users not shown)
Line 1: Line 1:
#redirect ]
{{Primary source|date=December 2011}}
{{infobox programming language
| name = Linden Scripting Language (LSL)
| paradigm =
| year =
| influenced by = ]
| developer =
| latest release version =
| latest release date =
| latest preview version =
| latest preview date =
| typing = ]
| operating system = ]
| file ext =
| license =
| website = {{URL|https://wiki.secondlife.com/LSL_Portal}}
}}
'''Linden Scripting Language''', or LSL, is the ] used by residents of '']'', a ] by ].<ref>https://wiki.secondlife.com/Help:Getting_started_with_LSL#What_is_LSL.3F</ref>


{{Rwh}}
LSL has a syntax similar to ] and allows objects to control the behavior of in-world objects of ] from the Internet via email, ], and most recently, ] requests.
{{R to section}}


==LSL design==
Linden Scripting Language is a state-] ], in the sense of a ].<ref>https://wiki.secondlife.com/Category:LSL_Events</ref>
A script consists of variables, function definitions, and one or more named states. Each state contains a description of how to react to events that 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 '']'' (in the 3D modeling sense rather than in the ] 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 ]s available.<ref>https://wiki.secondlife.com/Category:LSL_Functions</ref> Users can also define additional functions. LSL is a ]<ref>https://wiki.secondlife.com/Category:LSL_Types</ref> that is compiled to ] before runtime execution in a ] ('''VM''') on one of Linden Lab's servers.

LSL's native ]s includes ],<ref>https://wiki.secondlife.com/Category:LSL_Integer</ref> ],<ref>https://wiki.secondlife.com/Category:LSL_Float</ref> ],<ref>https://wiki.secondlife.com/Category:LSL_String</ref> keys(]),<ref>https://wiki.secondlife.com/Category:LSL_Key</ref> ](used for 3D coordinates and ] color expression),<ref>https://wiki.secondlife.com/Category:LSL_Vector</ref> and ]s (]s).<ref>https://wiki.secondlife.com/Category:LSL_Rotation</ref> There are also heterogeneous lists. There are no arrays; multiple list functions are used to adapt programs requiring array structures.<ref>https://wiki.secondlife.com/List</ref> 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.1-second delay when (for example) requesting string data from a notecard;<ref>https://wiki.secondlife.com/Category:LSL_Notecard An ] data storage medium mainly used for text.</ref> to a 20-second script pause after sending an ]. The delays help prevent developers from writing LSL scripts that could overtax system resources. Memory available to LSL scripts (when compiled as ]) is capped at about 64 ], 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 KiB 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, is an issue for 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 that includes returning of objects by letting them fall out of the World, and gather the ip addresses of avatars by manipulating the media settings for that avatar.

==Default LSL script==
The default script, "Hello, Avatar",<ref>https://wiki.secondlife.com/Hello_Avatar</ref> a ] that speaks (streams message to local chat ("heard" (printed) by all viewers (]s) within 20 meters <sup>(3D virtual environment)</sup> of the task)) when the script is first saved, initialized or reset (in this case, since the command is in the default "state", the first to be run on initialization) or 'touched' (a simple user interaction usually initiated using a mouse click), looks like:

<source lang="lsl2">
default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}
touch_start(integer total_number)
{
llSay(0, "Touched.");
}
}
</source>

==Mono==
The revised version of Second Life's scripting virtual machine is based on ], the open source implementation of the Microsoft.NET framework. The Mono '''VM''' was introduced to several ] ('''sims''') on the Second Life ] ] for compatibility testing on 29 January 2008 and later that year on 20 August 2008 Linden Lab started deploying it on the production grid<ref>http://blog.secondlife.com/2008/08/20/mono-launch/</ref> - with the entire production grid updated to use it on 29 August 2008.

While the LSL scripting language remained the same, scripts executed on the Mono underpinnings were up to 220<ref>https://jira.secondlife.com/browse/SVC-1341</ref> times faster in execution, but at the cost of a somewhat higher overhead when creating (rezzing) scripted objects and moving them from '''sim''' to '''sim'''.<ref>https://jira.secondlife.com/browse/SVC-3895</ref>

==References==
{{reflist}}

==External links==
* &mdash;Second Life LSL forum
* &mdash;Dr. Dobb's
* &mdash;A community effort to supplement the available LSL documentation
* &mdash;A new Wiki hosted by Second Life
* &ndash; Information regarding the move to Mono
* Criticism by Xah Lee
* - Anyone can edit and contribute scripts.

<!-- navboxen -->
{{Second Life}}
{{Vector graphics markup languages}}

<!--Categories-->
] ]
] ]
] ]

<!--Interwikis-->
]
]
]
]
]
]

Latest revision as of 16:39, 13 June 2024

Redirect to:

  • With history: This is a redirect from a page containing substantive page history. This page is kept as a redirect to preserve its former content and attributions. Please do not remove the tag that generates this text (unless the need to recreate content on this page has been demonstrated), nor delete this page.
    • This template should not be used for redirects having some edit history but no meaningful content in their previous versions, nor for redirects created as a result of a page merge (use {{R from merge}} instead), nor for redirects from a title that forms a historic part of Misplaced Pages (use {{R with old history}} instead).
Categories: