Difference between revisions of "LlPassTouches"
Jump to navigation
Jump to search
All Issues ~ Search JIRA for related Bugs
m (bad whitespace) |
m (<lsl> tag to <source>) |
||
Line 11: | Line 11: | ||
**If you want to block touches from a child , you must add a script '''with a touch event''' in the child. This creates a default '''no passes'''. | **If you want to block touches from a child , you must add a script '''with a touch event''' in the child. This creates a default '''no passes'''. | ||
|constants | |constants | ||
|examples=Make a two prim [[LINK_SET]] (Object). Name the root "Parent" and the child "Child". To the root add this script -< | |examples=Make a two prim [[LINK_SET]] (Object). Name the root "Parent" and the child "Child". To the root add this script -<source lang="lsl2">integer told; | ||
default | default | ||
Line 34: | Line 34: | ||
} | } | ||
} | } | ||
}</ | }</source> | ||
And to the child add this script - | And to the child add this script - | ||
< | <source lang="lsl2">integer once_is_too_often; | ||
default | default | ||
{ | { | ||
Line 56: | Line 56: | ||
} | } | ||
} | } | ||
}</ | }</source> | ||
|helpers | |helpers | ||
|also_events= | |also_events= |
Revision as of 14:11, 22 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: llPassTouches( integer pass );154 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Sets pass-touches prim attribute.
• integer | pass | – | If TRUE touches are passed from children on to the root, if FALSE touches are not passed on to the root |
The default is TRUE if there is no script to handle the touch events in the prim.
Caveats
- This has no effect when called on the root prim.
- Touches are always passed to the parent when there is no touch event script in the child, even if this is set (TRUE or FALSE) within another event in a child's script.
- If you want to block touches from a child , you must add a script with a touch event in the child. This creates a default no passes.
Examples
Make a two prim LINK_SET (Object). Name the root "Parent" and the child "Child". To the root add this script -
integer told;
default
{
state_entry()
{
told = FALSE;
}
touch_start(integer total_number)
{
if(!(llDetectedLinkNumber(0) == llGetLinkNumber()))// We can use a condition like this to filter from which prims touches are triggered.
{
llSay(0, "My child tells me you touched it. Abuse report pending.");// This will only be spoken if the child is touched twice.
told = TRUE;
}
else
{
if(!told)
llSay(0, "You can touch me all you like");// The unaware Parent leads you on.
else
llSay(0, "If I had my way you would have your hands cut off!");// Not any more.
}
}
}
And to the child add this script -
integer once_is_too_often;
default
{
state_entry()
{
llPassTouches(FALSE);// Innocent child doesn't know to say something the first time.
once_is_too_often = FALSE;
}
touch_start(integer total_number)
{
if(llDetectedLinkNumber(0) == llGetLinkNumber())// Again we check who is being touched.
{
if(!once_is_too_often)
{
llSay(0, "If you touch me again I'm telling.");
llPassTouches(TRUE); // But if a second time, it will tell.
once_is_too_often = TRUE;// And then fall silent.
}
}
}
}