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

From Second Life Wiki
Jump to navigation Jump to 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

Script Time!
The Script has a script time around ~0.003 ms.

<lsl> /*

   *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;

Request() {

   Display_name_query = llRequestDisplayName(User_key);
   User_name_query = llRequestUsername(User_key);
   Online_status = llRequestAgentData(User_key, DATA_ONLINE);

}

default {

   state_entry()
   {
       User_key = llGetOwner();
       llSetTimerEvent(120); // 60 - 120 sec. empfohlen
       Request();
   }
   timer()
   {
       Request();
   }
   dataserver(key queryid, string data)
   {
       if(Display_name_query == queryid)
       {
           User_displayname = data;
       }
       if(User_name_query == queryid)
       {
           User_name = data;
       }
       if(Online_status == queryid) 
       {
           if(data == "1") 
           {
               llSetText("DisplayName: " + User_displayname +
                         "\nUserName: " + User_name +
                         "\nUserKey: " + (string)User_key +
                         "\nONLINE", <0,1,0>, 1);
           }
           else
           {
               llSetText("DisplayName: " + User_displayname +
                         "\nUserName: " + User_name +
                         "\nUserKey: " + (string)User_key +
                         "\nOFFLINE", <1,0,0>, 1);
           }
       }
   }
   touch_start(integer num_detected)
   {
       llInstantMessage(llDetectedKey(0),"secondlife:///app/agent/" + (string)User_key + "/about");
   }
   on_rez(integer st)
   {
       llResetScript();
   }

} </lsl>

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

you see with this by touch all your names.

<lsl> 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 st)
   {
       llResetScript();
   }

} </lsl>