var

Takes one argument:

the name of the variable to look up.

Returns the contents of the variable (empty if the variable does not exist).

setvar

Takes two arguments:

the name of the variable to store the value in.

the value to store in the variable.

Returns the value stored (pass-through).

combine

Takes two arguments:

the first part of the full string.

the second part of the full string.

Returns the full string.

write

Takes two arguments:

the path of the output file.

the content to write to the output file.

Returns the content written to the output file, even if writing failed (pass-through).

load

Takes one argument:

the path of the input file.

Returns the content loaded from the input file, or empty string if loading failed.

replace

Takes three arguments:

the original string.

the phrase to replace where-ever found in the original string.

the phrase to be put into the string where the replacement phrase is found and removed.

Returns the result of the replacement operation.

display

Takes one argument:

the string to be shown in standard output.

Returns the argument (pass-through).

wait

Takes no arguments.

Waits for getchar() from stdin before proceeding. Useful if you want to prevent the console window from closing as soon as the script finishes, so that you can read the output and use it to debug your script.

Returns nothing.

exec

Takes one argument:

The path of the script file to execute.

Absolute paths will break this horribly. They will probably work alright if a script is called by an absolute path from the highest caller, because at that point the environment offset is an empty string, but in other cases, the absolute path will just be appended to the environment string and not work as probably intended. Subscript is designed for relative paths.

File paths in the script file are local to it, not to the calling file. (This means you don't have to consider the location of the calling script if you're writing a script that will be called, but if you do need to cross the boundaries between scripts in different locations [for example, having a called script set a variable to a path that a calling script will try to use] then you can use the `path` and `localpath` functions.)

Returns nothing.

path

Takes one argument:

The local path as seen by the current script.

Note: does not work well, or at all, for absolute file paths.

Returns the same or a longer path, which is relative to the highest caller's location.

localpath

Takes one argument:

The "long" version of the path, which is relative to the highest caller's location.

Note: does not work well, or at all, for absolute file paths.

Returns the same or a shorter path, which is relative to the current script's location.

cmd

Takes one argument:

The string to pass to the system command shell.

Returns nothing.

/*

Takes one argument after the skipping operation is complete, and returns it (pass-through).

This is so that something like this:

display

combine

/* East */ West

Coast

is not broken. If it took no arguments and returned nothing, that type of thing would not behave intuitively.

Begin comment. Will search to the end of file for a corresponding "*/" and ignore anything else before it.

These are implemented as functions to keep the parser as simple as possible. If you do not put spaces between them (or don't put them in quotes) then you likely will get undesired behavior. For example, /*display write file.txt Hello*/ will do the following:

/*display will be interpreted as a string literal, rise to the top level, and be discarded.

write will be recognized as a function, and take its arguments to be file.txt and Hello*/, causing Hello*/ to be written to file.txt. This is likely not what the programmer intended.

//

Takes one argument after the skipping operation is complete, and returns it (pass-through).

This is so that something like this:

display

combine

West // East

Coast

is not broken. If it took no arguments and returned nothing, that type of thing would not behave intuitively.

Begin line comment. Will cause all characters to be skipped, until the file has ended or a newline has been reached.

This is implemented as a function to keep the parser as simple as possible. If you do not put spaces around it (or don't put it in quotes) then you likely will get undesired behavior. For example, //display write file.txt Hello will do the following:

//display will be interpreted as a string literal, rise to the top level, and be discarded.

write will be recognized as a function, and take its arguments to be file.txt and Hello, causing "Hello" to be written to file.txt. This is likely not what the programmer intended.

routine

Marks a routine that can be executed later. It takes one normal argument, the name of the routine, saves the starting location under that name, and skips over the contents of the routine until the file ends or end is encountered.

Returns nothing.

Just like variables, routines may be redefined even if they are already set. Also just like variables, a routine can still be accessed outside the file that sets it.

A script is allowed to define a routine within a routine, such as for the purpose of having a routine set several routines to behave a certain way. For example,

routine debug_off

routine debug end

end

routine debug_on

routine debug

display

combine

"(DEBUG) "

var debug_msg

wait

end

end

is valid.

end

Marks the end of a routine. Takes no arguments and returns nothing.

An end does not "kill" the routine immediately, but rather only once the top level of the stack is reached. So, to clear several temporary variables at the tail-end of a routine, one could write:

setvar temp_var_1 setvar temp_var_2 setvar temp_var_3 end

do

Takes one argument, the name of the routine to execute. Returns nothing.