Difference between revisions of "Describe Chatter"

From Second Life Wiki
Jump to navigation Jump to search
m (→‎Code: link back with this page)
(Your account can be credited money without having payment info; payment info can be removed from the account after using it.)
Line 3: Line 3:
= Introduction =
= Introduction =


Your avatar in second life is differently anonymous than yourself in real life. Any other avatar and any thing can ask what your avatar's legal name is, what your avatar's date-of-birth is, whether real payment info is on file for your avatar, etc. The Linden servers discuss your avatar in these ways without asking you for permission and without notifying you.
Your avatar in second life is differently anonymous than yourself in real life. Any other avatar and any thing can ask what your avatar's legal name is, what your avatar's date-of-creation is, whether payment info is on file for your avatar, etc. The Linden servers discuss your avatar in these ways without asking you for permission and without notifying you.


= Sample Results =
= Sample Results =
Line 75: Line 75:
         + toPayInfoEcho(theDataPayInfoString) + "\n" + " \n"
         + toPayInfoEcho(theDataPayInfoString) + "\n" + " \n"
         + toOnlineEcho(theDataOnlineString) + "\n" + " \n"
         + toOnlineEcho(theDataOnlineString) + "\n" + " \n"
         + "---\n" + " \n"
         + "---\n" + " \n "
         ;
         ;
     vector color = <0.0, 1.0, 1.0>;
     vector color = <0.0, 1.0, 1.0>;
Line 87: Line 87:
{
{
     integer payInfo = (integer) data;
     integer payInfo = (integer) data;
     if (payInfo == 0)
     if(data & ~(PAYMENT_INFO_ON_FILE | PAYMENT_INFO_USED))
    {
         return data;
         return "Has no money";
     integer not_has = !(payInfo & PAYMENT_INFO_ON_FILE);
     }
     integer not_used = !(payInfo & PAYMENT_INFO_USED);
     else if (payInfo & PAYMENT_INFO_USED)
     string out = "Has ";
     {
     if(not_has)
        return "Has spent money";
        out += "not ";
     }
     if(not_has == not_used)//use the proper conjunction
     else if (payInfo & PAYMENT_INFO_ON_FILE)
         out += "used but does";
    {
         return "Has money";
    }
     else
     else
     {
        out += "used and does";
         return data;
     if(not_used)
     }
         out += " not";
     return out + " have payment info on file";
}
}



Revision as of 04:47, 29 October 2007

Introduction

Your avatar in second life is differently anonymous than yourself in real life. Any other avatar and any thing can ask what your avatar's legal name is, what your avatar's date-of-creation is, whether payment info is on file for your avatar, etc. The Linden servers discuss your avatar in these ways without asking you for permission and without notifying you.

Sample Results

---

J Doe

Born 2007-09-01

Has no money

Online

---

Code

// Chat to see yourself as others do
// http://wiki.secondlife.com/wiki/Describe_Chatter

key theDataNameKey;
key theDataBornKey;
key theDataPayInfoKey;
key theDataOnlineKey;

integer sendableKeyings = 4;
integer receivedKeyings;

string theDataNameString;
string theDataBornString;
string theDataPayInfoString;
string theDataOnlineString;

// Say why chat with this script

startup()
{
    scrubKeys();
    llOwnerSay("You chat at the mirror, mirror, on the wall ...");
    list lines = [llGetObjectName(), llGetObjectDesc()];
    string label = llDumpList2String(lines, "\n---\n");
    llSetText(label, <1.0, 1.0, 1.0>, 1.0);
}

// Forget old chat

scrubKeys()
{
    llSetText("", <0.0, 0.0, 0.0>, 1.0);
    
    theDataNameKey = NULL_KEY;
    theDataBornKey = NULL_KEY;
    theDataPayInfoKey = NULL_KEY;
    theDataOnlineKey = NULL_KEY;
    
    receivedKeyings = 0;    
}

// Float an image of the chatter above the object

receiveKeys()
{
    string text = ""
        + "---\n" + " \n"
        + theDataNameString + "\n" + " \n"
        + "Born " + theDataBornString + "\n" + " \n"
        + toPayInfoEcho(theDataPayInfoString) + "\n" + " \n"
        + toOnlineEcho(theDataOnlineString) + "\n" + " \n"
        + "---\n" + " \n "
        ;
    vector color = <0.0, 1.0, 1.0>;
    float opacity = 1.0;
    llSetText(text, color, opacity);
}      

// Convert to string from PAYMENT_INFO

string toPayInfoEcho(string data)
{
    integer payInfo = (integer) data;
    if(data & ~(PAYMENT_INFO_ON_FILE | PAYMENT_INFO_USED))
        return data;
    integer not_has = !(payInfo & PAYMENT_INFO_ON_FILE);
    integer not_used = !(payInfo & PAYMENT_INFO_USED);
    string out = "Has ";
    if(not_has)
        out += "not ";
    if(not_has == not_used)//use the proper conjunction
        out += "used but does";
    else
        out += "used and does";
    if(not_used)
        out += " not";
    return out + " have payment info on file";
}

// Convert to string from DATA_ONLINE

string toOnlineEcho(string data)
{
    integer online = (integer) data;
    if (!online)
    {
        return "Not online";
    }
     return "Online";
}

// Receive an image of the chatter

catchKey(key queryid, string data)
{
        if (queryid == theDataNameKey)
        {
            theDataNameString = data;
        }
        else if (queryid == theDataBornKey)
        {
            theDataBornString = data;
        }        
        else if (queryid == theDataPayInfoKey)
        {
            theDataPayInfoString = data;
        }
        else if (queryid == theDataOnlineKey)
        {
            theDataOnlineString = data;
        }
}

// Ask to receive an image of the chatter in pieces

sendKeys(key who)
{
    theDataNameKey = llRequestAgentData(who, DATA_NAME);
    theDataBornKey = llRequestAgentData(who, DATA_BORN);
    theDataPayInfoKey = llRequestAgentData(who, DATA_PAYINFO);
    theDataOnlineKey = llRequestAgentData(who, DATA_ONLINE);
}

// For each reset ...

default
{

    // Listen to all ordinary chat
     
    state_entry()
    {
        startup();
        llListen(0, "", NULL_KEY, "");
    }
    
    // Ask to receive an image of the chatter in pieces
    
    listen(integer channel, string name, key id, string message)
    {
        if (llGetAgentSize(id) != ZERO_VECTOR)
        {
            scrubKeys();
            sendKeys(id);
        }
    }
    
    // Receive every piece of an image of the chatter
    
    dataserver(key queryid, string data)
    {        
        catchKey(queryid, data);   
        receivedKeyings += 1;
        if (receivedKeyings == sendableKeyings)
        {
            receiveKeys();
        }        
    }

}

Instructions

Add the script to an object and start chatting with a friend. See the object remember who chatted last.

See Also

Functions

llRequestAgentData - ask to receive an image of an agent, such as a chatter, in pieces