Difference between revisions of "GetParentRef"
imported>Maturin |
imported>Vswe m (Added Search Terms) |
||
(7 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
'''Syntax:''' | '''Syntax:''' | ||
set refVar to GetParentRef | set refVar to GetParentRef | ||
Returns the calling object's parent reference (0 if no parent). | Returns the calling object's parent reference (0 if no parent). | ||
The "parent reference" is the reference set in the "Enable Parent" tab of the reference edit dialog. While the dialog appears to only concerned with the enabling state, this function means that its also useful for linking any two references together. | |||
The common use of reference linking is in the scripts of traps, where the trigger ref (push plate, trip string, or a trigger zone) has the actual trap mechanism (mace trap, log trap, darts) as the parent. However, the function can be used in any case in which a generic object needs a relationship with another object. (E.g., place a bunch of cat references where each cat will follow its parent ref.) | |||
If you need to link more than two objects, you can sometimes ''daisy chain'' multiple objects together. E.g., if it's desired for a trip wire to activate two separate trap objects, then set the parent ref of the trip wire to one trap, and then set that trap to have the other trap as its parent and have first trap activate its parent when it is activated. (See also [[Furniture%2C_Traps%2C_and_Lighting#Traps|Traps]].) | |||
[[Category: Functions]] | [[Category: Functions]] | ||
[[Category: | [[Category: Functions (CS)]] | ||
[[Category: Functions (CS 1.0)]] | |||
[[Category: Record Variable Functions]] | |||
[[Category: Record Variable Functions (CS 1.0)]] | |||
<!-- Begin Search Terms | |||
Get | |||
Parent | |||
Ref | |||
End Search Terms --> |
Latest revision as of 09:23, 20 June 2008
Syntax:
set refVar to GetParentRef
Returns the calling object's parent reference (0 if no parent).
The "parent reference" is the reference set in the "Enable Parent" tab of the reference edit dialog. While the dialog appears to only concerned with the enabling state, this function means that its also useful for linking any two references together.
The common use of reference linking is in the scripts of traps, where the trigger ref (push plate, trip string, or a trigger zone) has the actual trap mechanism (mace trap, log trap, darts) as the parent. However, the function can be used in any case in which a generic object needs a relationship with another object. (E.g., place a bunch of cat references where each cat will follow its parent ref.)
If you need to link more than two objects, you can sometimes daisy chain multiple objects together. E.g., if it's desired for a trip wire to activate two separate trap objects, then set the parent ref of the trip wire to one trap, and then set that trap to have the other trap as its parent and have first trap activate its parent when it is activated. (See also Traps.)