Arranging llDialog buttons

Okay, back in Second Life! And/or OpenSim.

A purely Scripting-geekery post today, on a really niche topic.

When you get one of those blue dropdowns (or pop-ups, or drop-ins, depending on your viewer) with a number (up to twelve!) of buttons in them (when you touch a danceball for instance and it asks you what dance you want to do), the piece of LSL (Liden Scripting Language) that shows you that thing with those buttons is a built-in function called “llDialog“.

(All of the built-in functions start with “ll” which presumably stands for “Linden Lab”, but which has made many beginning LSL scripters, including Yers Truly, wonder how an identifier can start with eleven at all.)

One of the arguments to llDialog is, naturally enough, a list of the strings to put on the buttons. And the order in which the strings are copied from the list onto the buttons is… perhaps counterintuitive. For instance, if the list looks like:

[ "one", "two", "three", "four" ]

then the dialog as displayed will look like:

which might not be the first thing one would have guessed.

It basically starts at the bottom, filling rows upward as it goes, until it runs out of strings.

I have sometimes fiddled around to make things come out how I want them to manually, and more often have ignored the problem entirely and just not cared that the buttons were in a stupid order.

But for some reason today I got tired of it and decided to fix it; so here:

list arrange(list l) {
list outl = [];
integer n = llGetListLength(l);
do {
if (n<3) return outl + l;
n = n - 3;
outl = outl + llList2List(l, -3, -1);
if (n==0) return outl;
l = llList2List(l, 0, -4);
} while (TRUE);
return []; // UNREACHABLE
}

This will take a list in an order, and return a list in a different order such that if you pass the new list to llDialog, the labels on the buttons will be in the order that one might expect, left to right and up to down. As in for instance:

llDialog(avatar_id, prompt, arrange(button_list), channel);

It basically just divides the input list into pieces of size three, and then reverses them, with complications in case the input list isn’t equally divisible by three. And because if you ask LSL to copy the first through fourth-to-last (inclusive) elements of a three-element list, it silently copies the entire list rather than (as one might have expected) copying nothing. And because it doesn’t realize that a “do while(TRUE)” will never exit and without the unreachable line you get an error saying that not all code paths return a value. And because llGetListLength is said to be computationally expensive. And because LSL does let you use negative indices (roughly) on lists!

This works in both Second Life and OpenSim, because the scripting languages are extremely compatible for obvious reasons.

Many, many, implementations of this same algorithm no doubt exist all over the place :) but this is mine, for the moment and for what it’s worth!

Spennatrix is OP

I have been in Second Life a bit more in the last few months doing random things, as well as being in Kitely contributing to Karima Hoisan’s amazing builds (“worlds”, they call them in Kitely). But I’ve also been in World of Warcraft even more (hey, there’s a new expansion out!) so I’m going to talk about that here instead. Who knows, if I get used to writing in weblogs again, maybe it’ll occur to me to write some original words about SL again eventually!

(For instance maybe about how it was kind of fun figuring out Bakes on Mesh and having a full mesh head and body for Girl Dale, but that having done it all there doesn’t really seem to be any point outside of like better-looking joints in swimsuit photos.)

Spennix the Rogue has been max-level (which is 60 again now; shades of Classic!) for a little while now, and it’s been pretty fun. She’s rather squishy, as I’ve resigned myself to rogues being, with of course the somewhat compensating advantage of being very good at sneaking and vanishing and running away and stuff. So, good for exploration. She is in the Night Fae Covenant, mostly because I thought the “running around fast as a glowy animal” thing sounded like fun and more in-character than the other covenants. The damage ability seems to do a little extra damage, but nothing amazing.

For variety, I also leveled Spenax the Affliction Warlock a bit, up to 57 as of this writing. They have this nice mechanic where when your second and subsequent characters arrive at the main part of the expansion, you have a choice between going through all the introductory storylines introducing the covenants one at a time and all, or you can go straight to choosing one and then flitting around all the various areas levelling. I chose the latter for Spenax, and the Venthyr seemed aesthetically appropriate for a Warlock. The Door of Shadows ability is fun, and the damage ability, again, seems to do maybe a little extra damage.

A snappily-dressed female Night Elf Holy PriestThen I decided to focus and to some higher-stress stuff, so I’ve been leveling Spennatrix the Holy Priest, including actually healing instances, which is stressful because if you mess up the party dies, and if the tank messes up the party dies and blames you. (I’m sure tanks say the same thing about healers.) But it sure is quicker than just questing around, and the dungeon-queue wait times are like two minutes tops for a healer. So Spennatrix is 59 going on 60 as of this writing. She joined the Kryian Covenant because of course she did (they’re so pure and earnest that they are going to turn out to be bad guys, right?), and the non-combat “weird little owl guy with a baby voice brings you a potion” ability is amusing. But the combat ability? Well, holy shirtballs!

I mean, I may be pretty bad at party healing (or maybe I’m pretty good, I’m not sure; so much depends on the tank and how bad the DPS are about standing in pools of stuff), but for solo’ing around, a Kyrian Holy Priest is totally OP. (OverPowered, that is, not Original Post{er}.)

Long, long ago, in say Ashenvale, poor Spennatrix would wince at the site of, say, a bear, because they tended to do damage faster than she could heal, if she was going to get in any damage herself and therefore kill the bear before running out of mana.

But now! Need to do damage? We have Smite and Holy Fire. We also have Holy Word; Chastise, which is not only a nice chunk of damage but also a good interrupt and a decent stun, and it comes around so often on the guitar that we can just use it for a little extra damage without worrying about wasting the interrupt part, because it’ll be back soon. We also have miscellany like Holy Nova for an area effect, and that star thingie which does both damage and healing in a line out of front of one, and then again on the way back.

(All priests apparently also have Shadow Word: Pain and Shadow Word: Death. Spennatrix does not use these. Ever.)

Worried about taking damage? We have Power Word: Shield (which we didn’t for awhile, but now we do again) which makes the first N owches of damage just not count, and we can self-cast it every like 15 seconds. And if we do take damage, we have small fast heal, and big slow heal, and “heal that person and then jump to whoever else needs it the most”, and a Heal Over Time, and a “heal the whole party with pretty graphical effects”, and “heal this person and everyone near them”, and “heal this person an enormous amount if it’s available, and since its cooldown reduces with every small fast heal you cast, it probably is”, and… and… and…

And then there’s the Kyrian thing, Boon of the Ascended, which can be used every three minutes, and basically turns you into this unstoppable damage and healing vortex for ten seconds, with both direct and area damage, all kinds of healing as a side effect, and a big boom at the end that takes care of most of whatever difficulties survived until then.

Spennatrix is no longer worried about bears. Especially the first bear that’s tried to mess with her in the last three minutes.

(And then there are little perks like Levitate, which is an any-time “no worries about falling” thing, as long as you don’t need to steer, and Fade and/or Shadowmeld, which are not as good for sneaking as a rogue’s Stealth, but still very handy.)

None of this helps (enough) in a dungeon with a squishy headlong tank and DPSes that stand in boiling blood, but it’s definitely easier to solo around than I remember!

Update: Ding 60! :)