Jump to content

Spring 2023 Scripting Summary


Signal Linden

3,761 views

As spring winds to an end it may be a good time to stop and smell the Linden Scripting Language (LSL) controlled flowers. In the past year, Second Life's server team has placed an increased priority on delivering useful new functions and enhancements for scripters. This blog post contains highlighted features released in the past six months; maybe there's something you missed!

💾 Linkset Data (LSD)

Likely the most prominent new feature introduced to LSL in recent history, Linkset Data (LSD) provides 128KiB of persistent memory which is shared by all scripts in an object. This functionality scratches several itches which have plagued scripters for some time: a desire for memory that persists between script resets and better conventions for inter-process/script communication. Prior to its introduction, many awkward techniques were used to persist and share data between scripts, including placing data in external HTTP APIs and using the age-old trick of storing data in object descriptions. No more!

At its core, LSD is a key-value database associated with the root object of a linkset. The data stored in LSD is persisted between script resets, object transfer and copying. In its simplest form, a script can write, retrieve and delete data using llLinksetDataWrite, llLinksetDataRead and llLinksetDataDelete while the event linkset_data may be used by any script in the object to be informed of changes.

More information on LSD, including examples, and information about all related library functions can be found on Second Life's wiki, Category: LSL LinksetData and on the great blogpost from resident NeoBokrug Elytis, Linkset Data (LSD) - A New Feature for Second Life.

🔍 List search, now with start and end

Lists can now be searched using llListFindStrided, and manipulated using llList2ListSlice, and llSortListStrided. Notably, llListFindStrided contains start and end parameters, which allow lists to be searched more quickly without many of the out-of-memory situations run into using llListFindList. You can even use llListFindStrided with non-strided data by giving it a stride of one. 🤫

Strided lists are commonly used to store structured data as LSL has no native map type. llListFindStrided and llSortListStrided should make it easier and more performant to work with lists.

✂️ Replace substring

You can now find and replace segments of string in a performant way using llReplaceSubstring.

🔊 Linkset sounds

A handful of functions have been added which make it easier for a linkset to play multiple sounds simultaneously using a single script. This should be a boon for vehicle makers and anyone looking to layer and compose sounds.

🔐 Cryptographic functions

HMAC and RSA functions have been added to LSL. These will make secure communication between systems inside and outside of Second Life easier, and make it easier to do things like create a valid JSON Web Token (JWT).

🙂 Miscellaneous

  • Environment control - Scripts are able to control environment settings using two functions introduced in August 2022: llSetEnvironment and llReplaceEnvironment.
  • Simulator statistics - llGetSimStats has been enhanced with over 25 new statistics, mirroring much of the data displayed in the viewer statistics panel's Simulator section.
  • You can now set an object property that causes objects to die with no warning if they hit a no-entry parcel using llSetStatus(STATUS_DIE_AT_NO_ENTRY). This is useful for bullets and other objects that would otherwise become lodged in the air at parcel boundaries.
  • HTTP custom header size and accounting has been changed. Scripts are no longer limited to 8 256 byte custom header.  LSL Now provides a 4k pool of memory that may be used for custom headers in whatever way the scripter wants.

Wrap up

Phew. In all, more changes have been made to LSL in the last six months than several prior years combined. That's a lot, but we always want to hear more ideas about how best to improve LSL and the tools available to content creators. If you are interested in hearing about scripting and other areas of development, we encourage you to attend one of Second Life's user group meetings or submit your idea to Jira.

Many of the features in this post come from resident submitted requests. Thank you for loving Second Life just like we do.

Happy scripting!

  • Like 7
  • Thanks 14

0 Comments


Recommended Comments

There are no comments to display.

×
×
  • Create New...