User:xylaAodha Resident/PassTouchTestPage

From Second Life Wiki
< User:XylaAodha Resident
Revision as of 15:21, 3 October 2024 by XylaAodha Resident (talk | contribs) (Added {{NOINDEX}})
Jump to navigation Jump to search

Template:NOINDEX

Not sure how this page has become linked on the overview list. It is just a test page to work on while trying to figure out how to fix PASS_ALWAYS being shown as default, and the function say we want to use PASS_ALWAYS all the time.


Summary

Function: llPassTouches( integer pass );
0.0 Forced Delay
10.0 Energy

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

pass Constant Value touch Script No touch Script Description
PASS_IF_NOT_HANDLED 0 not passed passed Default: Touches are passed if there is no script handling the event in the prim.
PASS_ALWAYS 1 passed passed 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.

Examples

/* This script goes in the root prim */

default
{
    touch_start(integer total_number)
    {
        llSay(0, "Root touched START.");
    }

    /* Uncomment block to verify behavoir for all types of touch event */
    /*
    touch(integer total_number)
    {
        llSay(0, "Root touched HELD.");
    }

    touch_end(integer total_number)
    {
        llSay(0, "Root touched END.");
    }
    */
}
/* This script goes in the child prim */

default
{
    state_entry()
    {
        /* Uncomment PASS_ALWAYS to comfirm this is not the default
           (as previous stated on this page,
            the error was corrected when this example was added) */
        //llPassTouches(PASS_ALWAYS);

        /* Uncomment PASS_IF_NOT_HANDLED to return to default behavour */
        //llPassTouches(PASS_IF_NOT_HANDLED);
    }
    
    touch_start(integer total_number)
    {
        llSay(0, "Child touched, type START.");
    }

    /* Uncomment block to verify behavoir for all types of touch event */
    /*
    touch(integer total_number)
    {
        llSay(0, "Child touched, type HELD.");
    }

    touch_end(integer total_number)
    {
        llSay(0, "Child touched, type END.");
    }
    */
}

See Also

Events

•  touch_start
•  touch
•  touch_end

Functions

•  llPassCollisions

Deep Notes

TRUE & FALSE vs. PASS_* flags

Prior to Server Version 1.40.2, pass was couched in terms of being a boolean and the only meaningful values were 0 and 1. The best practice at that time was to use the integer constants TRUE and FALSE. The design of this function left much to be desired. The problem was that while TRUE always caused all Touches to be passed along to the the root, FALSE would only not pass Touches if there the prim had a script that handled a touch event. This meant to fully utilize this function the prim must contain a script that handled touch events! With the release of Server Version 1.40.2, the PASS_* flags were introduced and the subtype of the pass was changed. Specifically the introduction of PASS_NEVER solved this problem, allowing content creators to eliminate scripts that were only in the object to tweak the passing of touch events.

History

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

Signature

function void llPassTouches( integer pass );