Difference between revisions of "Online Indicator"

From Second Life Wiki
Jump to: navigation, search
m
(another :p)
Line 25: Line 25:
 
click on the result and you'll find the UUID in the URL of the page. ("secondlife:/app/agent/User_key/about" or "http://world.secondlife.com/resident/User_key")
 
click on the result and you'll find the UUID in the URL of the page. ("secondlife:/app/agent/User_key/about" or "http://world.secondlife.com/resident/User_key")
  
<lsl>////////////////////////////////////////////////////////////////////////////////////////////////
+
<lsl>
 +
////////////////////////////////////////////////////////////////////////////////////////////////
 
//    Copyright (c) 2008 by Kristy Fanshaw                                                    //
 
//    Copyright (c) 2008 by Kristy Fanshaw                                                    //
 
////////////////////////////////////////////////////////////////////////////////////////////////
 
////////////////////////////////////////////////////////////////////////////////////////////////
Line 40: Line 41:
 
//    To get a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.    //
 
//    To get a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.    //
 
////////////////////////////////////////////////////////////////////////////////////////////////
 
////////////////////////////////////////////////////////////////////////////////////////////////
 
+
 
key user_key = "00000000-0000-0000-0000-000000000000";      // must be agent UUID whose status it will indicate
 
key user_key = "00000000-0000-0000-0000-000000000000";      // must be agent UUID whose status it will indicate
 
integer time = 30;                                          // time within the message should be written.
 
integer time = 30;                                          // time within the message should be written.
 
string url = "http://world.secondlife.com/resident/";
 
string url = "http://world.secondlife.com/resident/";
key blank = "5748decc-f629-461c-9a36-a35a221fe21f";
+
key blank = TEXTURE_BLANK;
 
string name;
 
string name;
 
key toucher;
 
key toucher;
 
string status;
 
string status;
+
 
 +
// VD 2009-11-24 workaround for WEB-1383, use <meta> instead of <img>
 +
string profile_key_prefix = "<meta name=\"imageid\" content=\"";
 +
integer s1l;
 +
 
 
default
 
default
 
{
 
{
Line 68: Line 73:
 
     state_entry()
 
     state_entry()
 
     {
 
     {
 +
        s1l = llStringLength(profile_key_prefix);
 
         llSetTimerEvent(10);
 
         llSetTimerEvent(10);
 
     }  
 
     }  
Line 81: Line 87:
 
     }  
 
     }  
 
     http_response(key request_id,integer status, list metadata, string body)
 
     http_response(key request_id,integer status, list metadata, string body)
     {  
+
     {
         if (llSubStringIndex(body, "profile image") != -1)
+
         string profile_pic;
         {
+
        integer s1 = llSubStringIndex(body, profile_key_prefix);
            if (llSubStringIndex(body, "blank.jpg") == -1)
+
         if (s1 == -1) {
                {  
+
            profile_pic = blank;
                    integer start_UUID = llSubStringIndex(body,"<img alt=\"profile image\" src=\"http://secondlife.com/app/image/") + llStringLength("<img alt=\"profile image\" src=\"http://secondlife.com/app/image/");
+
                    integer end_UUID = llSubStringIndex(body,"\" class=\"parcelimg\" />") - 3;
+
                    string profile_pic = llGetSubString(body, start_UUID, end_UUID);
+
                    llSetTexture((key)profile_pic, ALL_SIDES);
+
                }
+
            else
+
                {
+
                    llSetTexture(blank, ALL_SIDES);
+
                }
+
 
         }
 
         }
 
         else
 
         else
 
         {
 
         {
             llSetTexture(blank, ALL_SIDES);
+
             profile_pic = llGetSubString(body,s1 + s1l, s1 + s1l + 35);
 +
            if (profile_pic == (string)NULL_KEY)
 +
            {
 +
                profile_pic = blank;
 +
            }
 
         }
 
         }
 +
        llSetTexture(profile_pic, ALL_SIDES);
 
     }
 
     }
 
     dataserver(key queryid, string data)
 
     dataserver(key queryid, string data)
Line 125: Line 127:
 
state msg
 
state msg
 
{
 
{
    state_entry()
+
    state_entry()
 
     {
 
     {
 
         llListen(0,"",toucher,"");
 
         llListen(0,"",toucher,"");
Line 145: Line 147:
 
         state show;
 
         state show;
 
     }
 
     }
}</lsl>}}
+
}
 +
</lsl>}}
  
 
{{LSLC|Examples}}
 
{{LSLC|Examples}}
 
{{LSLC|Library}}
 
{{LSLC|Library}}

Revision as of 06:41, 24 November 2009

Copying Permission

Copyright © 2008 by Kristy Fanshaw

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

To get a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.

Online Indicator