Advertisement
Gayngel

Channel coms by llRezObject and on_rez - Rezzer

Mar 15th, 2023 (edited)
1,507
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 llRezObject, on-rez and object_rez
  2.  
  3. // This script is for the rezzer
  4.  
  5. integer gChan; // a unique channel ro communicate between rezzer and object rezzed
  6. key obj_key;  // key of object rezzed
  7.  
  8.  
  9. default
  10. {
  11.    
  12.     state_entry()
  13.     {
  14.      
  15.         gChan = ((integer)("0x"+llGetSubString((string)llGetKey(),-8,-1)) - 6368) | 0x8000000; // establish a unique channel.  - 6368 is just an offset in case that channel is 0;
  16.        
  17.        
  18.     }
  19.    
  20.     collision_start(integer num)
  21.     {
  22.         llRezObject("sphere", llGetPos() + <0.0,0.0,1.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, gChan); // send the channel as the last parameter of llRezObject
  23.     }
  24.    
  25.     object_rez(key id) // when the rezzer rezzes an object
  26.     {
  27.         obj_key = id;  // get the key of the object rezzed
  28.        
  29.     }
  30.  
  31.     touch_end(integer num)
  32.     {
  33.        
  34.        
  35.         llRegionSayTo(obj_key, gChan,  "Hello Mr Object!");
  36.     }
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement