Signal class in Global context

Signals broadcast information in a channel (being an abstract communication medium that could be imagined as sound, smell, vision or anything else). There are no sender-receiver associations, although the receiving party can filter out signals (two standard filtering methods are: physical neighborhood and one-dimensional attribute called flavor). Signals attached to neurons and creatures (created in Creature.signals and Neuro.signals) automatically follow the owner's location. Environmental signals (in World.signals) are stationary.

Receiving:
There are 2 kinds of data you can receive:
1. aggregating functions (receive and receiveFilter) calculate the overall power of the received signal (based on the distance and the source power).
2.receiveSet and receiveSingle fetch the individual Signal object(s) so it is possible to transmit something else than just a single number (by using Signal.value) and do more sophisticated processing.

Creating: Use "add" in Creature.signals, Neuro.signals, or World.signals.

6 members:

string channel
string

Channel name

Channel name, readonly.

float flavor
float

Flavor

Signal flavor is can be used to differentiate between signals in a single channel.

object pos

Position

Signal position, readonly.

float power
float

Power

Signal power affects the aggregated signal value returned from receive() and receiveFilter().

field value
untyped

Value

Signal value can be any type. On the receiver side it is only available by accessing the individual Signal objects, i.e. after calling receiveSet() or receiveSingle(). The aggregating function receive() and receiveFilter() ignore this attribute.

function remove

Remove

function remove()

Deletes the signal


Global context