Trace.info

From AGI Wiki
Revision as of 07:30, 24 April 2019 by Andrew Korson (talk | contribs) (Created page with "The '''trace.info''' command sets up the trace mode. == Syntax == trace.info(byt LOGNUM, byt TOP, byt HEIGHT); == Remarks == The '''trace....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The trace.info command sets up the trace mode.

Syntax

trace.info(byt LOGNUM, byt TOP, byt HEIGHT);

Remarks

The trace.info command is usually run before activating trace mode, and sets the position of the trace window using the TOP value, with the window height set by the HEIGHT value. TOP and HEIGHT are in units of text rows (0 - 24). It also identifies logic LOGNUM as the source for trace commands as messages.

If trace.info is not called before using the trace mode, the default location of the trace window is text row 1, and the default height is 15 rows.

Keep in mind that due to a bug in AGI, using any value for TOP except 1 will result in the trace window being drawn incorrectly; it does not affect the performance of the tracer function, it just looks bad.

To have the tracer display commands with text (instead of the command number), logic LOGNUM should contain the trace commands as messages. The number of the message corresponds to the action command with the same byte-code (i.e. message 1 should be "increment", message 2 should be "decrement", etc.) Test commands start at 221 (i.e. message 221 should be "equaln", message 222 should be "equalv", etc.)

For a detailed discussion of how the trace mode works, see the AGI Command Tracer topic.

Possible Errors

If logic LOGNUM does not exist, AGI will raise a runtime error and crash.

Using values of TOP and HEIGHT that are greater than 24 will result in a garbled display.

Example

Code:

<syntaxhighlight lang="agi"> set(enableTrace); [ enable trace mode if(said("trace"))

 {
 trace.info(TracerLogic, 1, 10);  [ assume TracerLogic is a valid logic ID
 trace.on();
 }

</syntaxhighlight>

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 150 (0x96 hex)

See Also

Debugging Commands
AGI Debugging Information