Difference between revisions of "LlSetTouch"

From Second Life Wiki
Jump to navigation Jump to search
m (Robot: <pre> -> <lsl>)
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
|func_id
|func_id
|mode=request
|mode=request
|func_sleep
|func_sleep=0.0
|func_energy
|func_energy=10.0
|func=llSetTouch
|func=llSetTouch
|sort=SetTouch
|sort=SetTouch
Line 14: Line 14:
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=This should also work on touch_start and touch_end events...
|caveats=This should also work on touch_start and touch_end events...
|examples=<pre>
|examples=<lsl>
default
default
  {
  {
Line 42: Line 42:
   }
   }
  }
  }
</pre>
</lsl>
|helpers
|helpers
|related
|related
|also
|also
|notes
|notes = This functionality can be achieved but using if statement in the touch event ie. if (llDetected(0) == LLGetOwner())
}}
}}

Latest revision as of 19:04, 4 August 2009

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

Summary

Function: llSetTouch( key id );
0.0 Forced Delay
10.0 Energy

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. If no llSetTouch() is specified all touches are granted too.

• 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...

Examples

<lsl> 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
  }
}
</lsl>

Notes

This functionality can be achieved but using if statement in the touch event ie. if (llDetected(0) == LLGetOwner())

Deep Notes

Signature

//function void llSetTouch( key id );