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

From Second Life Wiki
< User:Daemonika Nightfire
Revision as of 11:18, 7 April 2022 by Gwyneth Llewelyn (talk | contribs) (Replaced <source> with <syntaxhighlight>, corrected some formatting, did some spell-checking on the English translation (and added Umlauts for the German text!))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

*DS* Display-/Username Online Indicator

by Daemonika Nightfire (daemonika.nightfire)

This simple hovertext-based script can be used by shop owners in Second Life to publicly display their current Display Name and username.

It additionally shows the avatar's user key and online status.

Furthermore, on clicking the object with this script, it will show an URL that opens the owner's profile.

This gives your customers more security that they're buying from the right vendor.

This script can be freely used and altered.

It is not worthwhile to sell it, because I distribute it for 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 öffentlich anzuzeigen.
    Zusätzlich zeigt des den Userkey und Online Status an.
    Weiterhin gibt es bei click einen Chatlink aus, der das BesitzerProfil öffnet.
    
    Dieses Script darf frei verwendet und verändert 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|recommended
    }

    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

When touched, the object with this script will show all your names (Display Name, username, avatar key, etc.).

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();
    }
}