Difference between revisions of "Profile Picture"

From Second Life Wiki
Jump to navigation Jump to search
m (Replaced <source> with <syntaxhighlight>; added to the Pr)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
Use this script to get user's profile picture UUID and diplay it in-world.
{{LSL Header}}
 
Use this script to get user's profile picture UUID and display it in-world.


=== Usage ===
=== Usage ===
Line 6: Line 8:


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


Line 31: Line 33:
     }
     }
}
}
</lsl>
</syntaxhighlight>
---
---
[[Category:LSL Library]]

Latest revision as of 11:11, 26 February 2024

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); 
    }
}

---