> 4D Blocks

> Version 6

  Block Motion
> Scene Language
  Kinds of Blocks

> General Information
  Geometry Commands
  More Geometry Commands
  Train Commands
  Elevated Train Commands
  Scenery Commands

General Information

Include Files

The include system has been revised in version 4 to make it much more usable. The key concept is that when you say "include", you give the name of the file you want to include. That name is used to locate the actual file according to the following scheme.

  1. If the name is already a complete path, use that path.
  2. If there's a file with that name in the same directory as the file currently being processed, use that file.
  3. If that fails, check in the "data/lib" directory. That's where all the standard library files live.

As a result, you can create your own scene files in any directory without having to make copies of all the library files.

Also, files are never included twice, so you can include whatever files you want without worrying about whether they include each other.


If you're trying to build a scene that has parameters, sometimes you'll need to combine the parameters using a bit of arithmetic. The "add", "sub", "mul", "div", and "neg" commands do that. The first four are self-explanatory, and what "neg" does is take the negative. For example, "4 20 add 2 div neg" yields -12.


The "dup" command duplicates the object on top of the stack. The duplication is by reference, so basically you get two pointers to the same object, not two different objects. This is sometimes the right behavior.

The "copy" command is the same as "dup" except that it makes copies of shapes and textures.

Here are a few other commands that are even less useful.

  • exch - exchanges the two items on top of the stack
  • pop - removes the top item from the stack
  • n index - duplicates the nth item on the stack, where n=0 is the top. For example, "10 20 30 40 1 index" yields "10 20 30 40 30".