Guest User

RLV Attach Test

a guest
Jul 28th, 2021
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer gRLVactive = FALSE;
  2. string  gRLVversion = "";
  3.  
  4.  
  5. default {
  6.    
  7.     state_entry() {
  8.         if (gRLVversion == "") {
  9.             state RLVcheck;
  10.         }
  11.     }
  12.    
  13.     touch_start(integer touchers) {
  14.         if (gRLVactive) {
  15.             llOwnerSay("@attach:TestDir=force");
  16.         }
  17.     }
  18.  
  19. }
  20.  
  21. state RLVcheck {
  22. //  This state performs a test to see if the RestrainedLove extensions are enabled in the user's viewer.
  23. //  It sets a global flag variable to tell the rest of the script whether to use RLV commands, and stores
  24. //  the RLV version number in a global variable, or sets that variable to "None".
  25.  
  26.     state_entry() {
  27.         integer channel = 0x80000000 | ((integer)("0x"+(string) llGetOwner()) ^ ((integer)llFrand(99)));
  28.         llListen(channel,"","","");
  29.         llOwnerSay("@versionnew="+(string)channel);
  30.         llSetTimerEvent(5.00);
  31.     }
  32.  
  33.     listen( integer channel, string name, key id, string message ) {
  34.         integer index = llSubStringIndex(message,"RestrainedLove viewer");
  35.        
  36.         if (~index) {
  37.             gRLVactive = TRUE;
  38.             gRLVversion = llGetSubString(message, (index + 23), llStringLength(message) );
  39.             llOwnerSay("RLV v"+gRLVversion+" active in this viewer. All functions enabled.");
  40.         }
  41.  
  42.         llSetTimerEvent(0.0);
  43.         state default;
  44.     }
  45.  
  46.     on_rez(integer StartParam) {
  47.         llResetScript();
  48.     }
  49.    
  50.     timer() {
  51.         gRLVactive = FALSE;
  52.         gRLVversion = "None";
  53.         llOwnerSay("RLV not active in this viewer. RLV functions disabled.");
  54.         llSetTimerEvent(0.0);
  55.         state default;
  56.     }
  57.  
  58. }
  59.  
Advertisement
Add Comment
Please, Sign In to add comment