Why all those profile-image display things broke

Here is a fact about LSL, the Linden Scripting Language that drives so many clever and wonderful (and also boring and annoying) things in second Life:

There is no LSL function to allow a script to get or display the profile picture associated with a random Resident’s profile.

But, but, I hear you say, what about all those profile-pic boards in stores and clubs and things that display the profile pics of random vistors (sometimes after asking you for your permission, sometimes not). What about them?

Ah, I reply, those work by some clever hacks, using LSL’s ability to read web pages in order to read some stuff from pages off the web and, in a way that usually happens to work, infer from that the ID of the texture that is the profile pic of a given Resident, which can then be displayed on the face of a prim.

And note the “usually happens to work” in the above. As is clear from a recent JIRA entry, it doesn’t always work, and in fact it has recently stopped working, mostly or somewhat, in various ways.

The Hack

First, I will natter on a bit about the clever trick that’s used to display profile images. I was amazed when I first saw one, because I knew very well there was no direct LSL “get me the profile image for resident XYZ” function (although it’d be nice if there were).

On the other hand, there is an afaik little-known Web copy of Resident profiles and various other things, on the host world.secondlife.com. I don’t know how you get to them via the Web normally, from say the main SL website, but I do know that if you stick the ID of any Resident who hasn’t turned off “show in search” on their profile, after the URL stem “http://world.secondlife.com/resident/”, you’ll find the Web copy of their profile.

For instance, my SL ID is 8a123731-b0cb-47e7-90c0-6ed49aeaff58, and so if you follow this link you will find the Web copy of my profile.

On that Web copy of my profile there is a Web copy of my profile pic (aren’t I attractive?). If you look at the HTML for the page, or otherwise ask your browser nicely, it will reveal that the URL of the image is something like:


Now that “48cc” thing there looks like an ID itself, and in fact it is, and if you stick a script into a prim that says:


that fortunate prim will be covered by my profile pic.

And now, since LSL does contain a function for reading web pages (well, to be strictly accurate, for reading the first 2048 characters of web pages), it seems that once a script has a Resident’s key (which is easy to get if the Resident is anywhere nearby), it can fetch the Resident’s Web profile page, read that to find the image URL of their profile pic, extract just the key part, and stick it on one or more faces of a prim for display. (Assuming that the image key is always in a recognizable place, and always in the first 2048 characters of the page.)

And that is in fact exactly how they work!

And that “assuming” there is exactly why they recently stopped working. :)

The Breakage

There were actually two reasons these scripts stopped working: first the Lindens did something wrong in their firewall rules or something, and scripts couldn’t get to world.secondlife.com at all to load the profile pages. That seems to have been mostly fixed now, although it’s still happening here and there.

But more fatally, the Lindens also added lotsa juicy shiny fancy eyecandy HTML to the Web profile pages, and that pushed the image URLs out past the 2048 limit, so that scripts couldn’t get them anymore. Whoever made the change seems to have realized that it might cause problems, or just generally got an attack of neatness, because they also added a brand-new line, near the top of the HTML, explicitly giving the key for the Resident’s profile pic, as in:

<meta name=”imageid” content=”48cc0f84-7f35-3013-c05d-eb05237942f7″ />

This is easier to find and read than the messier HTML down where the image is actually loaded, but still it is different, and while it’s easy to change a profile-pic script to read the new one instead of the old one if you happen to be a scripter with some HTML knowledge and the ability to change the script, there are still dozens upon thousands of already-purchased and already-deployed devices out there whose scripts are now broken.

Is this a Horrible Linden Crime? I don’t think so, really. Anyone who wrote a script that depended on this trick would have known they were using an unsupported interface, and that it might fail at any time. As I wrote on the Jira:

For the people who are complaining that they bought things that have stopped working, you should probably complain to the people you bought them from, rather than to the Lindens. And to the people who are complaining that they sold something that then broke, you knew that could happen when you coded to a completely undocumented and unsupported interface.

It’s nice of the Lab to be working on fixing it, but you know very well that they don’t have to.

If you write a script that only works as long as there’s a “q” in column 17 of line 147 of http://www.secondlife.com/, you have only yourself to blame when someday that q changes…

I do hope and expect that the Lab will fix this, and it’s certainly good customer service for them to do so. On the other hand, people who are getting all angry at the lab and acting as though some actually supported interface was needlessly broken… Well, get a grip. :)

And if that seems a little snooty, I also posted a code snippet showing how to fix at least one popular script, and suggested to the Lindens a way that they could extend that “meta” tag a bit to restore at least many of the existing scripts that look for the full image URL to working order again.

’cause I am awesome that way. :)

So that is the current inneresting little story of the broken profile-pic displayers. And if you happen to have a broken profile-pic script (that you can see and edit the code inside of!), and you are one of the first N people to ask me (where N is the point at which I become overwhelmed and run away), I’d be glad to suggest how you might fix it. Just drop me an IM!

Update: According to a previous JIRA, the Lab did do pretty much exactly my backward-compatibility suggestion (before I’d even made it!), back in December. But apparently someone undid it recently. So, hem hem, I’m sure it’ll be fixed any minute now…

New random project: Region Mapper

Snapshot of Hughes Rise, as of 2009/03/31So on a complete whim and for no reason that I know of (possibly related to the whole mainland aesthetics discussion), I decided to write a little script that would list all the parcels in a region, in some sort of map-like form.

I had all sorts of techie ideas in my head about little survey ‘bots that would fly around 200m above the ground, communicating to a central controller using llRegionSay() and all, but I was disappointed. :) Turns out llGetParcelDetails() has no range-limit (within the current sim), so a script just sitting under a tree in the Park can see the name and description of every parcel in the Rise.

Here’s the output from my current script (with the longer strings trimmed to fit on the page):

Hughes Rise:
000 000 000 000 001 001 001 001 002 002 003 004 005 005 006 006
000 000 000 000 001 001 001 001 002 002 003 007 007 005 006 006
000 000 000 000 001 001 001 001 008 008 009 007 007 005 005 006
000 000 000 000 001 001 001 001 008 008 009 010 010 010 005 006
011 011 011 011 012 012 013 013 014 014 015 016 010 010 005 005
011 011 011 011 017 018 019 020 014 014 015 016 010 010 021 005
011 011 011 011 017 018 019 020 009 009 022 022 010 010 021 005
011 011 023 023 023 023 020 020 020 024 024 024 024 025 024 002
026 026 023 023 023 023 020 020 020 024 024 024 024 025 024 002
026 026 023 023 023 023 020 020 027 027 024 024 024 024 024 024
028 028 023 023 023 023 029 029 030 031 024 024 024 032 032 024
028 028 033 033 033 033 029 029 030 031 024 024 024 032 032 024
028 028 033 033 023 023 029 029 034 034 035 035 036 037 038 038
039 039 033 040 040 040 023 023 041 041 042 042 036 037 038 038
043 043 044 044 045 045 023 023 046 046 047 047 036 036 036 048
043 043 043 043 045 045 023 023 049 049 050 050 036 036 036 048

000: free resell freebie store full perm: somethings are free , …
001: Computer Land:
002: Hughes Rise :
003: : My first house
004: Galaxy Design: Primland
005: Protected Land: Protected Land
006: Hughes Rise (25,224) Mature 1600m:
007: Galaxy Design real estate – Hughes Rise 6: Flat green land …
008: oms studio 2:
009: The Camel’s Prim Farm:
010: Sadie’s Dyke Bar & Butch Store: Quiet hangout. Dressing room, …
011: Abandoned Land: Land abandoned by My World! (group) on 28-Jan-2009
012: Land ID:21088 (B.O.S) Hughes Rise, Green grassy flat land: Rent …
013: Land ID:21089 (B.O.S) Hughes Rise, Green grassy flat land: Rent …
014: Abandoned Land: Land abandoned by Ash Alecto on 14-Dec-2008
015: Abandoned Land: Land abandoned by Errol Bazar on 09-Oct-2008
016: Himmis Kleines Eckchen ;):
017: Land ID:21087 (B.O.S) Hughes Rise, Green grassy flat land: Rent …
018: Land ID:21086 (B.O.S) Hughes Rise, Green grassy flat land: Rent …
019: Land ID:21085 (B.O.S) Hughes Rise, Green grassy flat land: Rent …
020: Microparadise: Some Land! Woooot!
021: Ad-Vatar and The Question Center: Dr. Destiny
022: Abandoned Land: Land abandoned by Cricket Zipper on 31-Dec-2008
023: Workshop More Prim Farm:
024: Workshop Prim Farm: Workshop Prim Farm
025: Hughes Rise – First Land: Land For The Landless
026: =Hughes Rise=: objects included
027: La’s Tipi: Keep Out
028: Julie’s Place: Julie’s Place
029: Hughes Rise Park, upper section:
030: Dale Inis random Hughes Rise land:
031: oms studio 1:
032: Jilly and om’s Japanese tryst:
033: Bippie’s Home: Bippie and Halo’s home. Friends welcome. IM one …
034: Gray Estates Part Deux:
035: My Secret Hideaway: Sometimes you want to go, where nobody …
036: Sweetwater Retreat (240,232) Mature 1536m:
037: Hughes Rise: Hughes Rise
038: Heavenly Bodies Tattoos & Shapes: Tattoo, Tattoos, Shapes, …
039: Scott’s Seat lowlands:
040: AVATARS AVATARS,Batman,Pooh Bear,Star Wars,Betty Boop, …
041: Hughes Rise (216,145) Mature 512m:
042: DAT LAND:
043: Scott’s Seat: Land in the Mist
044: MeadowSide: Portal to Happiness
045: Workshop: Wherever you go etc.
046: Marqs Gettaway:
047: Workshop Annex: Workshop Annex
048: AI WorkShop: AI Skybox Workshop
049: Abandoned Land: Land abandoned by bWhittl Kips on 08-Jan-2009
050: A Garden : Murasaki Suisei

The map is upside-down, I think, and possibly backwards. And/or sideways. Also it’s numbers instead of some nice visual.

The next thing I’m thinking of is learning enough SVG to produce a more map-like map, with boundaries drawn as lines and all, from the same data (a strictly inworld prim-based version would also be possible, but would probably require quite a few prims). I may or may not ever get around to doing that. :) I might also throw the script into the Wiki at some point, if I think it’s reached the point of non-triviality.

It would also be fun to overlay the parcel map on top of the visual maps that the Second Life API makes available (like the one at the top of the posting there; click through for the API version). Clever SVG might be able to do that also. If anyone knows of anyone else doing anything like any of this, send email or post a comment!

And then I’m still planning a posting about inworld Profile Displayers, which I have a picture all taken for and more or less know what the words will say, but have just not gotten around to. Busy, busy…