Difference between revisions of "LlSetTouch"

From Second Life Wiki
Jump to navigation Jump to search
(Let it appear a bit nicer)
Line 15: Line 15:
|examples=<pre>
|examples=<pre>
default
default
{
{
state_entry()
  state_entry()
  {
  {
    llSetTouch(llGetOwner()); // only the boss may click!
    llSetTouch(llGetOwner());  
  }
    // only the boss may click the object
touch(integer num_detected);
  }
  {  
  touch(integer num_detected);  
   llSay(0, "Hi BOSS");  
    // if another avatar touches as first nothing happens!
    // only responds to click of the owner
  {
    llSay(0, "Hi Owner!");
    state all;
  }
}
state all
  {
   state_entry()
  {
    llSetTouch(NULL_KEY); // The owner has clicked and authorized others to click ..
  }
  touch(integer num_detected) // Now everybody can click ..
  {
    llSay(0,"Hi, Avatar"); // chatted to avatar who clicked
  }
  }
  }
}
</pre>
</pre>
|helpers
|helpers

Revision as of 06:09, 24 September 2007

Emblem-important-yellow.png LSL Feature Request
The described function does not exist. This article is a feature request.

Summary

Function: llSetTouch( key id );

This would be a nice function to limit the touch to certain specified avatars.

• key id

Specification

This limits the possibility to touch an object to the passed key id. Useful to prevent simultaneous clicks by different Avatars on the same moment on the same object.

Examples

default
 {
  state_entry()
   {
     llSetTouch(llGetOwner()); 
     // only the boss may click the object
   }
  touch(integer num_detected); 
     // if another avatar touches as first nothing happens!
     // only responds to click of the owner
   { 
     llSay(0, "Hi Owner!");
     state all;
   }
 }
 state all
 {
   state_entry()
   {
     llSetTouch(NULL_KEY); // The owner has clicked and authorized others to click ..
   }
   touch(integer num_detected) // Now everybody can click ..
   {
     llSay(0,"Hi, Avatar");  // chatted to avatar who clicked
   }
 }

Deep Notes

Signature

//function void llSetTouch( key id );