Difference between revisions of "Get Profile Picture"
Jump to navigation
Jump to search
m (Fixed lsl tags) |
|||
Line 49: | Line 49: | ||
http_response(key req,integer stat, list met, string body) | http_response(key req,integer stat, list met, string body) | ||
{ | { | ||
integer | integer s1 = llSubStringIndex(body,"<img alt=\"profile image\" src=\"http://secondlife.com/app/image/"); | ||
integer s1l = llStringLength("<img alt=\"profile image\" src=\"http://secondlife.com/app/image/"); | |||
integer s2 = llSubStringIndex(body,"\" class=\"parcelimg\" />")-3; | |||
s1l = llStringLength("<img alt=\"profile image\" src=\"http://secondlife.com/app/image/"); | |||
s2 = llSubStringIndex(body,"\" class=\"parcelimg\" />")-3; | |||
if(s1 == -1){SetDefaultTextures();} | if(s1 == -1){SetDefaultTextures();} |
Revision as of 10:14, 19 April 2009
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Get Profile Picture by Valentine Foxdale
<lsl>
// Snippets and HTTPRequest bits were taken from:
//~ RANDOM PROFILE PROJECTOR v5.4.5 by Debbie Trilling ~
// Get Profile Picture by Valentine Foxdale list sides; list deftextures; GetProfilePic(key id) //Run the HTTP Request then set the texture {
key id=llDetectedKey(0); string URL_RESIDENT = "http://world.secondlife.com/resident/"; llHTTPRequest( URL_RESIDENT + (string)id,[HTTP_METHOD,"GET"],"");
} GetDefaultTextures() //Get the default textures from each side {
integer i; integer faces; faces = llGetNumberOfSides(); for (i = 0; i < faces; i++) { sides+=i; deftextures+=llGetTexture(i); }
} SetDefaultTextures() //Set the sides to their default textures {
integer i; integer faces; faces = llGetNumberOfSides(); for (i = 0; i < faces; i++) { llSetTexture(llList2String(deftextures,i),i); }
} default {
state_entry() { GetDefaultTextures(); } touch_start(integer total_number) { GetProfilePic(llDetectedKey(0)); } http_response(key req,integer stat, list met, string body) { integer s1 = llSubStringIndex(body,"<img alt=\"profile image\" src=\"http://secondlife.com/app/image/"); integer s1l = llStringLength("<img alt=\"profile image\" src=\"http://secondlife.com/app/image/"); integer s2 = llSubStringIndex(body,"\" class=\"parcelimg\" />")-3; if(s1 == -1){SetDefaultTextures();} else { key UUID=llGetSubString(body,s1+s1l,s2); llSetTexture(UUID,ALL_SIDES); } }
} </lsl>