multi_watcher

A multi_watcher watches the states of other entities, such as a door being open or a monster being alive, and
combines them into one true or false result with a logical test like AND or OR. It is a
master that is on while the result is true, and it can fire a target
whenever the result changes.
Each entity has one of five states, On, Off, Turn On, Turn Off and In Use, so a door is On while it is open and Turn On while it is opening. By default only On counts as true, and the flags choose other states that count. See Entity states for what the states mean for each entity.
You list the entities to watch the way you list a multi_manager's targets: turn SmartEdit off
and add one key per entity, with the entity's name as the key and any value, such as 0. For a second key with the
same name, add #2 to the name, like door1#2.
Attributes
targetnameThe name you put in another entity's Master key. See Common keys.
m_iszWatchNames one more entity to watch, besides the extra keys.
m_fLogicPicks how the watched entities give the result.
- All (AND) (0) - True when every watched entity is in a state that counts
- Not all (NAND) (2) - True unless every watched entity is in a state that counts
- At least one (OR) (1) - True when one or more of them is in a state that counts
- None (NOR) (3) - True when none of them is in a state that counts
- Exactly one (XOR) (4) - True when exactly one of them is in a state that counts
- Any number but one (XNOR) (5) - True when none, or two or more, of them are in a state that counts
All (AND) (0)targetThe entity checks its test every 0.1 seconds, starting half a second after the map starts, and fires this with the use type On when the result turns true and with Off when it turns false. Without a name here, the entity doesn't check by itself, but it still works as a master.
Flags
1Send 'Toggle'The entity fires Entity to notify with Toggle instead of On and Off
2Don't send OnThe entity doesn't fire Entity to notify when the result turns true
4Don't send OffThe entity doesn't fire Entity to notify when the result turns false
8NOT 'On'The state On doesn't count as true
16'Off'The state Off counts as true
32'Turn On'The state Turn On counts as true, such as a door that is opening
64'Turn Off'The state Turn Off counts as true, such as a door that is closing or a monster that is dying
128'In Use'The state In Use counts as true, such as a charger that a player is using
Notes
- The result starts as false, so if the test is already true at the first check, the entity fires On
- A name that matches no entity isn't part of the test, so a watched entity that was removed doesn't count either way, and AND of only missing entities is true
- If several entities share a name, the entity reads only the first one
- It watches up to 64 entities and leaves out every key after that. With
developer 1set in the console, the console names each key it leaves out - A name can be
!activatoror*player, which works when the entity is asked as a master: it then means the player who uses the locked entity - If watchers watch each other in a loop, the check stops 32 levels deep, the result is false, and with
developer 1set in the console, the console reports it
See also
- Masters and states - every master, and the states of each entity
watcher_count- counts how many entities of one name aren't offcalc_state- combines two masters, and can use amulti_watcheras one of themenv_state- an on or off state that you switch with triggers
Changes since 1.38
multi_watcheris new in SBO 2.1.0
