Jump to content

Listen Event For Profile Pic


2toe Bigboots
 Share

You are about to reply to a thread that has been inactive for 4414 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello im trying to mod a script i have. I displays your profile pic when you touch it, ive changed it a lot so that it listens on a channel for ANY chatter instead. I cant seem to get it to display the profile pic thou i get this error 

 "HuD: Could not find texture '" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<title>δι 2Toe (2toe.bigboots)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />"
Now heres the script im using.
// Credit goes to Jana Kamachi/Solar Alter
// for discovering this concept first 
// and taking it beyond just displaying the profile picture
// see http://forums.secondlife.com/showthread.php?t=225460
// and https://wiki.secondlife.com/wiki/User:Jana_Kamachi/Profile
// for further information

string RESIDENT_URL = "http://world.secondlife.com/resident/";
key WHITE_DEFAULT_TEXTURE = "35e1e0c9-c6cd-76ea-3c44-4f25effaec62";
integer DIALOG_CHANNEL = 10;
string DIALOG_MSG = "By hitting the I Agree button below, you give permission for this script to access your profile texture UUID.";
list KILLJOY_MENU = ["I Agree", "I Disagree"];
integer Dialog_Handle;
string profile_pic;
default
{
    
    state_entry()
    {
        llSetText("", <1,0,0>, 1.0); // Erase hover text
        llSetTexture(WHITE_DEFAULT_TEXTURE, ALL_SIDES); // Set to default texture
        llListen(321,"","","");
    }
    

    listen(integer channel, string name, key id, string message)
    {
        
        { 
            llHTTPRequest( RESIDENT_URL + (string)id,[HTTP_METHOD,"GET"],"");
            llSetText(name, <1,0,0>, 1.0); // Display avatar name as hover text
        }
       
    }
    
    on_rez(integer start_param)
    {
        llSetText("", <1,0,0>, 1.0); // Erase hover text
        llSetTexture(WHITE_DEFAULT_TEXTURE, ALL_SIDES); // Set to default texture
        
    }
    
    http_response(key request_id,integer status, list metadata, string body)
    {
 
        if (llSubStringIndex(body, "blank.jpg") == -1) // If a profile picture exists
        {
            // Find starting point of the profile picture UUID
            integer start_of_UUID = llSubStringIndex(body,"<**Only uploaded images may be used in postings**://secondlife.com/app/image/");
            // Find ending point of profile picture UUID
            integer end_of_UUID = llSubStringIndex(body,"\" class=\"parcelimg\" />") - 3;
            // Parse out profile picture UUID from the body
            string profile_pic = llGetSubString(body, start_of_UUID, end_of_UUID);
            // Set the sides of the prim to the picture
            llSetTexture((key)profile_pic, ALL_SIDES);
        }
        else
        {
            llWhisper(0, "You have no profile picture"); // Tell the avatar they have no picture
            llSetTexture(WHITE_DEFAULT_TEXTURE, ALL_SIDES); // Set to default texture
        }
    }
}

 Hope someone has a solution

Link to comment
Share on other sites

that should be the problem:

integer start_of_UUID = llSubStringIndex(body,"<**Only uploaded images may be used in postings**://secondlife.com/app/image/");

 and

string profile_pic = llGetSubString(body, start_of_UUID, end_of_UUID);

try

 

integer start_of_UUID = llSubStringIndex(body,"<meta name=\"imageid\" content=\"") + llStringLength("<meta name=\"imageid\" content=\"");

 and 

string profile_pic = llGetSubString(body, start_of_UUID, start_of_UUID + 35);

 

The pages change once in a while - what works today, may not work tomorrow.

And a little reark: The way the script is now, it's a potential offence against the ToS.

Link to comment
Share on other sites

The script is bad to begin with. If several people are chatting all you gonna get displayed is gray because the picture would be changing too fast without enough time for the texture to rez.In other words, the only pic that would be displayed for a reasonable time is the one of the last chatter before a long pause.

A professional script would store chatters id's in a list, display a picture for a certain period of time (1 min or so) and then check if there are more id's in the list to send http profile query. 

Link to comment
Share on other sites


Darkie Minotaur wrote:

[...]

And a little reark: The way the script is now, it's a potential offence against the ToS.

Yeah, that's been a concern since this script or its original version was introduceds many years ago.  That's why it contains the message

string DIALOG_MSG = "By hitting the I Agree button below, you give permission for this script to access your profile texture UUID.";list KILLJOY_MENU = ["I Agree", "I Disagree"];

Linden Lab has let the script sit in its LSL Script library for years, and it has spawned thousands of in-world display boards (many of which, regrettably, do not include the dialog choice).  The question about TOS comes up every time LL changes the format of that data string and potentially breaks all those display boards. (For example, see WEB-3510.) We hear about it in this forum for a while, and then it dies down again.  My guess is that the script is here to stay, or until LL really breaks picture profiles.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4414 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...