Difference between revisions of "LlPassTouches"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 7: Line 7:
|return_text
|return_text
|spec
|spec
|caveats=* This has no effect when called on the root prim.
|caveats
|constants
|constants
|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;
|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;

Revision as of 20:40, 1 January 2016

Summary

Function: llPassTouches( integer pass );

Sets the pass-touches prim attribute.

• integer pass PASS_* flag

Whether Touches are passed to the root prim depends not only on which PASS_* flag is selected, but may also depend on if there is a script that in the prim that handles one of the touch events. For this reason most users will want to use PASS_ALWAYS or PASS_NEVER as they do not have this variable behavior.

The default value for this attribute is PASS_ALWAYS.

pass Constant Value touch Script No touch Script Description
PASS_IF_NOT_HANDLED 0 not passed passed Touches are passed if there is no script handling the event in the prim.
PASS_ALWAYS 1 passed passed Default: Touches are always passed to the root.
PASS_NEVER 2 not passed not passed Touches are never passed to the root.

Caveats

  • Has no known effect if called from within the root prim.
All Issues ~ Search JIRA for related Bugs

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

See Also

Events

•  touch_start
•  touch
•  touch_end

Functions

•  llPassCollisions

Deep Notes

History

  • Introduction: ?
  • Change: SVC-5923 - Server version 1.40.2 - New pass value added: 2

All Issues

~ Search JIRA for related Issues
   Add enumeration to llPassCollisions() to provide PASS_ALWAYS, PASS_IF_NOT_HANDLED, and PASS_NEVER as explicit options.
(Was: Collisions passed to parent REGARDLESS llPassCollisions(FALSE) in child)

Signature

function void llPassTouches( integer pass );