Top Free Scripts
Script ID : 31
Audience : Default
Version 1.00.01
Published Date: 2009/5/28 4:42:50
Reads : 11356
Agent/Avatar

When Touched displays Toucher's profile picture on prim.


TIP: Use the script in other ways. This gets the av key by touch, but you can also get it using llGetOwner, sensor, collision, or others and display their image.

Note: Replaced with version not by Alicia Stella November 2009 for workaround for WEB-1384.

// Snippets and HTTPRequest bits were taken from:
//~ RANDOM PROFILE PROJECTOR v5.4.5 by Debbie Trilling ~
 
// Get Profile Picture by Valentine Foxdale
// optmisation by SignpostMarv Martin
// workaround for WEB-1384 by Viktoria Dovgal, use meta tag instead of img since it comes earlier
list sides;
list 
deftextures;
integer s1l// calculated from profile_key_prefix in state_entry()
string profile_key_prefix "<meta name="imageid" content="";
GetProfilePic(key id) //Run the HTTP Request then set the texture
{
    //key id=llDetectedKey(0); This breaks the function, better off not used
    string URL_RESIDENT = "
http://world.secondlife.com/resident/";
    
llHTTPRequestURL_RESIDENT + (string)id,[HTTP_METHOD,"GET"],"");
}
GetDefaultTextures() //Get the default textures from each side
{
    
integer    i;
    
integer    faces llGetNumberOfSides();
    for (
0facesi++)
    {
        
sides+=i;
        
deftextures+=llGetTexture(i);
    }
}
SetDefaultTextures() //Set the sides to their default textures
{
    
integer    i;
    
integer    faces;
    
faces llGetNumberOfSides();
    for (
0facesi++)
    {
        
llSetTexture(llList2String(deftextures,i),i);
    }
}
default
{
    
state_entry()
    {
        
s1l llStringLength(profile_key_prefix);
        
llSetText("Touch for this object to display your profile picture!",<0.8,0,1>,1); 
        
//Note: Usage of another person's profile picture without their permission may be viewed as copyright infringement. 
        
GetDefaultTextures();
    }
    
touch_start(integer total_number)
    {
        
GetProfilePic(llDetectedKey(0));
    }
    
http_response(key req,integer stat, list metstring body)
    {
        
integer s1 llSubStringIndex(body,profile_key_prefix);
        if(
s1 == -1){SetDefaultTextures();}
        else
        {
            
s1 += s1l;
            
key UUID=llGetSubString(bodys1s1 35);
            if (
UUID == NULL_KEY) {
                
SetDefaultTextures();
            }
            else {
                
llSetTexture(UUID,ALL_SIDES);
            }
        }
    }
}

0
|  Links 
Printer Friendly Page Send this Script to a Friend
Search for Help
New Product
Free Item
Sponsor

Site Info
Total Hits