Difference between revisions of "LlSetTouch"

From Second Life Wiki
Jump to navigation Jump to search
m (Parameter description added)
Line 9: Line 9:
|p1_name=id
|p1_name=id
|p1_desc=Avatar key
|p1_desc=Avatar key
|func_desc=This would be a nice function to limit the touch to certain specified avatars.
|func_desc=This would be a nice function to add control over the touch event, and to limit the touch to certain specified avatars. If the passed id  is NULL_KEY all touches are granted.
|return_text
|return_text
|spec=This limits the possibility to touch an object to the passed key id.
|spec=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.
Useful to prevent simultaneous clicks by different Avatars on the same moment on the same object.
|caveats
|caveats=This should also work on touch_start and touch_end events...
|examples=<pre>
|examples=<pre>
default
default
Line 34: Line 34:
   state_entry()
   state_entry()
   {
   {
     llSetTouch(NULL_KEY); // The owner has clicked and authorized others to click ..
     llSetTouch(NULL_KEY); // or shorter syntax: llSetTouch() : ALL avatars granted to click
                          // The owner has clicked and authorized others to click ..
   }
   }
   touch(integer num_detected) // Now everybody can click ..
   touch(integer num_detected) // Now everybody can click ..

Revision as of 07:19, 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 add control over the touch event, and to limit the touch to certain specified avatars. If the passed id is NULL_KEY all touches are granted.

• key id Avatar key

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.

Caveats

This should also work on touch_start and touch_end events...

All Issues ~ Search JIRA for related Bugs

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); // or shorter syntax: llSetTouch() : ALL avatars granted to click
                           // 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

Search JIRA for related Issues

Signature

//function void llSetTouch( key id );