Advertisement
Gayngel

User Functions Lesson 2, Box 2 Completed Script

Apr 28th, 2016
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. key Owner;
  2. key av;
  3. integer chan;
  4. integer listen_handle;
  5.  
  6. Say(key av, string msg)
  7. {
  8.    
  9.  
  10.      llRegionSayTo(av,0,msg);
  11.  
  12.  
  13. }
  14.  
  15.  
  16. default
  17. {
  18.    state_entry()
  19.    {
  20.      
  21.      Owner = llGetOwner();
  22.      chan = -(integer)("0x"+llGetSubString((string)llGetKey(),-8,-1)) -38628;
  23.        
  24.    }
  25.    
  26.    on_rez(integer start_param)
  27.    {
  28.    
  29.      llResetScript();  
  30.        
  31.     }
  32.    
  33.    touch_end(integer num)
  34.    {
  35.      
  36.       av = llDetectedKey(0);
  37.      
  38.      Say(av,"You touched me!");
  39.      
  40.     llSetTimerEvent(120.0);  
  41.     listen_handle = llListen(chan,"",av,"");
  42.     llTextBox(av, "\nTell me something good:", chan);
  43.        
  44.    }
  45.    
  46.    collision_start(integer num)
  47.    {
  48.       av = llDetectedKey(0);
  49.      
  50.     //Call your function below this comment:
  51.       Say(av,"Ouch! You hit me!");
  52.        
  53.    }  
  54.    
  55.    listen(integer channel, string name, key id, string msg)
  56.    {
  57.      
  58.       if(channel == chan)
  59.       {
  60.          
  61.         llListenRemove(listen_handle);  
  62.         av = id;  
  63.        
  64.      //Call your function below this comment:
  65.        Say(av,msg);        
  66.          
  67.       }
  68.        
  69.     }
  70.    
  71.     timer()
  72.     {
  73.      
  74.      llSetTimerEvent(0.0);
  75.      llListenRemove(listen_handle);  
  76.        
  77.     }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement