Profile Picture

From Second Life Wiki
Revision as of 20:13, 11 March 2011 by Jor3l Boa (talk | contribs)
Jump to navigation Jump to search

Use this script to get user's profile picture UUID and diplay it in-world.

Usage

Create a box, add the code and click.

  • Note that the string uuid is set on touch.

<lsl> key DefaultTexture = "9d45f95d-5bb5-0f01-7b3c-29c5297ce67e"; string URL_RESIDENT = "http://world.secondlife.com/resident/"; string uuid;

string meta_find = "<meta name=\"imageid\" content=\"";

default {

   on_rez(integer r)   {   llResetScript();    }
   
   state_entry()   {
       llSetTexture(DefaultTexture,2);
   }
   touch_start(integer n) {
       uuid = llDetectedKey(0);
       llHTTPRequest( URL_RESIDENT + uuid,[HTTP_METHOD,"GET"],"");
   }
   http_response(key req,integer stat, list met, string body)
   {
       integer meta_pos =  llSubStringIndex(body, meta_find) + llStringLength(meta_find);
       string texture = llGetSubString(body, meta_pos, meta_pos + 35);
       llSetTexture(texture, ALL_SIDES); 
   }

} </lsl> ---