CAOS-Programmierung: Befehlsgruppen: Ports

Aus Wikibooks

Ports

ECON (command) agent (agent)

Starts an enumeration across all the agents in a connective system, where agent is any agent within the connective system.

PRT: BANG (command) bang_strength (integer)

Breaks connections randomly with other machines (as if the machine had been 'banged'. Use a bang_strength of 100 to disconnect all ports, 50 to  
disconnect about half etc.

PRT: FRMA (agent) inputport (integer)

Returns the agent from which the input port is fed. Returns NULLHANDLE if that port does not exist, or is not connected.

PRT: FROM (integer) inputport (integer)

Returns the output port index on the source agent, feeding that input port on the TARG agent.
Return values are -ve for error.

PRT: INEW (command) id (integer) name (string) description (string) x (integer) y (integer) message_num (integer)

Create a new input port on target. You should number input port ids starting at 0. The message_num is the message that will be sent to the agent when  
a signal comes in through the input port. _P1_ of that message will contain the data value of the signal. The position of the port, relative to the  
agent, is given by x, y.

PRT: ITOT (integer)

Returns the number of input ports, assuming they are indexed sequentially.

PRT: IZAP (command) id (integer)

Remove the specified input port.

PRT: JOIN (command) source_agent (agent) output_id (integer) dest_agent (agent) input_id (integer)

Connect an output port on the source agent to an input port on the destination. An input may only be connected to one output at at time, but an 
output may feed any number of inputs.

PRT: KRAK (command) agent (agent) in_or_out (integer) port_index (integer)

Breaks a specific connection on a machine. If in_or_out is zero, it is an input port whose connection is broken, if it is an output port, then all 
inputs are disconnected.

PRT: NAME (string) agent (agent) in_or_out (integer) port_index (integer)

Returns the name of the indexed port (input port if in_or_out is zero, output port if non-zero) on the specified agent. Returns "" in error.

PRT: ONEW (command) id (integer) name (string) description (string) x (integer) y (integer)

Create a new output port on target. You should number input port ids starting at 0. The port's relative position is given by x, y.

PRT: OTOT (integer)

Returns the number of output ports, assuming they are indexed sequentially.

PRT: OZAP (command) id (integer)

Remove the specified output port.

PRT: SEND (command) id (integer) data (anything)

Send a signal from the specified output port to all connected inputs. The data can be any integer.

Beispiele