Gayngel

Check RLV status with OwnerSay

Dec 18th, 2021 (edited)
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer lchan = 5000;  // listen on channel 5000;
  2. integer llisten; // listen handle
  3.  
  4.  
  5.  
  6. default
  7. {
  8.    attach(key id)
  9.    {
  10.        
  11.    
  12.         if(id) // if object is attached to an avatar/ id is the avatar's uuid
  13.         {
  14.          
  15.         // set up the listen relay  
  16.          llListenRemove(llisten);
  17.          llisten = llListen(lchan,"",llGetOwner(),"");
  18.          
  19.          
  20.         //-------------------  
  21.          llSetTimerEvent(0.0);  
  22.           llSetTimerEvent(5.0); // set a timer to limit how long to listen for the RLV command.
  23.           llOwnerSay("@versionnew="+(string)lchan); // send version number to lchan channel 5000 or whatever lchan is set to.
  24.          
  25.         }
  26.        
  27.     }
  28.    
  29.     listen(integer chan, string name, key id, string msg)
  30.     {
  31.      
  32.    
  33.      
  34.      if(chan == lchan)
  35.      {
  36.          
  37.         // heard the RLV message on the lchan channel so lets stop the timer and do RLV stuff
  38.        
  39.         llSetTimerEvent(0.0);
  40.        
  41.         llOwnerSay("Your RLV is on. Your version is: " + msg); // inform owner that RLV is on and their verion number. Delete this if not needed.
  42.        
  43.         // do RLV stuff here
  44.          
  45.      }  
  46.        
  47.     }
  48.  
  49.    timer()
  50.    {
  51.        // no message received on channel so stop the timer, remove the listen handle , and inform owner that their rlv is off.
  52.        llSetTimerEvent(0.0);
  53.        llListenRemove(llisten);
  54.        llOwnerSay("Your RLV is off.");
  55.        
  56.     }
  57. }
  58.  
Add Comment
Please, Sign In to add comment