SenseDaemon : Daemon
[Previous] [Main] [Next]

A SenseDaemon, like a SenseFuse, is for use when you want players to see its output only when a certain object can be sensed.

The way to set up a SenseDaemon is very like that of setting up an ordinary Daemon, or a SenseFuse, namely:

new SenseDaemon(obj, &prop, interval, source, sense);

As with the standard Daemon, this sets up a daemon that will call the method
obj.prop every interval turns, where interval must be at least 1 (one). If interval is 1, obj.prop will execute each turn, starting with the current turn. If interval is 2, obj.prop will execute every other turn, starting with the next turn. In general, if interval is n, obj.prop will execute every n turns, starting in n-1 turns time. Note once again that the second argument to the new Daemon call must be a property (or method) pointer, hence the &prop syntax. The difference is that the player will only see any messages displayed by obj.prop if, at that point in time, the player character can sense the source object (which in practice may often be the same as the obj object, but need not be) using the sense sense (which could be sight, sound, smell or touch - most likely one of the first two).

We'll create an example of a SenseDaemon when we come to CyclicEventList.