Jul
6

LSL Weirdness

Filed under LSL Scripting by Luc

So Kokiri Saarinen and I just spent a very geeky couple of hours testing Mono list storage capacity (and, sadly enough, competing for the fastest result times) and we accidentally discovered something odd:

Casting keys as strings allowed us to store 13x as much data.

We ran different tests, with different configurations, compiling the lists in different ways, for a solid hour, and kept arriving at the same results: a key, stored in a list as a key, ate 106 bytes. The same key, casted to a string, ate 8 bytes. We were able to create a list of 7692 (under ideal circumstances) 36-character strings (keys converted to strings) before the script ran out of memory and stack-heaped, but only 583 keys.

This is pretty odd, and I’m not yet ready to declare that conclusive, as that’s a rather huge discrepancy. List memory usage in Mono is supposed to be calculated thusly:

string: 22 + 1 byte per character
key: 34 + 1 byte per character

So while strings should be a little bit more memory-efficient, they should still eat nearly 60 bytes. Why, then, the script would be storing them as 8 bytes is beyond me.

These tests all stored a global list and ran a loop adding keys to the list (with results displayed via llSetText) until the script barfed up a stack-heap collision.

If anybody else who has more knowledge about LSL memory would like to enlighten me, I’d love to hear it.

May
5

Ask Luc: Clean llSay text?

Filed under Ask Luc, LSL Scripting by Luc

This from Viwoma:

I have a titler, one of those things that lets other people change the hovertext above your head, and when it speaks the text isnt prefixed with the object name, as with most objects. Its heard by everyone around you (so, probably llSay()) but its not the usual trick of changing the object name, because there is no colon (:) anywhere in the text which normally follows the object name, regardles of what it has been set to. Any ideas?

The trick she’s referring to, which I think of as “clean speak,” is a nice way to do object feedback without the mildly ugly object: statement text (”Luc’s Scripted Whatnot (verson 1.2a): I like monkeys!”).

Continue Reading »

May
3

Ask Luc: Persistent data & LSL?

Filed under Ask Luc, LSL Scripting by Luc

I got this question from Osiris:

What good options are there for saving persistent data, given that we can’t write to notecards and list data will be lost at reset?

Ach.  LSL is sadly lacking in provisions for the storage of persistent data, to tell the truth.  Storing any data outside of the script’s own memory is a pain, no matter how you go about it.  It’s possible, of course, but such solutions are not typically elegant.

Continue Reading »

Apr
0

Ask Luc: HUDs run on no-script land?

Filed under Ask Luc, LSL Scripting by Luc

I got this question from ‘taurus:’

I noticed you managed to get the new te.leport.me hud to work on no script land.  I was wondering if you’d tell us how you did this and if you plan to equip your other items with whatever loophole you used here.

I’m actually kind of embarrassed to have overlooked this on the release, but I’m glad we got it worked out now.

Basically, there’s a small, intentional hole in the no-script land restriction, and that hole is the control event.  The no-script restriction is designed to allow things like flight enhancers and animation overriders to continue working, so the parcel assumes that an attachment running a control event is one of those things and allows it to continue operating.

Continue Reading »

Apr
0

New Section: Ask Luc

Filed under Ask Luc, LSL Scripting by Luc

I get an awful lot of scripting questions via instant message in Second Life, and it occurs to me that some of the answers (the correct ones, anyway) would benefit others.

For this reason, I’m adding a section to my blog called “Ask Luc.” I’ll happily take questions and if I know the answers, I’ll post them on the blog.

Please note that this section is only for questions about scripting, Second Life tips, or personal (not too personal, you understand) curiosities. If you have a support question about an aubreTEC product, ask it here.

Mar
0

Ordered Lists

Filed under LSL Scripting by Luc

I did a bit of work last night on an ordered list function that would organize my list in a correct, human-readable order for dialogs (given LSL’s method of stacking dialog list buttons backward), split it up into multiple pages, and put nav (”<<" and ">>” buttons in the list). It’s not perfect yet (I need to put in some adjustments to remove unnecessary nav buttons, etcetera), but I thought I’d post it here for anybody who’s had the same issue:

//This function takes a list of options, organizes it into a human-readable list (i.e. in the right order), and paginates it in groups of 12 with << and >> nav buttons.  All you then have to do is offer the list up one set of twelve at a time.

list Ordered(list items)
{  
    list temp_list;
    integer n;
    for(n=0;n< llGetListLength(items);n+=10)
    {
        list temp_strided = llListInsertList(llList2List(items,n,n+9),["<<"], llGetListLength(llList2List(items,n,n+9))-1)+[">>"];
        integer i;
        for (i=0;i< llGetListLength(temp_strided);i+=3)
            temp_strided = llListInsertList(llDeleteSubList(temp_strided,-3,-1), llList2List(temp_strided,-3,-1),i);
        temp_list += temp_strided;
    }
    return temp_list;
}

If you’re still unclear on what I mean by “human-readable,” I mean that if you were to use this on a list of letters in alphabetical order (["A","B","C"...]), it would produce the buttons in correct alphabetical order, with pagination to the next set.

Feb
0

Code Snippets

Filed under LSL Scripting, Miscellany by Luc

With a strange combination of GeSHi, CSS, and Wordpress plugins, I finally managed to get an LSL code pasting solution I’m happy with:

default
{
    state_entry()
    {
        llSay(0, "Hello, douchebag!");
    }

    touch_start(integer total)
    {
        llSay(0, "Quit fucking touching me.");
    }
}

UPDATE: Got the colors tweaked right down to the background color; should be exactly the same as the in-world LSL editor (thank you, Apple Digital Color Meter).

Also, updated the GeSHi lsl.php file so that clicking the various functions and what-nots lead you directly to the right entry on http://wiki.secondlife.com.

My big concern now is that the colors/fonts are so close it looks like a screenshot; hope people realize it’s not (and that they can cut and paste).

Feb
0

A Note About Theme

Filed under LSL Scripting, Miscellany by Luc

I’ve been asked, with increasing frequency, about the theme/genre of our products.  A lot of weapon-makers concentrate on making replica weapons: Beretta 9mms, Desert Eagles, Uzis, etc.  We’ve never really done that, and I’m forever being asked why.

Continue Reading »

Feb
1

What’s in a syntax?

Filed under LSL Scripting by Luc

I’ve recently been working on a project that allows for third-party plug-in development.  I’ve become very interested in plug-in systems (though they’re a pain in the ass to script) because they’re the perfect situation:  it allows for other developers with nifty ideas to improve your product without any work from you.  The laziness is neat, but it also allows for innovation in ways you might not have thought of yourself.

However, in writing up the sample plug-in code, I’ve come to realize that trying to read my syntax may cause anybody with any background in coding or scripting to bleed copiously from the ears.

Continue Reading »

Feb
1

Excessive Trademarks™

Filed under LSL Scripting by Luc

I had a bit of a chuckle when I saw Sion Zaius’ new product listing for the sion Chicken over on XStreet.

Don’t get me wrong; I’m sure it’s a great product.  If it’s ever been your lifelong dream to raise a chicken, have at it.  Personally, my grandfather owned a chicken farm, and I find the damned things kinda creepy, but I’m sure Sion’s version is cute and cuddly.

Continue Reading »