Free Hero Mesh

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

Differences From Artifact [9e85956bac]:

To Artifact [72f1aea5b1]:


267
268
269
270
271
272
273






274
275
276
277
278
279
280
  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.







(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.







>
>
>
>
>
>







267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
  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.
397
398
399
400
401
402
403



404
405
406
407
408
409
410
  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.




(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,







>
>
>







403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
  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.

(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,
646
647
648
649
650
651
652

653
654
655
656
657
658
659
  ARRIVED
  BEGIN_TURN
  BLOCKED
  COLLIDE
  COLLIDEBY
  COLLIDING
  CONFLICT

  CREATE
  CREATED
  DEPARTED
  DESTROY
  DESTROYED
  END_TURN
  FLOATED







>







655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
  ARRIVED
  BEGIN_TURN
  BLOCKED
  COLLIDE
  COLLIDEBY
  COLLIDING
  CONFLICT
  CONNECT
  CREATE
  CREATED
  DEPARTED
  DESTROY
  DESTROYED
  END_TURN
  FLOATED
894
895
896
897
898
899
900







901
902
903
904
905
906
907
  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.








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







>
>
>
>
>
>
>







904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
  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.

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
1006
1007
1008
1009
1010
1011
1012

1013
1014
1015
1016
1017
1018
1019
  to all objects which have moved; you can set or clear this flag by
  yourself if you want to cause it to trigger even though it didn't
  move or to not trigger even though it did move.

Moving : bool
  This flag indicates that a deferred movement is scheduled for this
  object. The direction of movement is specified by the Dir variable.


Player : bool [c] [ro]
  If this object is the player. This is used implicitly as the From of
  some messages sent by the game engine, and has a few other purposes.
  (Normally, a level should have exactly one object of such a class,
  although this is not mandatory; any number (including zero) is allowed.)








>







1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
  to all objects which have moved; you can set or clear this flag by
  yourself if you want to cause it to trigger even though it didn't
  move or to not trigger even though it did move.

Moving : bool
  This flag indicates that a deferred movement is scheduled for this
  object. The direction of movement is specified by the Dir variable.
  This flag is also used for connected movement, for a different purpose.

Player : bool [c] [ro]
  If this object is the player. This is used implicitly as the From of
  some messages sent by the game engine, and has a few other purposes.
  (Normally, a level should have exactly one object of such a class,
  although this is not mandatory; any number (including zero) is allowed.)

1029
1030
1031
1032
1033
1034
1035
1036



1037
1038
1039
1040
1041
1042
1043
ShapeDir : int2 [c] [d]
  Allows accessing the individual 2-bit parts of Shape.

Sharp : int16 [c] [d]
  When one object tries to move into another object, the Hard and Sharp
  values for the sides that are touching will be compared. If the Sharp
  value for one is greater than the Hard of the other, then the object
  with insufficient Hardness is destroyed.




Shovable : int16 [c]
  Defines what directions the object may be shoved, where bit0 means east,
  bit2 means north, bit4 means west, and bit6 means south. Bit1, bit3,
  bit5, and bit7 can be used for diagonal shoving. Higher bits are
  reserved for future and should not be used.








|
>
>
>







1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
ShapeDir : int2 [c] [d]
  Allows accessing the individual 2-bit parts of Shape.

Sharp : int16 [c] [d]
  When one object tries to move into another object, the Hard and Sharp
  values for the sides that are touching will be compared. If the Sharp
  value for one is greater than the Hard of the other, then the object
  with insufficient Hardness is destroyed. If the object that is trying
  to move has the Connection flag, it cannot be destroyed due to running
  into something sharp, but may still destroy other things if it is sharp
  enough to do so (whether or not the other thing has a Connection flag).

Shovable : int16 [c]
  Defines what directions the object may be shoved, where bit0 means east,
  bit2 means north, bit4 means west, and bit6 means south. Bit1, bit3,
  bit5, and bit7 can be used for diagonal shoving. Higher bits are
  reserved for future and should not be used.

1328
1329
1330
1331
1332
1333
1334













1335
1336
1337
1338
1339
1340
1341
  false otherwise. Always false if the object is destroyed, or if one
  object is in the bizarro world and the other one isn't.

,Coloc  ( obj1 obj2 -- bool )
  True if the two specified objects are in the same place, or false
  otherwise. Always false if the object is destroyed, or if one object
  is in the bizarro world and the other one isn't.














Control  ( -- obj )
  Push the control object to the stack. (If no control class is defined,
  then there will be no control object and this will be zero.)

CopyArray  ( src dest -- ) **
  Copy one array to another. It is OK if the two references overlap.







>
>
>
>
>
>
>
>
>
>
>
>
>







1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
  false otherwise. Always false if the object is destroyed, or if one
  object is in the bizarro world and the other one isn't.

,Coloc  ( obj1 obj2 -- bool )
  True if the two specified objects are in the same place, or false
  otherwise. Always false if the object is destroyed, or if one object
  is in the bizarro world and the other one isn't.

Connect  ( -- ) **
  Adds this object to the connection list; has no effect if this object
  is already in the connection list or has the Moving, Destroyed, or
  Bizarro flags set, or does not have the Connection flag. This will
  also set the Moving and VisualOnly flag of this object; it will
  automatically clear the Moving flag after it is handled, and will
  restore the old value of VisualOnly. This should not be used outside
  of the CONNECT message.

,Connect  ( obj -- ) **
  Similar to Connect but for a specified object, instead of necessarily
  this object.

Control  ( -- obj )
  Push the control object to the stack. (If no control class is defined,
  then there will be no control object and this will be zero.)

CopyArray  ( src dest -- ) **
  Copy one array to another. It is OK if the two references overlap.
1400
1401
1402
1403
1404
1405
1406











1407
1408
1409
1410
1411
1412
1413
exec  ( link -- )
  Go to a link; does not continue executing from here afterward. If the
  link is zero then it will be the same as ret.

,exec  ( link -- )
  Go to a link and then continue executing from here afterward. If the
  link is zero then this instruction does nothing.












Finished  ( -- number )
  Returns the value of an internal flag which tells it that the beginning
  and ending phases should be skipped. This is a 8-bit number; zero means
  don't skip them, and any other number means it does. When the game engine
  sets this automatically, it normally sets it to 1, but "-1 FlushClass"
  during the input phase sets it to 255. When you set this value by







>
>
>
>
>
>
>
>
>
>
>







1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
exec  ( link -- )
  Go to a link; does not continue executing from here afterward. If the
  link is zero then it will be the same as ret.

,exec  ( link -- )
  Go to a link and then continue executing from here afterward. If the
  link is zero then this instruction does nothing.

FakeMove  ( dir -- result ) **
  Similar to IntMove but omits many capabilities, including the actual
  movement. This is the same as a function used internally to deal with
  HIT/HITBY for connection movement. If the HIT or HITBY message returns
  a mark, then it is added like using Connect (if the object's flags
  allow it) and then the return value will be 2.

,FakeMove  ( obj dir -- result ) **
  Works like FakeMove but you can specify a different object instead of
  the current one.

Finished  ( -- number )
  Returns the value of an internal flag which tells it that the beginning
  and ending phases should be skipped. This is a 8-bit number; zero means
  don't skip them, and any other number means it does. When the game engine
  sets this automatically, it normally sets it to 1, but "-1 FlushClass"
  during the input phase sets it to 255. When you set this value by
2143
2144
2145
2146
2147
2148
2149










2150
2151
2152
2153
2154
2155
2156

CONFLICT
  Called during scheduling of a deferred move if it is already currently
  scheduled to move but in a different direction. Arg1 is the direction
  that it is trying to schedule the move in. If the return value is false
  then the schedule fails; if true, then it succeeds.











CREATE
  Sent when the object is created by the Create instruction. This is done
  after the object is created, but before sending any other messages. The
  From is the object that created it. The return value will be used as the
  Arg3 of the SUNK and CREATED messages it might send if appropriate. From
  is the object which executed the Create instruction to create it.








>
>
>
>
>
>
>
>
>
>







2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211

CONFLICT
  Called during scheduling of a deferred move if it is already currently
  scheduled to move but in a different direction. Arg1 is the direction
  that it is trying to schedule the move in. If the return value is false
  then the schedule fails; if true, then it succeeds.

CONNECT
  Should use the ,Connect instruction to add additional objects to the
  connection group; it will then send this message to those objects too.
  If the return value is true, then the movement fails, and none of the
  objects in the group will move. The Inertia of this object is set
  automatically before calling this message; it can change the Inertia
  before returning if it wants a different value for Inertia. Arg1 is
  the number of objects in the group previously to this one, Arg2 is the
  direction of movement, and Arg3 is the total Weight so far.

CREATE
  Sent when the object is created by the Create instruction. This is done
  after the object is created, but before sending any other messages. The
  From is the object that created it. The return value will be used as the
  Arg3 of the SUNK and CREATED messages it might send if appropriate. From
  is the object which executed the Create instruction to create it.

2252
2253
2254
2255
2256
2257
2258
2259




2260
2261
2262
2263
2264
2265
2266
  description of END_TURN for details). The Moved variable will usually
  be set automatically; see the section about variables for details.

MOVING
  Called when the object is about to be moved (whether due to Move,
  MoveTo, JumpTo, or any other reason). From is the object that caused
  the move, and Arg1 and Arg2 are the target X and Y coordinates. If the
  return value is true, then the move is aborted.





PLAYERMOVING
  If an object with the Player flag is about to move, then after the
  MOVING message is sent, PLAYERMOVING is sent to all objects. From is
  the object which is moving, Arg1 and Arg2 are where it will be moved to,
  and Arg3 is the From of the MOVING message. If the return value is true,
  then the move is aborted.







|
>
>
>
>







2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
  description of END_TURN for details). The Moved variable will usually
  be set automatically; see the section about variables for details.

MOVING
  Called when the object is about to be moved (whether due to Move,
  MoveTo, JumpTo, or any other reason). From is the object that caused
  the move, and Arg1 and Arg2 are the target X and Y coordinates. If the
  return value is true, then the move is aborted. From will be zero if
  it is the first pass of checking if it can be moved due to Connection;
  in that case, if all first passes are successful then it will try again
  the second pass with From set to the first object of the group, and
  this second time they will actually be moved.

PLAYERMOVING
  If an object with the Player flag is about to move, then after the
  MOVING message is sent, PLAYERMOVING is sent to all objects. From is
  the object which is moving, Arg1 and Arg2 are where it will be moved to,
  and Arg3 is the From of the MOVING message. If the return value is true,
  then the move is aborted.
2288
2289
2290
2291
2292
2293
2294




2295
2296


2297
2298
2299
2300
2301
2302
2303
2304
2305
2306

2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318


2319
2320
2321

2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340


2341
2342
2343
2344
2345
2346


2347
2348
2349
2350
2351
2352
2353
messages; these values are also used as the Arg3 of those messages.

Some descriptions below are marked with an asterisk. If the Compatible
flag is set for the object that returned this value, then all bits with
the asterisk in the below descriptions are masked out (bit15 is only
masked out for Compatible objects for diagonal movement).





bit0
  Do not send the HITBY message to the target object.



bit1
  Do not destroy either object due to hardness/sharpness.

bit2
  Do not attempt to shove the target object.

bit3
  Abort the move attempt immediately. Do not send any more HIT or HITBY
  messages, do not check hardness/sharpness, and do nothing else either.


bit4
  Do not send the HITBY message to the target object or to any further
  objects at the target location.

bit5
  Do not destroy either object due to hardness/sharpness, nor should any
  further objects at the target location be destroyed due to sharpness.

bit6
  Do not attempt to shove the target object, nor attempt to shove any
  other objects at the target location.



bit7 *
  Do not attempt sliding.


bit8
  Abort after sending the HITBY message.

bit9
  Abort after hardness/sharpness checking.

bit10
  Abort after attempting shoving.

bit11
  Set by the game engine if the move attempt has been restarted due to
  bit15 being set during the previous attempt.

bit12 *
  If the move attempt fails, pretend it was successful, even though the
  object hasn't actually moved. This means that the result of Move will
  be 1 and that the MOVED message will trigger; it does not trigger any
  ARRIVED, DEPARTED, FLOATED, or SUNK, nor does it set Distance.



bit13 *
  Abort before actually moving the object and before trying sliding.

bit14 *
  Do not set the Moved flag even if successful.



bit15 (*)
  Try again after trying shoving (whether or not the shoving is
  successful). If it tries to shove an object and it is successful, then
  it will automatically set this bit and automatically try again.

bit16







>
>
>
>

|
>
>










>











|
>
>


|
>


















|
>
>





|
>
>







2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
messages; these values are also used as the Arg3 of those messages.

Some descriptions below are marked with an asterisk. If the Compatible
flag is set for the object that returned this value, then all bits with
the asterisk in the below descriptions are masked out (bit15 is only
masked out for Compatible objects for diagonal movement).

(If the Connection flag is set for the object that is moving, then the
Compatible flag is ignored for the purpose of HIT/HITBY bits, but is not
ignored for other purposes.)

bit0
  Do not send the HITBY message to the target object. If the moving object
  has the Connection flag, then this bit is set in Arg3, but this does not
  prevent sending the HITBY message unless the return value also has bit0.

bit1
  Do not destroy either object due to hardness/sharpness.

bit2
  Do not attempt to shove the target object.

bit3
  Abort the move attempt immediately. Do not send any more HIT or HITBY
  messages, do not check hardness/sharpness, and do nothing else either.
  This bit is also set in Arg3 if the object can't move due to Volume.

bit4
  Do not send the HITBY message to the target object or to any further
  objects at the target location.

bit5
  Do not destroy either object due to hardness/sharpness, nor should any
  further objects at the target location be destroyed due to sharpness.

bit6
  Do not attempt to shove the target object, nor attempt to shove any
  other objects at the target location. (If you are using the two pass
  HIT/HITBY for connection movement, then this bit will automatically
  be set during the first pass.)

bit7 *
  Do not attempt sliding. (This bit is always set in Arg3 if it is due
  to Connection, and always prevents sliding in this case.)

bit8
  Abort after sending the HITBY message.

bit9
  Abort after hardness/sharpness checking.

bit10
  Abort after attempting shoving.

bit11
  Set by the game engine if the move attempt has been restarted due to
  bit15 being set during the previous attempt.

bit12 *
  If the move attempt fails, pretend it was successful, even though the
  object hasn't actually moved. This means that the result of Move will
  be 1 and that the MOVED message will trigger; it does not trigger any
  ARRIVED, DEPARTED, FLOATED, or SUNK, nor does it set Distance. (If the
  moving object has the Connection flag, then this does not stop it from
  moving; it will move anyways if this flag is set.)

bit13 *
  Abort before actually moving the object and before trying sliding.

bit14 *
  Do not set the Moved flag even if successful. (If you are using two pass
  HIT/HITBY for connection movement, then this bit will automatically be
  set in most cases during the first pass.)

bit15 (*)
  Try again after trying shoving (whether or not the shoving is
  successful). If it tries to shove an object and it is successful, then
  it will automatically set this bit and automatically try again.

bit16
2414
2415
2416
2417
2418
2419
2420
2421







2422
2423
2424
2425
2426
2427
2428

bit31
  Available for your own use.

The return value of HITBY can also be an object instead of a number. In
this case, a warp occurs. The movement is restarted, using the specified
object as the origin of the movement, and that object's direction as the
direction of movement.









=== Pattern matching ===

Where an instruction is expected, you can have pattern matching. This can
be (<operator> <pattern...>) where the operator can be one of:








|
>
>
>
>
>
>
>







2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508

bit31
  Available for your own use.

The return value of HITBY can also be an object instead of a number. In
this case, a warp occurs. The movement is restarted, using the specified
object as the origin of the movement, and that object's direction as the
direction of movement. (This is not allowed if bit0 of Arg3 is set; in
that case, it is an error.)

If the moving object has the Connection flag (and bit0 is set in Arg3),
then the return value of HIT or HITBY may be a mark. In this case, it
makes the object "sticky", adding it to the list of objects to be moved
as a part of the same connection group. (Returning a mark if bit0 of
Arg3 is not set is an error.)


=== Pattern matching ===

Where an instruction is expected, you can have pattern matching. This can
be (<operator> <pattern...>) where the operator can be one of: