We’re going down the pub! Warning, this post may containt geekiness and nuts.
One of the things that has always puzzled me in Second Life has been the lack of arrays in LSL. I mean arrays, they are sexy, they are useful, they store data, they beat lists, strided lists and any other sort of list by a country mile. Basically arrays are too sexy to be bodged as lists.
I didn’t do much scripting in Second Life because scripting consumes much time in my day job, so I felt it would be like a busman’s holiday, but arrays, how can you not have arrays? That was one of my first questions to myself back in 2007 when I joined Second Life and it remains a questions that puzzles me as we come close to 2014.
I’m going to go through a little bit of scripting here, caveats apply, I have a very basic understanding of LSL, this can almost certainly be done in a more efficient manner and you use this advice at your own risk! Now on with the show. Also the scripts I have examples of don’t fit the window, so you’ll need to use the scrollbars to see it all.
One of the simple scripted tools in Second Life is a notecard giver or a freebie object giver. These are useful and the script is simple, if you want to get funky and have reports from who touched your board then it gets a tad more complicated, but the basic functionality is a simple script:
That’s it, just put a prim with your freebie goodies inside the object giver prim and you’re good to go. However we can build slightly on this by using both sides of the object giver prim to give a different object, to do that we can use llDetectedTouchFace, which will, as the name implies, detect which face of your prim is touched.
So let’s start by creating a new prim and then creating a new script. To do this just go to the content tab of your prim and click create new script.
This is part one of what will probably be a one part series, but you never know. Anyway, there are some odd tips and tricks around LSL and I’m quickly going to look at one of them. Ok so, here’s the scenario, Unhinged – A festival for Eku’s head, has more goings on in terms of DJ events, than you can shake a stick at. So say I wanted to list some upcoming events I’d maybe have a board with this:
However this is a fast changing list of events and before I know it, my board needs to say this:
Now if I were using textures of course, these boards inworld would look funkier, the thing is I can make them a bit funkier, however I’m not using textures, I’m using llSetPrimMediaParams tricks. This is an imperfect solution but one with potential because I’m using HTML.
I haven’t been that interested in the US election, not being an American or having the right to vote in the election helps a bit there. The world economies being in a mess no matter who wins, helps there too but I did want Barack Obama to win largely because it’s a slap in the face for The Wonga party in government in the UK who would have seized upon a Mitt Romney win to justify their heinous mess of a job they’re doing in Government. However it’s not like Labour offer anything much better, just a little bit in the right direction but we’re not exactly spoilt for choice.
However, when Linden Lab are feeling down about the views people post to their employees, which is allegedly part of the reasoning behind the mistaken policy of hiding Jira’s, they should be grateful that they don’t have Donald Trump as a disgruntled customer because his twitter meltdown was truly spectacular, I mean really really spectacular. That’s some funny stuff.
However, let’s move on to an area where Linden Lab are very good, scripting resources. This doesn’t mean scripting in Second Life is easy, but let’s give credit to the amount of resources available.
LSL HTTP Server is a lovely concept, unfortunately it has drawbacks. This works great when you want information from external servers, but it’s a pain when you want information from inworld objects. I’ve been working on making a notecard giver that you update centrally and it updates your remote boards, HTTP is a great way of doing this, the only problem is, URL’s are temporary.
What we really need is for these addresses to take advantage of DNS for simple tasks, so instead of the address being an IP address, it is something along the lines of http://www.secondlife.com/region_name/objectAddress. This is why DNS is such a great concept.
Currently I have to use a system of updating my remote boards using llEmail to inform them of the new URL. This means that I need to store the extenal objects email addresses and use llEmail to update them, this is not only cumbersome, it’s a waste of resouces as I have to communicate with a system that Linden Lab themselves recognises as having serious bottleneck issues.