Script preprocessing

As you may know if you’ve read my “About Blue” page, I love writing scripts to get objects to do things in-world.  It’s one of the reasons I joined SL, to discover what I could do with a new and interesting programming language.  So, you get the occasional technical article on the blog.  Feel free to skip this if you have no interesting in scripting 🙂

LSL is limited is a number of ways.  One of them that it lacks a preprocessor.  Preprocessors allow you to do things like:


#define CONSTANT value

and wherever the word CONSTANT appears in the script, the preprocessor will substitute value before it compiles the resulting code.  This is great for things like debugging scripts, and many other uses.

If you are using Firestorm however, you can switch on a preprocessor for LSL built into the viewer!

Other than doing substitutions such as the example above, there are a number of things you can use defined constants for, such as conditional compilation. Also, the preprocessor implements a number of other functions such as code inclusion.

The feature I want to talk about though is the switch statement.  LSL lacks this common feature of other C and Java-like languages.  So the Firestorm developers included a way to have the preprocessor do it.

In their basic form, switch statements look like:


switch (expression) {
    case value1: {
        do something;
    }
    case value2: {
        do something else;
    }
}

And here is the point.  We know that expression is something that can return an integer.  The first time I used a switch statement in LSL, I coded what any C or Java programmer would and said:


switch (llListFindList (list1, list2)) {

knowing that llListFindList () would return an integer result.  But on looking at the resultant code (you can see this in the preprocessor window in Firestorm after your code is preprocessed), I noted that the switch statement is translated into multiple if statements with jumps, but the preprocessor is not smart enough to evaluate the expression once and use the result!  So if you have 40 case statements, the resulting code will have 40 calls to llListFindList () !  This is terrible for performance!

If you are using switch statements in your LSL, please evaluate your expression before handing it to the preprocessor.  For example:


integer result = llListFindList (list1, list2);
switch (result) {

This will ensure expression is only evaluated once.

You can read more about the Firestorm preprocessor here.


Nikki

I hope this giftie is still available!  This full over one piece swimsuit is a group gift for members of TeleportHub.  TeleportHub is L$10 to join, and once you do, there are gifts all over the grid, just waiting for you.

The swimsuit comes in classic standard sizes, plus body specific fitmesh for Lara, Freya, Isis, Venus, Ebody, Ocacin, Hourglass, Physique, Fine, Curvy, and TMP.

The polkadot pattern is cute, and I really love the ties at the hips.


Crowl

As I mentioned a while back now, Hunt for you Inner Slut is currently on, and this is another item from the hunt.

This set of bra, pants, and dress are all separates. They come in fitmesh sizes for Lara, Freya, Isis, Venus, Hourglass, Physique, and Werewolf (which I’m presuming in the Bento Werewolf from JOMO).  The bra and pants straps could be just a little tighter, but the rigging is pretty nice 🙂

The dress is super short, especially at the back.


Lory

Hello sweets, today while I’m sorting out packages from all the events that have been on lately, I thought I’d show you this group gift from Resun Fashion.  It’s from back in November last year, but it’s still available in-store at the time of this post.  The Resun group is FREE to join!

There are two colors, black and this camel, in fitmesh sizes for classic, Lara, Freya, Isis, Venus, Physique, Hourglass, Ebody, Curvy, Fine, TMP.

The top is quite sheer in both the black and the camel colors, so it’s pretty daring!

As you can’t wear any alpha with it, at least for the top, there are some minor clipping issues while dancing, but nothing that will have you running away in embarrassment 😉


More SLB15 goodies

A few more SLB15 goodies to show you today, lovelies!

These fringed shorts come in sizes for Lara, Freya, Isis, Hourglass, and Physique.  They come with a HUD to change the lace and eyelet colors, with a host of combinations possible.

My hairstyle is by Mina Hair, and there are rigged and unrigged versions.  It too comes with a HUD with 13 essential colors, and a materials on/off selection.  Additionally, there are two styles you can select via the HUD, the major difference being the little escaped wisp of hair in the side of your face can be shown or hidden.  And hooray!  A really nice red.

Lastly, the necklace is available in both long and short versions, and also has a HUD to allow you to change the metals and the center of the flower.  The little note says “Bloom where you are planted” 🙂

The hair, short, and necklace are FREE gifts at SLB15.


Peony

Here are two more items from SLB15!

This pretty little summery dress comes in sizes for Lara, Physique, and Hourglass.  It has a five color HUD in pastels to change the color of the dress (not the pattern).

Normally I wear Slink feet, except when I’m wearing mid heeled shoes.  While the Maitreya feet are pretty, and you can change from low to mid to high with the HUD, I like being able to save a pair of matching shoes and feet with an outfit, then I don’t have to worry about the HUD.  There’s nothing as embarrassing as walking out with your feet at the wrong height for your shoes!  So my Maitreya feet are always set on mid.  Except when I find a pair of high heels for Maitreya as good as this!

These lovely peep toes are super, and they come with a HUD to let you change the sole shading (unfortunately not the upper, but you can’t have everything).  Note these are Maitreya only.


Happy Birthday, Second Life!

In case you’ve been hiding under a rock, Second Life turns 15 this month!  Happy Birthday!

I made it into the shopping areas today, and here’s an outfit assembled from some of the FREE gifts various creators have on offer.

Firstly, the simple striped summer mini is from Ison and comes in sizes for Lara, Physique, Hourglass, Freya, and Isis, and includes a three color HUD to let you retexture (the other colors are a solid vivid red, and a pretty green floral pattern).

These sandals are by YS&YS, and there are versions for Lara, Slink, and Belleza feet in the package.  The texturing is really nice!

This charm bracelet is by Lapointe & Bastchild.  It has an amazing HUD with all twelve signs of the Zodiac in gold and silver, along with the twelve classic birthstones.  And if that’s not enough, there are six color selections for the stone beads!

Lastly this dog tag style necklace by Petit Chat comes in male and female versions and also has a HUD to let you select one of four colors for the metal.  What a wonderful selection of freebies by some super generous creators!


Nicole

Hunt for you Inner Slut 18 is on at the moment, and goes though to the 15th of July, so there’s plenty of time for you to find the 20 items hidden around the grid!

This prize was the only one that came unboxed, so I get to show you it first 🙂

The bikini is separate top and bottoms and comes in fitmesh size for Lara, Venus, Isis, Freya, Physique, and Hourglass.  There are two HUDS (one for the top and one for the bottoms) that have the same four textures, which makes changing each piece easy but takes screen real estate until done.

The fit for Lara is very nice, and the summery textures are a treat!  Grab this and go and relax on a beach somewhere!


Bebe

Hello sweets!  I found this cheeky bodysuit and awesome thigh boots on the Evil Bunny Hunt back in April.

The bodysuit comes in sizes for Lara, Venus, Isis, Freya, Physique, Hourglass, Curvy, and Fine.  Sorry you girls without one of these, this is not available for classic avis as it’s so body hugging there’s no way you’d manage to slip an alpha between yourself and it 🙂

The strapped and laced thigh boots are also rigged for the same bodies with the exception of Fine and Curvy.  I can guarantee that these boots will become a favorite of mine!

I added some tattoos and jewelry to complete this.  Bad Azz 🙂