Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- //##############################################################################
- //
- // Get Profile Picture
- //
- // Dorex Delicioso 2023
- //
- // YouTube: https://www.youtube.com/@SecondLifeSimplyScripting
- // Marketplace: https://marketplace.secondlife.com/stores/173632
- //
- //#############################################################################
- //
- // Pass an avatar id into getProfilePic and the picture key will be sent to setProfilePicture
- //
- // ############################## VARIABLES ####################################
- key ppReqID;
- // ############################## FUNCTIONS ####################################
- //
- getProfilePic(key avId)
- {
- ppReqID = llHTTPRequest( "http://world.secondlife.com/resident/" + (string)avId, [HTTP_METHOD, "GET"], "");
- }
- setProfilePicture(key pictureKey)
- {
- llSetTexture(pictureKey, ALL_SIDES );
- }
- // ############################## DEFAULT STATE ##############################
- // ############################## DEFAULT STATE ##############################
- // ############################## DEFAULT STATE ##############################
- default
- {
- state_entry()
- {
- getProfilePic(llGetOwner());
- }
- http_response(key req,integer stat, list meta, string body)
- {
- if (req == ppReqID)
- {
- //https://wiki.secondlife.com/wiki/Profile_Picture_Retrieval
- integer index = llSubStringIndex(body,"<meta name=\"imageid\" content=\""); // Find the image in html
- key pictureKey = (key)llGetSubString(body, index + 30, index + 65); // After the search text, and for 35 chars is UUID
- if(index == -1) pictureKey = NULL_KEY; // If it wasn't found, they have no profile pic
- setProfilePicture(pictureKey);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement