I'm a computer science professor, data scientist, and web geek.

LSL: AOL IM Status Indicator

I think this might be my very first LSL script, from back in 2005! This script indicates whether your AIM (AOL Instant Messenger) account is online by changing the color of an object. You can configure it to either share your AIM ID publicly, or keep it private.

AIM Indicators in Second LIfe

AIM Indicators in Second LIfe

This script uses the AIM web services API to check your online status — you only need to give it your username, not your password! This is not a proxy service. You can’t send messages through this script, just show your online status in SL.

To use this script, create an object in your favorite shape, create a new script inside of it, paste this code into it and save.

key request_id;
string aim_id;
string av_name;
key data_card;
integer nLine = 0;
integer public = TRUE;
 
default
{
    state_entry()
    {
        llSetText("AIM Indicator... setting up",<1,1,1>,1);
        data_card = llGetNotecardLine("Settings",nLine); // load settings
        llSetTimerEvent(60); // check once per min
    }
 
    // reset when owner touches it
    touch_start(integer total_number) {
        if (llDetectedKey(0) == llGetOwner()) {
            llResetScript();
        }
    }
 
    // read settings from notecard
    dataserver(key query_id, string data) {
        if (query_id == data_card) {
            if (data != EOF) { // not at the end of the notecard
                if (nLine == 0) {
                    av_name = data;
                } if (nLine == 1) {
                    aim_id = data;
                } if (nLine == 2) {
                    if (data == "private") { // if they do not want their ID shared
                        public = FALSE;
                    }
                }
                ++nLine; // increase line count
                data_card = llGetNotecardLine("Settings", nLine); // request next line
            }
        }
    }
 
    timer() {
        string url = "http://api.oscar.aol.com/SOA/key=hi15uD79wuEukQTS/resource-lists/users/*anonymous*/presence/~~/resource-lists/list%5Bname=%22users%22%5D/entry%5B@uri=%22user:"+aim_id+"%22%5D";
        request_id = llHTTPRequest(url,[HTTP_METHOD, "GET"],"");
    }
 
    http_response(key req_id, integer status, list metadata, string body) {
        if (req_id == request_id) {
            list result = llParseString2List(body,["<",">","\n"],[]);
 
            // if user is online
            if (llList2String(result,24) != "http://cdn.digitalcity.com/presence/offline.gif") {
                if (public == FALSE) { 
                    llSetText(av_name+"'s AIM account is online",<1,1,1>,1);
                } else {
                    llSetText("AIM "+av_name+": "+aim_id+" is online",<1,1,1>,1);
                }
                llSetColor(llVecNorm(<160,237,160>),ALL_SIDES);
            } else { // user is offline
                llSetText(av_name+"'s AIM account is offline",<1,1,1>,1);
                llSetColor(llVecNorm(<237,160,160>),ALL_SIDES);
            }
        }
    }
}

This script is released under Creative Commons License. Have fun!

Create a notecard called “Settings” with your avatar name on the first line* and your AIM username on the second line. If you do not want your AIM username shared, put the word “private” on the third line. If you do want it shared, change the line to anything else (“public”, or even blank will do). For example:

Ann Enigma
hilm1
private

The script polls the AIM server every 60 seconds, so give it a minute to update. It will reset if the owner clicks on it.

* I’m aware that you can get the avatar name via LSL — this was my first script, be nice!

3 comments

1 Vilmir T. { 05.14.09 at 7:00 pm }

Thanks for sharing this out. I had a hard time finding good examples of gathering data online from SL.

:-)

2 heather { 08.22.09 at 5:51 am }

hi
im not sure what the aim name and the avatar name is.. arent they the same??
im having a bit of trouble.
thanxz for the script though

3 HE { 10.05.09 at 4:31 pm }

hi
im not sure what the aim name and the avatar name is.. arent they the same??
im having a bit of trouble.
thanxz for the script though

Leave a Comment