Define a constant on commandline for Inform 6 compiler?

As described here: Inform 6 Reference Addendum

!% [header comment] options take precedence over command-line options. Command-line options are read in order; later options (including (file.icl) inclusions) take precedence over earlier ones.

But when defining symbols, precedence doesn’t matter. If you try to define a symbol to two different values, that’s an error. Same error as writing

Constant FOO = 1;
Constant FOO = 2;

…in your code.

1 Like

Now I have the opposite problem. I would like to undefine a constant on the command line.

If I have a file with the following line:

Constant DEBUG;

I would like to override this from the command line, the following syntax gives this result:

H:\Documents\Interactive Fiction\Source\Inform6\Source\nada>inform636 -r $TRANSCRIPT_FORMAT=1 $MAX_ABBREVS=96 $#DEBUG=0 nada.inf
Inform 6.36 for Win32 (in development)
nada.inf(29): Error:  "DEBUG" is a name already in use and may not be used as a new constant name (Defined constant "DEBUG" was defined at compiler setup)
> Constant DEBUG
Compiled with 1 error (no output)

My suggested syntax for this would be something like:


(Why would I need something like this, well…
I would like to script a release output of gametext.txt and generate abbreviations from this, then compile the final game with the directives the author intended. This is to use ZAbbrevMaker when scriping in Puddle BuildTools.)

Is this anyway possible and/or desirable?

Doesn’t make sense as a request, I’m afraid. The compiler starts with the command-line options and then goes through the text in order. You can’t tell it to ignore a Constant DEBUG line when it gets there.

Anyway, the point of the DEBUG constant is that you can control it with the -D switch. Defining it in source code is kind of getting off on the wrong foot.