Profile Picture

From Second Life Wiki
Jump to navigation Jump to search

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

Usage

Create a box, add the code and click.

  • Note that the string uuid is set on touch.

key DefaultTexture = "9d45f95d-5bb5-0f01-7b3c-29c5297ce67e";
string URL_RESIDENT = "https://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); 
    }
}

---