-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass.doc
3261 lines (2554 loc) · 123 KB
/
class.doc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
This document describes how class definitions are working.
=== Syntax ===
The following kinds of tokens are available:
* Open and closing delimiters: These are ( and ) and no spaces are
required around it. They are used for grouping in many places.
* Plain name: A plain word with no sigil. The set of valid plain names is
fixed, and they are all explained in the rest of this document.
* Number: Can be in decimal, or in hexadecimal with a 0x prefix, or in
octal with a 0o prefix. The "x" or "o" must be in lowercase, but the
hexadecimal digits can be uppercase or lowercase. Decimal numbers may be
optionally preceded by a - or + sign.
* Qualified name: A name with a sigil prefix. See below for the list of
possible sigils and their meanings. In all cases except key names, you can
define your own qualified names.
* String: A string literal with quotation marks around it. A string may
contain escapes, which use a backslash followed by whatever text is being
escaped; see below section for the list of string escapes.
Names can contain the following characters:
0123456789-+_?.*/
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
Plain and qualified names may also optionally be prefixed by an equal
sign and/or a comma; their purpose is explained later. If you have both,
the equal sign comes first and then the comma.
Name sigils are:
$ Class
@ Global variable
' Key code
: Label
% Local variable
# User message
! User sound
& User function
^ User flag
Comments are also allowed; these start with a semicolon (outside of a
string literal) and end at the next line break.
=== Escapes ===
\0
Makes further text black (default).
\1
Makes further text blue.
\2
Makes further text green.
\3
Makes further text cyan.
\4
Makes further text red.
\5
Makes further text purple.
\6
Makes further text yellow.
\7
Makes further text white.
\b
Draws a horizontal rule.
\c
Makes further text centred.
\dDATA\
Includes inline data in the string. The data is not displayed, but
can be read by class codes, or used in level titles to provide data
and delimiters for the auto-generated table of contents. Data items
are separated by semicolons; each item can be a underscore to mean a
mark, a number (decimal integers only), or a class name with $ at front.
(Not fully implemented yet)
\iCLASS:NUMBER\
Displays a picture. Give the class name (without $ at first) and a
colon and the zero-based index number of the picture in that class.
This is then followed by another backslash. The picture may span
multiple lines; it will automatically move the text to make room.
\l
Makes further text left aligned (default).
\n
Line break.
\qX
Make a "quiz button". Any string containing this command is a "quiz
string", and there are special behaviours involving quiz strings. The
X should be replaced by any digit or uppercase letter; that will be
displayed, and if clicked, it represents that key code.
\xXX
Hexadecimal escape, where XX is a hexadecimal number from 01 to FF,
and displays a graphic character with the given PC character code.
\"
Literal quotation mark.
\\
Literal backslash.
\Txxxxxx;
Only valid when using multibyte character encoding. Follow \T by six or
more hex digits and then a semicolon; this is like the "&T code" but is
using a backslash instead of a ampersand. (This feature is not fully
implemented yet.)
=== Preprocessor ===
Free Hero Mesh includes a macro preprocessor, which you may use if wanted.
All preprocessor commands are in braces; that constitutes a preprocessor
token, which may contain other tokens as arguments.
Other preprocessor tokens include the macro separator token, which is
written as a vertical bar, and a macro argument token, which is one or
more backslashes followed by a number from 1 to 255.
For user-defined macros, one argument can be either many tokens inside of
parentheses (the parentheses are part of the argument), a single token, or
a macro separator token (omitted from the expansion) followed by any number
of further tokens to make up the last argument.
Built-in macros include:
{+ <numbers...>}
Addition. The result is 0 if no arguments are specified.
{- <number> <number>}
Subtraction.
{* <numbers...>}
Multiplication. The result is 1 if no arguments are specified.
{/ <number> <number>}
Division.
{append <string> <tokens...>}
This works like {define} but adds to an existing definition rather than
replacing the definition.
{band <numbers...>}
Bitwise AND. The result is -1 if no arguments are specified.
{bit <numbers...>}
The numbers are in range 0 to 31 and denote bit positions; the result is
a number with only those bits set. If there are any numbers out of range
0 to 31 then the numbers out of range are ignored.
{bnot <number>}
Bitwise complement.
{bor <numbers...>}
Bitwise OR. The result is 0 if no arguments are specified.
{bxor <numbers...>}
Bitwise XOR. The result is 0 if no arguments are specified.
{call <string> <tokens...>}
Call a macro dynamically.
{cat <tokens...>}
Makes a string by concatenating several tokens together. Sigils are
omitted, macro separator tokens are removed, and numbers are converted
to decimal. Strings are also allowed.
{define <string> <tokens...>}
Define a macro. The inner tokens are not expanded yet; they will be
expanded during each use. A macro argument token with a single backslash
expands to the argument in that position, while a macro argument tokens
with multiple tokens becomes the token with one less backslash. It is
permitted to redefine existing macros as well as new ones.
{edit <string> <token>}
Edit a macro. This changes the first token of the definition of the macro
(which must not be another macro) to the specified token. The token is
expanded, and must be a single token once it is expanded; that is what it
will be replaced with. There is a variant with a number in place of a
string; this will replace the first token of the argument of the macro
which is currently being expanded (or the entire token if it starts with
an opening delimiter).
{include <string>}
Include text from another file into this one. You cannot use {include}
inside of another macro or in a macro argument. The file must be in the
current directory, and its name must contain only letters, digits, dot,
underscore, and minus signs, and must start with a letter or digit. If
it is a composite puzzle set, then the name must end with ".include",
and is looked for first inside of the composite puzzle set; if it is not
found there then it is looked for in the current directory.
{make <mode> <arg>}
Make a synthetic token; see the below section about synthetic tokens for
details. The second argument can be a number, or a direction or key name
which is treated as a number, or a string. In most cases, a number will
be converted to a string with its unsigned decimal representation.
{mod <number> <number>}
Modulo.
{version <number>}
Expands into nothing. The number must be zero, otherwise it is an error.
Future versions of Free Hero Mesh may change this.
All arithmetic/bitwise macros also allow their arguments to be directions
and keys, in which case they are treated as the corresponding numbers.
It is possible to implement a tag system in this preprocessor, which makes
it Turing complete. For example:
{define "skip" {call \2}}
{define "1" {skip \1|"3"|"3"|"2"|"1"|"H"}}
{define "2" {skip \1|"3"|"3"|"1"}}
{define "3" {skip \1|"3"|"3"}}
{define "H" \1}
{call "2"|"1"|"1"}
Note: Macro names are entirely independent from token names.
=== Synthetic tokens ===
The possible modes of synthetic tokens are:
":" A label with the specified name.
"=:" Go to a label with a specified name.
",:" Subroutine call a label with a specified name.
"@" A global variable.
"=@" Write a global variable.
"%" A local variable.
"=%" Write a local variable.
"#" A user-defined message.
"$" A class.
"&" A user-defined function.
"^" A user flag (read self, or definition).
"=^" A user flag (write self).
",^" A user flag (read object).
"=,^" A user flag (write object).
"'" A key token; either by number or by name.
"D" A direction; only the low 4-bits are used.
"+" A number interpreted as decimal.
"=+" A number interpreted as binary.
",+" A number interpreted as hexadecimal.
"=,+" A number interpreted as octal.
"C" A string with a single character of the specified code.
",C" A string with a quiz button of the character with the code.
"A" The ASCII code of the first character of the string.
Note that as the argument, you can use {cat} to convert other tokens
to strings if needed.
=== Global definitions ===
These are the global definitions in the class definition file. (All of
these definitions are optional.)
(Animate <limit>)
Set the limit for logical animations, from 1 to 255. The default is 32.
(Background <number> [<number>])
Set the background colour, from 0 to 255. The default value is 1. You
can optionally specify a second number, which is the background colour
for the inventory; if not specified, uses the same colour for both.
(CodePage <number>)
Define the code page, from 1 to 8388607. If not specified, then the
default code page is used.
(Connection <string>)
Set options for connected movement. The string can include any
combination of the below letters:
"t" = Use two HIT/HITBY passes, skipping shove/sharp for first pass.
"w" = Use the total weight of the group instead of each one separately.
(Control <definitions...>)
Define the control class. The format is the same like other class
definitions, except that Image and Abstract are not allowed. An
object of this class is automatically created when initializing the
level, at X and Y coordinates both zero, and cannot otherwise be
created, destroyed, or moved. It still receives broadcast messages
normally, and can also be addressed specifically.
(CollisionLayers <userflags...>)
Define user flags as CollisionLayers bits; the first defined flag is
bit0. Up to 8 flags can be defined in this way.
(Density <numbers...>)
Define the default Density settings for classes that use the collision
layers. Each number must be in range 1 to 255, and there cannot be more
than eight density numbers defined. Their order is the same as the order
of the user flags in the (CollisionLayers) block.
(InputXY <options...>)
Enables coordinate input. Currently there are no options, so the options
must be left blank. See the documentation about the CLICK message for
more details about coordinate input.
(LevelTable <definitions...>)
Define the level table. See the section about level table definition
for details. Can only occur once.
(Misc4 <userflags...>)
Define user flags as Misc4 bits; the first defined flag is bit0. Up to
32 flags can be defined in this way.
(Misc5 <userflags...>)
Define user flags as Misc5 bits; the first defined flag is bit0. Up to
32 flags can be defined in this way.
(Misc6 <userflags...>)
Define user flags as Misc6 bits; the first defined flag is bit0. Up to
32 flags can be defined in this way.
(Misc7 <userflags...>)
Define user flags as Misc7 bits; the first defined flag is bit0. Up to
32 flags can be defined in this way.
(Order <orders...>)
See the section below about order of execution. Normally, order of
execution (for broadcasts and some other things) is in the reverse order
of creation; the (Order) block allows you to override this order.
(Synchronize <slot> <length> <speed>)
Define an animation slot for synchronized animation. The slot number can
be 0 to 7, the length is the number of images in the sequence, and the
speed is the number of centiseconds between frames.
(Trigger <number>)
Not defined yet. (TODO)
(Volume <number>)
Define the maximum allowed volume for an object to move diagonally
between two other objects. The default value is 10000.
($<name> <definitions...>)
Define a class. See the section about class definitions for details.
(@<name> <value>)
Define a global variable and its initial value.
(@<name> Array <rows> <columns>)
Define a global variable whose value is a reference to a new array, with
the specified dimensions. The maximum number of rows is 64, and the
maximum number of columns is 1024, and the maximum number of cells in
all arrays in total is 65534. All elements are initialized to zero when
the level starts.
(<message> <code...>)
Defines a default message code for all classes which do not specify
their own code for this message. (It is recommended to not use this
block, and to use subclassing instead.)
(&<name> <code...>)
Define a user-defined function. User-defined functions may take any
number of inputs from the stack and leave any number of outputs on the
stack, but may not access user-defined local variables. (It may still
access standard local variables, and all global variables, though.)
=== Class definitions ===
Within a class definition, the following definitions can be used. See also
the section about variables; many of these definitions are used to specify
the initial value for variables of objects of this class.
Outside of code blocks, named constants are not normally interchangeable
with the numbers having the same value.
<class>
Inherit the specified class, which must have been previously declared as
an abstract class. Flags and message codes are inherited unless they are
overridden. Multiple inheritance is not allowed. If inheritance is used,
it must be specified before any blocks with program instructions, and
any user-defined variables defined in the superclass are not accessible
by the code specific to this class; you can define another variable with
the same name but it will be a new variable with the same name.
<userflag>
Set a user flag bit in the definition of Misc4, Misc5, Misc6, Misc7, or
CollisionLayers of this class. You must previously define this user flag
as a global definition.
Abstract
Disallows creating objects of this class, but allows other classes to
subclass this one. The (Image), (DefaultImage), (Help), and (EditorHelp)
blocks are not allowed in abstract classes.
(Arrivals InPlace)
This is an abbreviation for (Arrivals 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0).
(Arrivals <numbers...>)
Define the Arrivals variable for this class. This is twenty-five numbers
each of which is either zero or one. They are meant to be on five lines
of five numbers each, making a 5x5 matrix, where the centre means this
object's location.
(Bishop <code...>)
Same as four key dispatch blocks: 'PGUP, 'PGDN, 'HOME, and 'END; the
corresponding direction will be pushed to the stack before the code
will be executed.
Bizarro
Means that objects of this class created using the Create instruction
will be created in the bizarro world by default. (This has no effect on
objects placed in the level editor.)
(Climb <number>)
Define the Climb variable for this class.
(CollisionLayers <numbers...>)
Define the CollisionLayers variable for this class. The format is the
same as for Misc4 (see below), but only the low 8-bits are usable.
Compatible
Sets the Compatible flag for this class. This changes some features for
compatibility with Hero Mesh, and would not normally be used for new
puzzle sets made with Free Hero Mesh.
,Compatible
Sets the Compatible flag for this class, but removes the restriction of
some variables limited to 16-bits.
Connection
Sets the Connection flag for this class.
Crush
Sets the Crush flag for this class.
(DefaultImage <list...>)
Each entry is either a number of an image in this class, or two
numbers in parentheses giving a range of images, or () to indicate
that there are no default images. This specifies which images can
be used in objects of this class which are initially present on
the level (placed in the editor). If () is used, then this class
is not available in the editor. If there is no (DefaultImage) block,
all images are available. The (Image) block must come before this one.
The list can also contain the token "mod" followed by a positive number;
in this case, it will also add any images whose numbers are that many
more than the ones already specified and will repeat; for example, if
you write "(DefaultImage 1 mod 5)" then images 1, 6, 11, 16, 21, etc
are added to the list of default images.
(Density <number>)
Define the Density variable for this class. If you want the Density to
be different in the editor, specify the value to use in the editor here,
and then change the Density value in the INIT block.
(Departures InPlace)
This is an abbreviation for (Departures 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0).
(Departures <numbers...>)
Define the Departures variable for this class. The format is the same as
for the Arrivals variable; see above.
(EditorHelp <strings...>)
A help message to display in the level editor; normally, this would
explain what values are expected for Misc1, Misc2, Misc3, and Dir.
Each string is one line of text.
(Hard <number>)
Define the hardness of this object on all four sides.
(Hard <pairs...>)
Define the hardness per direction. Each pair is in parentheses, and is
a direction (E, N, W, or S) followed by a 16-bit number. If any
direction is not specified, then the hardness is zero in that direction.
(Height <number>)
Define the Height variable for this class.
(Help <strings...>)
A help message for the game player, which would normally explain what
this object does. Each string is one line of text.
(Help Misc1)
Similar to (Help) but tells it to display a level string referenced
by the Misc1 of this object.
(Image <strings...>)
Specify strings with the names of images. The first string is the
name of the image numbered 0, next for the image numbered 1, etc.
Input
Set the Input flag for this class. This causes it to receive a KEY
message during the input phase of each turn.
Invisible
Set the Invisible flag for this class.
(Misc4 <numbers...>)
Specify any combination of numbers and/or bit constants. Defines the
Misc4 variable of this class to be the bitwise OR of the listed numbers.
Although this variable may have any value at run time, the definition in
a class is limited to numbers.
(Misc5 <numbers...>)
Define the Misc5 variable for this class; see Misc4 above for details.
(Misc6 <numbers...>)
Define the Misc6 variable for this class; see Misc4 above for details.
(Misc7 <numbers...>)
Define the Misc7 variable for this class; see Misc4 above for details.
(Others <code...>)
This block is only allowed in classes with the Input flag. If no key
dispatch block matches and it is not a key which is implicitly ignored,
and Arg3 is both zero, then it will execute this block instead.
Player
Set the Player flag for this class.
(Queen <code...>)
Combines the effects of the (Rook) and (Bishop) blocks.
Quiz
If specified, the internal variables of objects of this class cannot
normally be examined by the player. However, the player can override
this definition at run time; you cannot rely on it. Class codes cannot
read the value of this flag.
(Rook <code...>)
Same as four key dispatch blocks: 'UP, 'LEFT, 'DOWN, and 'RIGHT; the
corresponding direction will be pushed to the stack before the code
will be executed.
(Shape <number>)
Define the shape of this object on all four sides, where 0 means flat,
1 means slanted to left, 2 means slanted to right, and 3 means slanted
both left and right.
(Shape <pairs...>)
Define the shape of this object per side, similar to the (Hard) block.
(Sharp <number>)
Define the sharpness of this object on all four sides.
(Sharp <pairs...>)
Define sharpness per direction, as for the (Hard) block.
Shovable
Set the Shovable variable for this class to 0x55 (meaning it is shovable
in all four directions).
(Shovable <dir...>)
Set this object to be shovable in the specified directions, which can be
any absolute direction.
(Shovable <number>)
Set the Shovable variable to the specified 8-bit number. (You cannot set
the initial value of any other bits; they are always clear.)
Stealthy
Set the Stealthy flag for this class.
(Strength <number>)
Define the Strength variable for this class.
(SUBS <code...>)
Make a code block with no entry point. This isn't very useful, but it
is provided for compatibility with Hero Mesh.
(Temperature <number>)
Define the Temperature variable for this class.
VisualOnly
Set the VisualOnly flag for this class.
(Volume <number>)
Define the Volume variable for this class.
(Weight <number>)
Define the Weight variable for this class.
(<label> <code...>)
Make a code block whose entry point is the specified label.
(<message> <code...>)
Make a code block whose entry point is the specified message.
(<key> <code...>)
Add a code block for key dispatch. This cannot be combined with a KEY
message in the same class; it causes the KEY message to be automatically
defined for this class. If this class has the Input flag and the first
instruction is not IgnoreKey, then it is entered into an internal list
of key codes to not ignore. Otherwise, the automatic KEY messages (for
all classes with them, not only this one) will have the effect of the
IgnoreKey instruction when an unrecognized key is specified. You can
still call the KEY message by yourself; Arg1 is the key code, and if
Arg3 is true then the implicit IgnoreKey will not be executed (although
any explicit IgnoreKey will still work).
=== Data types ===
The following data types are available:
* Number: A 32-bit integer. Whether it is treated as signed or unsigned
depends on the context. In some cases, it is used as bit field data.
* Class: A class name with a $ prefix.
* Message: A message name. User-defined message names have a # prefix;
standard message names have no prefix.
* Object: A reference to an object. There are no literals of this type.
* String: A string in quotation marks. There are no string manipulation
functions; the only thing that can be done with a string is to display it,
or to compare if one string matches another.
* Sound: A named sound effect. Values of this type cannot be compared with
anything, even other values of the same type. A sound can be either a
built-in sound or user sound.
* Mark: There is only one value of this type; it is used to delimit lists
of values on the stack.
* Array: A reference to an array. You cannot allocate arrays at run time;
the available array memory is fixed at compile time, subject to the global
array definitions.
* Link: A link to another point in the code of some class or global. Where
a link is expected, you can also specify a message to mean that message
block for the Self object (this is not quite the same as sending that
message to itself, though).
Some things are not their own types, and are other uses of numbers:
* Null: A null class or null object is represented as zero.
* Boolean: When a boolean is required as input to some instruction, zero
is false, and most other values (of any type) are true, except for sounds
which cannot be used as booleans at all. When an instruction produces a
boolean value as output, true is one and false is zero.
* Key: A key code for input (not necessarily the same as the physical key
with that label). See the list in the below section.
* Direction: Can be absolute or relative. For absolute directions, zero is
east, and increasing numbers go counterclockwise 45 degrees each, up to
seven for southeast. Relative directions start at eight for forward and
otherwise work similarly (increasing numbers go counterclockwise).
=== Constants ===
The following constants are available. Some of them are numeric constants
and using them pushes numbers to the stack, and they are interchangeable
with the corresponding numbers where instructions are expected.
Absolute directions:
E = 0
NE = 1
N = 2
NW = 3
W = 4
SW = 5
S = 6
SE = 7
Relative directions:
F = 8
LF = 9
L = 10
LB = 11
B = 12
RB = 13
R = 14
RF = 15
Bit constants:
bit0 to bit31 = numbers with a single bit set
Animation constants:
STOP = 0
ONCE = 1
LOOP = 2
OSC = 8
OSCLOOP = 10
Standard messages:
ARRIVED
BEGIN_TURN
BLOCKED
CLICK
COLLIDE
COLLIDEBY
COLLIDING
CONFLICT
CONNECT
CREATE
CREATED
DEPARTED
DESTROY
DESTROYED
END_TURN
FLOATED
HIT
HITBY
INIT
JUMPED
KEY
LASTIMAGE
MOVED
MOVING
NEXTWARP
PLAYERMOVING
POSTINIT
SUNK
WARPED
XCREATE
Input constants:
'BACK = 8
'TAB = 9
'CENTER = 12
'ENTER = 13
'SHIFT = 16
'CTRL = 17
'BREAK = 19
'CAPSLOCK = 20
'SPACE = 32
'PGUP = 33
'PGDN = 34
'END = 35
'HOME = 36
'LEFT = 37
'UP = 38
'RIGHT = 39
'DOWN = 40
'DELETE = 46
'0 = 48
'1 = 49
'2 = 50
'3 = 51
'4 = 52
'5 = 53
'6 = 54
'7 = 55
'8 = 56
'9 = 57
'A = 65
'B = 66
'C = 67
'D = 68
'E = 69
'F = 70
'G = 71
'H = 72
'I = 73
'J = 74
'K = 75
'L = 76
'M = 77
'N = 78
'O = 79
'P = 80
'Q = 81
'R = 82
'S = 83
'T = 84
'U = 85
'V = 86
'W = 87
'X = 88
'Y = 89
'Z = 90
'NUMPAD0 = 96
'NUMPAD1 = 97
'NUMPAD2 = 98
'NUMPAD3 = 99
'NUMPAD4 = 100
'NUMPAD5 = 101
'NUMPAD6 = 102
'NUMPAD7 = 103
'NUMPAD8 = 104
'NUMPAD9 = 105
'MULTIPLY = 106
'DECIMAL = 110
'DIVIDE = 111
'F9 = 120
'F10 = 121
'F11 = 122
'F12 = 123
'NUMLOCK = 144
'SCRLOCK = 145
'SEMICOLON = 186
'EQUALS = 187
'COMMA = 188
'MINUS = 189
'PERIOD = 190
'SLASH = 191
'TILDE = 192
'OBRACKET = 219
'BACKSLASH = 220
'CBRACKET = 221
'QUOTE = 222
Standard sound constants:
ANHH
BANG
BEDOINGNG
BEEDEEP
BOOOM
BOUNCE
BRRREEET
BRRRT
BUZZER
BWEEP
CHEEP
CHYEW
DEEP_POP
DINK
DOOR
DRLRLRINK
DYUPE
FAROUT
FFFFTT
FROG
GLASS
GLISSANT
HAWK
HEARTBEAT
JAYAYAYNG
KEWEL
KLECK
KLINKK
LOCK
OLDPHONE
POUR
POWER
RATCHET1
RATCHET2
RATTLE
SMALL_POP
SPLASH
STEAM
TAHTASHH
THMP_thmp
THWIT
TICK
UH_OH
UNCORK
UNHH
VACUUM
WAHOO
WHACK
YEEHAW
Note: Some messages can also be used as sounds. Some sounds might later be
changed to messages (they can still be used as sounds, although a sound
file with that name is not guaranteed to be available).
=== Variables ===
These are the variables which each object has. Some are marked [ro] below
because they are read-only. In all cases, you can put , in front to access
a different object rather than self and = in front to write that variable
(unless it is read-only). You can also access some of these variables also
on classes instead of objects; these are always read-only. The variables
which are available on classes too are marked [c] below.
Some variables list one type, and some list two. If there are two types,
"int16/int32" means any number written to it is truncated to 16-bits in
compatible mode, but the full value is retained in incompatible mode. The
16-bit number is treated as unsigned, so it is zero-extended to 32-bits.
The notation "int16/any" means the same thing, except that the variable
is not limited to numbers; non-numbers are never truncated.
A few variables require a direction on the top of the stack, above the
value if you are writing. These are marked [d] below. These are really
four variables, one for each direction (not counting diagonals).
If you use the comma prefix to refer to another object, the object to
refer to is always below the direction and/or value to write on the stack
(if there are any such values).
In incompatible mode, many "physics" variables are treated as signed.
Most of these variables are state-changing; writing to them is not allowed
on the same turn as IgnoreKey. Exceptions are Distance and KeyCleared.
%xyz : any
A user-defined variable. This variable cannot be accessed on other
objects other than this one. You can give it any name with a percentage
sign at first. User variables are initialized to zero, and need not be
declared anywhere.
^xyz : bool [c]
A user-defined flag, which is one bit in Misc4, Misc5, Misc6, Misc7, or
CollisionLayers. If it is CollisionLayers, then it is read-only; other
flags are read/write. User defined flags must be defined first (globally)
before they can be used. Unlike user-defined variables, you can access
user-defined flags on any object.
Arrivals : int32
Only the low 25-bits are used. Each bit which is set indicates that it
cares if other objects arrive around it at that relative location, where
bit0 is two paces northeast, bit1 is to the west of that, etc, and then
bit4 two paces northwest of this object, and bit5 starts on the next
row to the south, etc, and bit12 is this object's location.
Arrived : int32
When an object arrives in the location where this object cares about
arrivals (according to the Arrivals variable), the corresponding bits
are set in the Arrived variable. If this value is nonzero, then it will
also send a ARRIVED message during the trigger phase. You can write all
bits of this variable, but only the low 25-bits can be read back; if you
write a nonzero number with only the high bits set, then it will still
be triggered but will be read back as zero.
Bizarro : bool [c]
Set if this object is in the bizarro world. Objects in the bizarro world
are invisible and intangible, and mostly do not interact with other
objects. However, they can still be accessed/affected by anything that
references it directly, it is still possible to broadcast messages to
them, and they are still affected by most turn-based actions (although
not the compatible part of the trigger phase). Objects in the bizarro
world are effectively stealthy as well, so do not cause messages due to
being moved, created, or destroyed. In some circumstances, attempting
to change this flag will have no effect.
Busy : bool
If any object has either the Busy or UserSignal variable set, then the
player input is blocked, and the turn may continue. Use this to control
the timing of effects in LASTIMAGE blocks.
Class : class [ro]
The class of this object.
Climb : int16/int32 [c]
In order for this object to move, this object's Climb must equal or
exceed the Height of all objects at the target location, otherwise it
is prevented from moving.
CollisionLayers : int8 [c] [ro]
Any set bit means no other object with that same bit set in this field
may exist at the same location. (There is no effect in bizarro world.)
Compatible : bool [c] [ro]
The compatibility flag. Class definitions imported from EKS Hero Mesh
always set this flag; in new puzzle sets it is normally not set.
Connection : bool [c]
If this flag is set, then moving this object by the use of the Move
instruction will try to move an entire connected group of objects,
instead of only one. This changes some of the behaviour and will
cause additional messages to be sent, too. Deferred movement is not
possible if this flag is set.
Crush : bool [c]
If this flag is set, then objects that try to move into it will destroy
it if it is unable to shove it out of the way. Unlike sharpness checking,
crushing is checked after shoving instead of before. Crushing is never
possible if warping occurs.
Density : int16/int32 [c]
Determines the order that objects are stacked within each cell. When an
object is moved or created, its Density is compared with the Density of
the objects already present at that location, in order to insert it into
the stack of objects there, at the top, bottom, or middle, where lesser
numbers mean closer to the top, and greater numbers are deeper. If there
are multiple objects of the same Density, the new one goes above others
with the same Density. If you change the value of this variable, it will
automatically float/sink the object if necessary in order to fit it into
the correct stacking order, sending FLOATED and SUNK messages.
Departed : int32
This is like Arrived but triggered for departures (as specified by the
Departures variable) rather than arrivals.
Departures : int32
This is like Arrivals but for positions where it is triggered by objects
leaving those locations rather than arriving there.
Destroyed : bool [ro]
It is set if this object has been successfully destroyed (but not yet
deleted from memory). You must use the Destroy or Assassinate command