CAOS-Programmierung: Befehlsgruppen: Debug

Aus Wikibooks

Debug

AGNT (agent) unique_id (integer)

Given a unique identifier, returns the corresponding agent. Returns NULL if the agent no longer exists. UNID extracts the unique id. NOTE: This  
should  only be used for external programs to persistently refer to an agent during a session. Variables can use SETA to store agent r-values directly 
for internal use. Unique identifiers can change across saved sessions.

APRO (command) search_text (string)

Lists all command names whose help contains the text.

BANG (command)

Causes a division by zero exception in the processor, to test the engine's error handling routines.

CODE (integer)

Returns event script number currently being run by target. Returns -1 if not running anything.

CODF (integer)

Returns family of script currently being run by target. Returns -1 if not running anything.

CODG (integer)

Returns genus of script currently being run by target. Returns -1 if not running anything.

CODP (integer)

Returns the offset into the source code of the next instruction to be executed by the target. Use SORC to get the source code. Returns -1 if not  
running anything.

CODS (integer)

Returns species of script currently being run by target. Returns -1 if not running anything.

DBG# (string) variable (integer)

Dumps debug information for the virtual machine of target. Whatever the type of the variable, a string is output.
Variable can be:
-1 : Whether in INST or not
-2 : Whether in LOCK or not
-3 : Current TARG of virtual machine
-4 : OWNR - should be the same as our outer TARG
-5 : FROM - who sent the message which is being run
-6 : IT - if a Creature, where their attention was
-7 : PART - part number being worked on for compound agents
-8 : _P1_ - first parameter of message, if in a message
-9 : _P2_ - second parameter of message, if in a mesesage
0 to 99 : Local variables VA00 to VA99

DBG: ASRT (command) condition (condition)

Confirms that a condition is true. If it isn't, it displays a runtime error dialog.

DBG: CPRO (command)

Clears agent profiling information. Measurements output with DBG: PROF start here.

DBG: FLSH (command)

This flushes the system's input buffers - usually only useful if DBG: PAWSed.

DBG: HTML (command) sort_order (integer)

Sends CAOS documentation to the output stream. Sort order is 0 for alphabetical, 1 for categorical.

DBG: OUTS (command) value (string)

Send a string to the debug log - use DBG: POLL to retrieve.

DBG: OUTV (command) value (decimal)

Send a number to the debug log - use DBG: POLL to retrieve.

DBG: PAWS (command)

This pauses everything in the game. No game driven ticks will occur until a DBG: PLAY command is issued, so this command is only useful for  
debugging.Use PAUS for pausing of specific agents, which you can use to implement a pause button.

DBG: PLAY (command)

This command undoes a previously given DBG: PAWS and allows game time to flow as normal.

DBG: POLL (command)

This takes all of the DBG: OUTV and DBG: OUTS output to date and writes it to the output stream.

DBG: PROF (command)

Sends agent profile information to the output stream. This gives you data about the time the engine spends running the update and message handling  
code for each classifier. The data is measured from engine startup, or the point marked with DBG: CPRO. It's output in comma separated value (CSV)  
format, so you can load it into a spreadsheet (e.g. Gnumeric or Excel) for sorting and summing.

DBG: TACK (command) follow (agent)

Pauses the game when the given agent next executes a single line of CAOS code. This pause is mid-tick, and awaits incoming requests, or the pause  
key. Either another DBG: TACK or a DBG: PLAY command will make the engine carry on. Any other incoming requests will be processed as normal. However,  
the virtual machine of the tacking agent is effectively in mid-processing, so some CAOS commands may cause unpredictable results, and even crash the  
engine. In particular, you shouldn't KILL the tacking agent. You can see which agent is being tracked with TACK.

DBG: TOCK (command)

This command forces a tick to occur. It is useful in external apps to drive the game according to a different clock instead of the game clock.

DBG: WTIK (command) new_world_tick (integer)

Changes the world tick WTIK to the given value. This should only be used for debugging, as it will potentially leave confusing information in the  
creature history, and change the time when delayed messages are processed. Its main use is to jump to different seasons and times of day.

DBGA (string) variable (integer)

Dumps debug information for target. Whatever the type of the variable, a string is output.
Variable can be:
0 to 99 : agent variables OV00 to OV99
-1 : Counter for timer tick

HEAP (integer) index (integer)

Returns heap and garbage collection information.
0 - current allocated heap memory (development builds only)
1 - total agents, including ones waiting to be garbage collected
2 - similar, but just for creatures

HELP (command)

Lists all command names to the output stream.

MANN (command) command (string)

Outputs help on the given command to the output stream.

MEMX (command)

Windows only. Sends information about the memory allocated to the output stream. In order, these are the Memory Load (unknown), Total Physical (size   
in bytes of physical memory), Available Physical (free physical space), Total Page File (maximum possible size of page file), Available Page File (size
in bytes of space available in paging file), Total Virtual (size of user mode portion of the virtual address space of the engine), Available Virtual  
(size of unreserved and uncommitted memory in the user mode portion of the virtual address space of the engine).

PAWS (integer)

Returns 1 for debug pawsed, 0 for playing. See DBG: PAWS.

TACK (agent)

Returns the agent currently being DBG: TACKed.

UNID (integer)

Returns unique identifier for target agent. AGNT goes the opposite way. NOTE: This should only be used for external programs to persistently refer to  
an agent for a session. Variables can use SETA to store agent r-values directly for internal use. The unique identifier of an agent can change if you  
save a world and load it in again.