Script Reference for R32M installable modules

Overview

An r32m module is an archive of elements for the Railway32 screensaver, it may contain bitmaps, scene scripts etc. The only required element is the setup script (setup.inf - ASCII text format) which is processed in order to install the module.

R32M modules have two purposes:

In many cases a module will do both of the things, but it may do only one of the above.

Note: When using a module for the purpose of distributing new graphics, it is recommended that the module also make appropriate additions to the standard script such that the new graphics appear in standard scenes.

How a module is processed

When a module is installed, the program process the module as follows:

Steps to produce a module

Using modules to distribute graphics

Example

MKDIR    Example
BITMAP    MyBitmap     Example

This creates a sub-folder called "Example" and then copies the bitmap "MyBitmap" from the module into this sub-folder.

Note that only the root name of the bitmap need be given.  Mask bitmaps, and animation bitmaps (e.g. for steam locos) are automatically copied.  E.g.     BITMAP Diesel would process both Diesel.bmp and DieselM.bmp.   BITMAP Steam would process SteamX.bmp SteamM.bmp and the animation frames Steam0.bmp, Steam1.bmp, Steam2.bmp etc.

It is recommended that graphics are installed to suitable sub-folders.

Example

INSERT
    AFTER    Definitions
        define MIXUSA MIX({8..10},"BoxCarPrr.bmp","Gondola.bmp")
ENDINSERT

This adds the new definition for US freight trains to the standard definitions block.

Using modules to install new scenes

New scenes can be installed in one of two ways:

Example

Write    [New Scene]
Write    Include Definitions
Write    Train=20+Set1A

    etc

This appends the given text to the script file, thus creating the new scene.

-or-

Example

APPEND    Scene.txt

where scene.txt is included in the module and consists of the following:

New Scene]
Include Definitions
Train=20+Set1A

    etc

This appends the new text file to the script file, thus creating the new scene.

The former method is of most use where a small scene definition is required, the later is most useful for more complex scene definitions.

Graphic Locations

The location of graphics need not be specified in the setup.inf script, or in any scene text files appended by the setup inf script.

During installation, graphic locations are checked and the script references expanded to point to the graphics.

Example

MKDIR    USA
BITMAP   BoxCarPrr    USA
INSERT
    AFTER    Definitions
        define MIXUSA MIX({8..10},"BoxCarPrr.bmp","Gondola.bmp")
ENDINSERT

This creates the sub-folder "USA" and copies the bitmap BoxCarPrr.bmp into it.  When the line "define MIXUSA "etc is written to the file, the graphic references are resolved and the actual line written will be:

define MIXUSA MIX({8..10},"USA\BoxCarPrr.bmp",     etc

This feature is intended to cope with the situation where graphics are referenced that have been installed by other modules, and the exact location of the graphic may not be know.

Active Scene File

The setup.inf script operates on one of the scene definition files at a time ( custom / standard / narrow ).  The active scene file can be set using the SCRIPT command.

Script syntax

The following commands may be used in a module setup script (setup.inf)

Append

APPEND    <File Name>

Appends the given file to the active scene file.  Graphic references in the append file are resolved during the process.

Bitmap

BITMAP    <Bitmap name>     [Folder]

Copies the specified bitmap or bitmaps into the specified folder.  The folder name be omitted in which case the bitmaps are put in the base Railway32 folder.  If a folder is specified it must exist.

Only the root name of the bitmap need be given.  Mask bitmaps, and animation bitmaps (e.g. for steam locos) are automatically copied.  E.g.    BITMAP Diesel would process both Diesel.bmp and DieselM.bmpBITMAP Steam would process SteamX.bmp SteamM.bmp and the animation frames Steam0.bmp, Steam1.bmp, Steam2.bmp etc.

Check

CHECK    <Bitmap name>     <Message>

Checks that the given bitmap can be found, and if not available prompts the user with the given message.

This command should be used when installing a script that references bitmaps from another module.  If the module has not already been installed, the bitmaps will not be found and the user can be prompted to install the required module.

Example

Check 76g    Please download and install Tony Willmore's Diesel and Electric.

Delete

DELETE    <Scene Name>

Deletes the specified scene from the active scene file.  This should be used before writing a new scene to the scene file in order to avoid duplication.

Example

Delete Woodhead
Write ______________________________________________________________________
Write [Woodhead]
        etc

Insert

INSERT
    AFTER <search for text>
        <insert text>
        [ further lines of insert text]
[    AFTER <search for text>     ]
        <Insert text>
ENDINSERT

This command inserts lines within the active scene file.

Following the INSERT command, the active scene file is opened at the beginning of the file.  The process then searches forward through the file until the first search term (text following the AFTER) is matched, subsequent lines from the setup script are inserted after the search term until ENDINSERT is reached.

If a second or subsequent AFTER is found, the program then searches forward from the current point until the search term is found, insertion continues after the line with the search text is found.

If the search text specified with the AFTER element is not found, the insert operation is aborted and script processing continues after the EndInsert command.

Example

INSERT
    AFTER    Definitions
        define MIXUSA MIX({8..10},"BoxCarPrr.bmp","Gondola.bmp")
ENDINSERT

The active scene file is opened at the beginning and then searched forward until a line beginning "Definitions" is found.  "define MIXUSA" etc is inserted after the line beginning "Definitions".

Example

Insert
    After [Depot]
    After Train={17|2*20}, Max=30
        Train={"14g.bmp"|"15g.bmp"|"17g.bmp"|"20g.bmp"|"20gr.bmp"}
        Train={"22g.bmp"|"23g.bmp"|"24g.bmp"|"25-1g.bmp"|"25-3g.bmp"}

    After Train=<50>{85g}, Max=30
        Train={"81e.bmp"|"82e.bmp"|"83e.bmp"|"84e.bmp"|"85e.bmp"|"86e.bmp"}
    After Train=<50>{87|90}, Max=30
        Train={"81b.bmp"|"82b.bmp"|"83b.bmp"|}
EndInsert

The active script file is opened and searched forward to find the line starting "[Depot]".  It is then searched forward from this point to find "Train={17|2*20 etc.  After this line two new train definitions are inserted.   Next the script is searched forward from this point to find the line "Train=<50>{85g etc and one line is inserted after this.  etc

Message

MESSAGE <text>

Displays the specified text as a message to the user.

MkDir

MKDIR    <sub-folder name>

Creates a sub-folder with the specified name.

Move

MOVE    <file name>      <sub-folder name>

Moves the specified file from the module into the specified sub-folder.

For bitmaps the bitmap command is recommended.  This command could be used for example to move an .r32 file which would then be called with an include command in the scene file.

Run

RUN    <scene name>

Runs the specified scene.

Example

Delete Woodhead
Write ______________________________________________________________________
Write [Woodhead]
Append Scene.txt

Run    Woodhead

Script

SCRIPT    Custom | Standard | Narrow

Specifies the active scene file (the scene file to be used for subsequent commands)

Write

WRITE    <text>

Writes the given text to the end of the active scene file.