User:Daemonika Nightfire/Scripts/DS Display-Username Online Indicator

From Second Life Wiki
Jump to: navigation, search

*DS* Display-/Username Online Indicator

by Daemonika Nightfire (daemonika.nightfire)

This simple hover text-based script is used to shop owners in Second Life, customers at the current display name and user name to display publicly. Additionally shows the status of the Userkey and online. Furthermore, there are click of a chat link that opens the profile owner.

This gives your customers more security, buy at the right vendor

This script can be freely used and altered. It is not worthwhile to sell it, because I distribute FREE!

*DS* Display-Username Online Indicator v2.1

Script Time!
The Script has a script time around ~0.003 ms.
/*
 
    *DS* Display-/Username Online Indicator
    by Daemonika Nightfire (daemonika.nightfire)
 
    Dieses einfache Hovertext Basierende Script dient dazu Shopbetreibern in Second Life,
    ihren Kunden den aktuellen Displayname & Username oeffentlich anzuzeigen.
    Zusaetzlich zeigt des den Userkey und Online Status an.
    Weiterhin gibt es bei click einen Chatlink aus, der das BesitzerProfil oeffnet.
 
    Dieses Script darf frei verwendet und veraendert werden.
    Es lohnt sich nicht es zu verkaufen, denn ich verteils FREE!
 
    LG
    Dae
 
*/
 
key User_key;
key Online_status;
key User_name_query;
key Display_name_query;
string User_name;
string User_displayname;
integer output = FALSE;
 
default
{
    state_entry()
    {
        User_key = llGetOwner();
        Display_name_query = llRequestDisplayName(User_key);
        llSetTimerEvent(120); // 60 - 120 sec. empfohlen
    }
 
    timer()
    {
        Display_name_query = llRequestDisplayName(User_key);
    }
 
    dataserver(key queryid, string data)
    {
        if(Display_name_query == queryid)
        {
            User_displayname = data;
            User_name_query = llRequestUsername(User_key);
        }
        if(User_name_query == queryid)
        {
            User_name = data;
            Online_status = llRequestAgentData(User_key, DATA_ONLINE);
            output = TRUE;
        }
        if(Online_status == queryid && output) 
        {
            string Text = "\nDisplayName: "  + User_displayname +
                          "\nUserName: "     + User_name +
                          "\nUserKey: "      + (string)User_key;
 
            if(data == "1") 
            {
                llSetText(Text + "\nONLINE", <0,1,0>, 1);
            }
            else
            {
                llSetText(Text + "\nOFFLINE", <1,0,0>, 1);
            }
            output = FALSE;
        }
    }
 
    touch_start(integer num_detected)
    {
        llInstantMessage(llDetectedKey(0),"secondlife:///app/agent/" + (string)User_key + "/about");
    }
 
    on_rez(integer Dae)
    {
        llResetScript();
    }
}

*DS* Display-/User-/Resident-Name v2.1

you see with this by touch all your names.
key User_key;
key User_name_query;
key Display_name_query;
string User_name;
string User_displayname;
integer output = FALSE;
default
{
    state_entry()
    {
        llSetText("touch me", <0.8,0.6,0.2>, 1);
    }
 
    touch_start(integer num)
    {
        User_key = llDetectedKey(0);
        Display_name_query = llRequestDisplayName(User_key);
    }
 
    dataserver(key queryid, string data)
    {
        if(Display_name_query == queryid)
        {
            User_displayname = data;
            User_name_query = llRequestUsername(User_key);
        }
        if(User_name_query == queryid)
        {
            User_name = data;
            output = TRUE;
        }
        if(output)
        {
            string Text = "\nDisplayName: "  + User_displayname +
                          "\nUserName: "     + User_name +
                          "\nResidentName: " + (string)llKey2Name(User_key) +
                          "\nUserKey: "      + (string)User_key;
 
            llSetText("touch me" + Text, <0.8,0.6,0.2>, 1);
            llSay(0,Text);
 
            output = FALSE;
        }
    }
 
    on_rez(integer Dae)
    {
        llResetScript();
    }
}