Advertisement
Dorex

Untitled

Sep 29th, 2023
1,473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //##############################################################################
  3. //
  4. // Get Avatars Online Status
  5. // Listens on channel 6 for a name to be entered, then reports that av's online status
  6. //
  7. // Dorex Delicioso 2023
  8. //
  9. // YouTube: https://www.youtube.com/@SecondLifeSimplyScripting
  10. // Marketplace: https://marketplace.secondlife.com/stores/173632
  11. //
  12. //##############################################################################
  13.  
  14. integer DODEBUG = TRUE;
  15.  
  16. // ############################## CONSTANTS ####################################
  17.  
  18.  
  19.  
  20. // ############################## VARIABLES ####################################
  21.  
  22. key avatarId;
  23.  
  24. key name_key_query;
  25. key status_request;
  26.  
  27. // ############################## FUNCTIONS ####################################
  28.  
  29. init(){
  30.     llListen(6, "", llGetOwner(), "");
  31. }
  32. // ############################## DEBUG FUNCTIONS ##############################
  33.  
  34. sayDebug(string text){ if (DODEBUG) llOwnerSay(text);}
  35.  
  36. // ############################## DEFAULT STATE ##############################
  37. // ############################## DEFAULT STATE ##############################
  38. // ############################## DEFAULT STATE ##############################
  39.  
  40. default
  41. {  
  42.     on_rez(integer start) {
  43.         init();
  44.     }
  45.  
  46.     state_entry()
  47.     {
  48.         init();
  49.     }
  50.  
  51.    dataserver(key queryid, string data)
  52.    {
  53.        if ( name_key_query == queryid )
  54.        {
  55.            status_request = llRequestAgentData((key)data, DATA_ONLINE);
  56.  
  57.        } else if (queryid == status_request){
  58.  
  59.             if ((integer)data == 0){
  60.                 llOwnerSay("Offline");
  61.             } else {
  62.                 llOwnerSay("Online");
  63.             }
  64.        }
  65.    }
  66.  
  67.     listen(integer channel, string name, key id, string message)
  68.     {
  69.         if (channel == 6){
  70.             name_key_query = llRequestUserKey(message);
  71.         }
  72.     }
  73.  
  74.     timer()
  75.     {
  76.     }
  77.  
  78.     changed(integer change)
  79.     {
  80.         if(change & (CHANGED_OWNER | CHANGED_INVENTORY))
  81.             llResetScript();
  82.     }
  83.  
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement