Online Indicator with Email and IM

Thread Started By steadymobbin

1736
0
  • 35 Vote(s) - 2.97 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rate Thread
#1
PHP Code:
key kQuery;
integer iLine;
integer listener;
list 
AvKeys;
string Display;
integer ON TRUE;
integer i;
integer newsum;
integer oldsum;
integer Dlisten;
integer DFlag;
key name_q;
key online_q;
key KeyNow;
key user;
string status;
string owner1 "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
string owner2 "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
string email_address "email@yahoo.com";
string email_address1 "email@gmail.com";

default 
{
    
state_entry() 
    {
        if (
llGetInventoryNumber(INVENTORY_NOTECARD) > 0)
        {
            
iLine 0;
            
kQuery llGetNotecardLine(llGetInventoryName(INVENTORY_NOTECARD,0), iLine);
        }
        else
        {
            
llOwnerSay("The UUID notecard is missing from this device.");
        }
    }
    
    
on_rez integer startup)
    {
        
llResetScript();
    }
    
    
changed (integer change)
    {
        if (
change CHANGED_INVENTORY)
        {
            
llResetScript();
        }
    }
 
    
dataserver(key query_idstring data
    {
        if (
query_id == kQuery
        {   
            if (
data != EOF
            {
                
key newkey = (key)llStringTrim(dataSTRING_TRIM);
                if (
newkey)
                {
                    
AvKeys += newkey;
                    
iLine++; 
                    
kQuery llGetNotecardLine(llGetInventoryName(INVENTORY_NOTECARD,0), iLine);
                }
                else
                {
                    
llOwnerSay "Invalid key in the notecard: \"" + (string) newkey "\".  Initialization cancelled.");
                }  
            }
            else
            {
                
state running// Finished reading UUIDs from notecard
            
}
        }
    }
}

state running
{
    
state_entry()
    {
        
llSetColor(<0,1,0>, 5);
        
DFlag TRUE;
        
llSetTimerEvent(10);
    }
    
    
on_rezinteger startup)
    {
        
llResetScript();
    }
    
    
timer()
    {
        
llSetText(Display,<1,1,1>,1.0DFlag);
        if (
oldsum != newsum)  // Notify owner of any change in online status
        
{
            
llInstantMessage(llGetOwner(),"Online Status Change \n" Display);
        }
        
Display "";
        
0;
        
KeyNow = (key)llList2String(AvKeys,0);
        
name_q llRequestAgentData(KeyNow,DATA_NAME);
        
oldsum newsum;
        
newsum 0;
    }
    
    
dataserver(key querystring data)
    {
        
string name;
        
string status;
        if(
name_q == query)
        {
            
name data;
            
Display += name;
            
online_q llRequestAgentData(KeyNow,DATA_ONLINE); 
        }
        else if (
online_q == query)
        {
            
            
//status = (string)data;
                
if (data == "0")
                {
                
status "Offline";
                }
                else if (
data == "1")
                {
                
status "Online";
                }
                
//llSay(0,(string) status);
            //newsum  += status;
            
Display += " : " +(string) status "\n";
            if ( ++
<= llGetListLength(AvKeys) )
            {
                
KeyNow = (key)llList2String(AvKeys,i);
                
name_q llRequestAgentData(KeyNow,DATA_NAME);
            }
        }
    }
    
    
touch_start(integer total_number)  // Switch timer ON/OFF, activate dialog options
    
{
         
llListenRemove(listener);//A previous user may not have responded. Make sure we don't leak!
        
integer channel = ~(integer)llFrand(1000.0);
        
listener llListen(channel,"","","");
        
user llKey2Name(llDetectedKey(0));
        
llTextBox(llDetectedKey(0),"Type a message here",channel);
    }
    
    
listen (integer channelstring namekey idstring message)
    {
        if (
status "Online")
        {
            
llInstantMessage(owner1, (string) user +" says "message);
            
llInstantMessage(owner2, (string) user +" says "message);
        }
        else if (
status "Offline")
        {
           
llEmailemail_address"Email Subject", (string) user " sent this message \n\n\n"message);
        
llEmailemail_address1"Email Subject", (string) user " sent this message \n\n\n"message);
       
        }
        
llListenRemove(listener);
    }
    
    
changed (integer change)
    {
        if (
change CHANGED_INVENTORY)
        {
            
llResetScript();
        }
    }

[Image: guns-bullet-shirt_recreated.jpg]
Reply




Possibly Related Threads…
Thread Author Replies Views Last Post
  ONLINE INDICATOR AND PAGER steadymobbin 0 1,708 02-18-2013, 02:23 AM
Last Post: steadymobbin

Forum Jump:

1 Guest(s)
Share this:

About Second Life Copybot

Second Life CopyBot Forum is a place where you can get items for Second Life and other vitual worlds for free. With our CopyBot viewers you can export and import any content from these virtual worlds and modify them in 3D software such as Blender, 3D studio Macx etc...