Advertisement
Gayngel

Channel coms by object_rez and llGetObjectDetals - Rezzed Object

Mar 15th, 2023 (edited)
1,884
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This is a way to establish communication between a rezzer and the object it rezzers via object_rez and llGetObjectDetails
  2.  
  3. // This script is for the object being rezzed
  4.  
  5. integer gChan; // channel sent by rezzer
  6.  
  7. integer gHandle;
  8.  
  9. default
  10. {
  11.    on_rez(integer rez_param) // rez_param is the last parameter of llRezObject in the rezzer
  12.    {
  13.      list details = llGetObjectDetails(llGetKey(),[OBJECT_REZZER_KEY]); // get the key of the rezzer in a list
  14.      
  15.       key rezzer = llList2Key(details,0); // extract the rezzer key from the list
  16.      
  17.        gChan = ((integer)("0x"+llGetSubString((string)rezzer,-8,-1)) - 6368) | 0x8000000; // create a unique chan with the key of the rezzer
  18.  
  19.  
  20.        gHandle = llListen(gChan, "","",""); //listen on the channel to hear messages from the rezzer
  21.     }
  22.  
  23.     listen(integer chan, string name, key id, string msg)
  24.     {
  25.        
  26.        if(chan == gChan)
  27.        {
  28.            
  29.           llOwnerSay("Rezzer said: " + msg);
  30.            
  31.        }
  32.     }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement