User Tools

Site Tools



Aids when multiple objects can be used to control a trap.

Create a group of relays with this script on them. Using ScriptParams links with the data Sibling, connect the relays together. There should be exactly one link between any two relays. When any one of the relays receives TurnOn or TurnOff, the message will be sent along ControlDevice links from all the relays in the network.

The network shares a common setting for Trap Control Flags, Script→Timing, and Engine Features→Locked. (But not the design note parameters, you should notice.) In each network, the object with the lowest ID is selected as the reference for these properties. When creating a network, you should set these properties on all the relays since object IDs can be changed by Dromed.

All the trap control flags are respected, and reflect the messages that are relayed out of the network. You can change how messages are propogated in the network with the exclusive parameter. If exclusive is on, then when the relay that received the message sends TurnOn (taking into account the Invert trap control flag), the other relays will send TurnOff. TurnOff messages are propogated as normal. Setting exclusive to off allows only one relay to send TurnOff at a time, with TurnOn messages being propogated normally. Or with exclusive set to all, it will do that for both messages.

Each relay can have Owns links to other objects. When the relay receives a message from the network, it will send TurnOn or TurnOff as appropriate to its owned objects. These will normally be levers that are used to activate the relays directly. Switching a lever causes it to send a message back to the relay that switched it in the first place, however. TrapSiblingRelay anticipates these messages and will ignore them. The script needs to know whether it is “on” or “off” in order to switch the owned objects appropriately. It normally assumes that it begins in the off position; use start_on to change this. If the owned objects send back a message that is opposite what was sent to them, then invert_levers should be set. (Not counting the Invert trap control flag on the network.) Or you can just have the script not ignore messages by setting the no_swallow parameter.

The parameters no_swallow and invert_levers apply to all owned objects.

The network will self-heal, so it is safe to destroy relays. If the object being destroyed is being used as the reference for the network (has the lowest ID), then it will copy the Trap Control Flags, Script→Timing, and Engine Features→Locked properties to the object that will become the reference. It propogates the message NewBaseObject through the network to inform the other relays of the change.

Inherits GenericTrap
Messages TurnOn, TurnOff, NowLocked, NowUnlocked, NewBaseObject
Links ScriptParams(Sibling) Connects sibling relays.
Owns The destination is an object that needs to be synchronized with this relay.
ControlDevice Destinations for relayed messages.
Parameters exclusive (on, off, all) Set exclusive relay mode.
invert_levers (boolean) Expectt owned objects to send the opposite method that they were toggled with.
start_on (boolean) Assume that the owned objects for this relay began in the on position.
no_swallow (boolean) Don’t ignore messages which may have come from toggling an owned device.
tnhscript/trapsiblingrelay.txt · Last modified: 2010/11/22 19:12 (external edit)