Free Hero Mesh

Artifact [518554159f]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.

Artifact 518554159fe770dca69116a0ddbdfae73c6f86dd:

Wiki page [Program instructions] by zzo38 on 2018-04-07 20:34:11.
D 2018-04-07T20:34:11.935
L Program\sinstructions
P f08c71cd078592373cf34339db6ad00daac347b3
U zzo38
W 4796
(Note: This may change as the program is being written and it is currently a draft.)

In some places in a <tt>.class</tt> file, program instructions can be used. This includes in any global message block, class message block, <tt>SUBS</tt> block, <tt>Goal</tt> block, or global function definition.

The heading includes the instruction name (if in parentheses, it takes other stuff inside of the same block with parentheses; there may be brackets afterward if some other name or number is a part of it), followed by the stack effect (given in a notation like Forth).

Some headings include <b>,</b> and/or <b>=</b> after the stack diagram if it supports those prefixes optionally. In this case, <b>,</b> means a variable of another object (taken on the stack below the value, if writing), while <b>=</b> means to write instead of read (the value to write is taken below another argument if any, but above the object if any). If the heading says <b>,c</b> then you can also read the value from a class (it is read-only in this case; the syntax does not change).

You can also use numbers as instructions (that push their value to the stack), either in decimal or in hexadecimal (with <tt>0x</tt> at first), and an optional minus sign is allowed at first for negative decimal numbers.

<h2 id=xd0>$[] ( -- class )</h2>
Push a class name to the stack. The class must be defined, although it does not necessarily have to be defined above where it is mentioned.

<h2 id=xh0>#[] ( -- message )</h2>
Push a message name to the stack. The message does not have to be declared anywhere. If there are no message handlers, sending this message to any object will just result in zero.

<h2 id=xp0>%[] ( -- value ) =</h2>
Read a user variable of this object. All user variables are initialized to zero and can store any value. You do not need to declare them first.

<h2 id=string>"[]" ( -- string )</h2>
Push a string to the stack. The string can include escape codes:
  *  <tt>\\</tt> - Represents a literal backslash.
  *  <tt>\"</tt> - Represents a literal quotation mark.
  *  <tt>\0</tt> - Set text colour to black.
  *  <tt>\1</tt> - Set text colour to blue.
  *  <tt>\2</tt> - Set text colour to green.
  *  <tt>\3</tt> - Set text colour to cyan.
  *  <tt>\4</tt> - Set text colour to red.
  *  <tt>\5</tt> - Set text colour to purple.
  *  <tt>\6</tt> - Set text colour to yellow.
  *  <tt>\7</tt> - Set text colour to white.
  *  <tt>\b</tt> - Draw a horizontal line.
  *  <tt>\c</tt> - Centre alignment.
  *  <tt>\i</tt> - Follow by a class name (without <tt>$</tt> at front), a colon, a image number, and then another backslash. Draws that picture.
  *  <tt>\l</tt> - Left alignment.
  *  <tt>\n</tt> - Line break.
  *  <tt>\q</tt> - Quiz button; follow by a single character specifying what key code is emitted when it is clicked (you can also push the keys directly, even if there is no corresponding quiz button). If this escape code is present, then a KEY message is sent to the object that displayed this string.
  *  <tt>\x</tt> - Follow by two hex digits to represent that character code.

The string can also include directives:
  *  <tt>%%</tt> - Represents a literal percentage sign.
  *  <tt>%c</tt> - A single character (by 8-bit character code)
  *  <tt>%d</tt> - Signed decimal number
  *  <tt>%i</tt> - A picture (given a class and image number)
  *  <tt>%n</tt> - A representation of the value (a class, message, or object)
  *  <tt>%u</tt> - Unsigned decimal number
  *  <tt>%x</tt> - Hexadecimal number

The directives can optionally have a minimum field width and/or a "<tt>0</tt>" flag.

<h2 id=xxArg1>Arg1 ( -- v ) ,=</h2>

<h2 id=xxArg2>Arg2 ( -- v ) ,=</h2>

<h2 id=xxArg3>Arg3 ( -- v ) ,=</h2>

<h2 id=xxbit0>bit[] ( -- n )</h2>
A constant with exactly one bit set; replace &#91;] with a number 0 to 31.

<h2 id=xxbnot>bnot ( in -- out )</h2>

<h2 id=yxbit>(bit) ( -- n )</h2>
Includes a list of numbers in range 0 to 31, and the result is the number with those bits set.

<h2 id=xxClass>Class ( -- class ) ,</h2>

<h2 id=xxDestroyed>Destroyed ( -- b ) ,</h2>

<h2 id=xxFrom>From ( -- obj ) ,=</h2>

<h2 id=xxIsPlayer>IsPlayer ( -- b ) ,c</h2>

<h2 id=xxlnot>lnot ( in -- out )</h2>

<h2 id=xxMisc1>Misc1 ( -- v ) ,=</h2>

<h2 id=xxMisc2>Misc1 ( -- v ) ,=</h2>

<h2 id=xxMisc3>Misc1 ( -- v ) ,=</h2>

<h2 id=xxMisc4>Misc1 ( -- v ) ,c=</h2>

<h2 id=xxMisc5>Misc1 ( -- v ) ,c=</h2>

<h2 id=xxMisc6>Misc1 ( -- v ) ,c=</h2>

<h2 id=xxMisc7>Misc1 ( -- v ) ,c=</h2>

<h2 id=xxMsg>Msg ( -- msg ) ,</h2>

<h2 id=xxneg>neg ( in -- out )</h2>

<h2 id=xxShape>Shape ( -- n ) ,c=</h2>

<h2 id=xxShapeDir>ShapeDir ( dir -- n ) ,c=</h2>

<h2 id=xxTemperature>Temperature ( -- v ) ,c=</h2>

Z 40760624e2ecb84595f628f2f0959fde