Other details

Previous section < Scripting reference

- Chapter: Using themes -

This section contains considerations on some working details, you may just skip it on a first reading.

Caveats about Notecard UUIDs

Using notecard UUIDs in place of notecards placed inside the object's inventory may help reduce the clutter inside the objects inventory. It is however important to realize a few things about this.

These caveats make using notecard UUIDs a rather risky experience, but you decide of course.

Independent themes

Applying a theme means applying the settings it contains on prims and faces. If a property is not contained in the theme then that prim or face setting on the object is not altered. Similarly, if a prim or face is filtered then its properties will not be touched.

You can take advantage of this by defining themes with different property settings and allow the user to combine them. Let's take an example: suppose you have 2 prims (named A and B) in your object, and you record their size. Thanks to filters, you can for example define two themes that only deal with the size of A, and two other themes to deal with the size of B:

Then you can for example use a standard client like the T-O-M-SC AutoMenu to give the user the opportunity to have small A+small B, or small A+large B, or large A+small B, or large A+large B.

Add to this themes that deal with certain textures of some faces of those prims, and the available combinations will be quite numerous, and it will much more flexible than if you had tried to define one theme for every possible combination.

In the end, you decide how to make your themes of course. My recommendation if you go along this way is that you avoid defining themes that "interfere" with each other by affecting the same properties on the same faces, or it might be difficult to track all the combinations of your themes.

Asynchronous operations

The T-O-M Core and T-O-M Preloader copies operate asynchronously. This means that while a theme is being loaded and activated by the T-O-M Core, preloaders could be told to apply a preloaded theme, which can then conflict with the first one which has not finished applying yet, for example.

This could of course be an advantage too, because several themes can be preloaded at the same time by different preloaders. However, experience shows that reading several notecards at the same time may cause trouble for technical reasons belonging to how SL works. Therefore, at booting time, the T-O-M Core makes sure the auto-load feature is used on only one preloader at a time.

The standard client script T-O-M-SC PreloaderMenu does that too, with the themes it preloads by itself (non auto-loading themes): it preloads them one at a time.

Yet sometimes simultaneous preloading just works fine... SL works in mysterious ways.

If at some point you need in your scripts to have synchronization then you should listen to the responses sent by the Theme-O-Matic, like the APPLIED message, as described in the Scripting reference section.

LSD themes storage

LSD themes are stored in multiple LinksetData records, that are all password protected. The only thing you may want to understand is the naming scheme, as this may help you find which LSD themes are available. You can also achieve this by sending the LISTLSDTHEMES message (see the Scripting reference page about this) but synchronous operations are always easier to handle in a script.

Allowed characters in the name of an LSD theme are alphanumeric (both uppercase and lower case) and spaces. Regex'ly speaking, this results in the following pattern "^([[:alnum:]]| )+$".

The actual storage inside the object is done with a "header" key which has the name of the theme prefixed by "TH-", and a number of records inside keys with the name of the theme prefixed by "TLn-" where n is a number starting from 1.

Therefore, if your script wants to find the available LSD themes, you can use the following code that fetches all LSD header records and strips the leading "TH-" characters.

list getLSDthemes() {

list l=llLinksetDataFindFindKeys("^TH-([[:alnum:]]| )+$",0,0);

integer n=llGetListLength(l);

integer i;

list r=[];

for (i=0;i<n;i++) {

r+=[llDeleteSubString(llList2String(l,i),0,2)];
}
return r;

}

Of course, you can refine your search by providing a more specific (and complicated) regex pattern.