This section contains known and intentional differences between the PCC 1.x and the PCC2 version of the scripting language. Often, new versions of PCC 1.x or PCC2 introduce new commands, functions or properties. Those are referenced in the Version Index.

Implementation Differences

The basic principle of the script interpreter differs completely between PCC 1.x and PCC2. Whereas PCC2 compiles a script into an internal representation before executing it (like most script interpreters do today), PCC 1.x interprets the script line-by-line. This allows PCC 1.x to execute scripts with much less memory than PCC2, which is an issue for a DOS application, but is no longer relevant today.

Other differences:

  • In PCC 1.x identifiers are truncated to 31 characters. PCC2 allows up to 255 (this limit is imposed by PCC2 using similar file formats as PCC 1.x).
  • PCC 1.x limits string values to 255 characters. PCC2 does not. PCC 1.0.18 can read long property fields written by PCC2, and truncates accordingly.
  • PCC 1.x allows unterminated string constants; the constant ends at the end of the line. PCC2 does not allow that. Likewise, code that is never executed can be syntactically invalid in PCC 1.x; PCC2 does not permit that.
  • PCC 1.x uses 48-bit floating point internally and externally. PCC2 uses 64-bit floating point internally and 48-bit externally.
  • Error messages may read differently.
  • In PCC 1.x, not all arguments of a function/operator may be evaluated when one of them is EMPTY (this is undefined, actually). PCC2 generally evaluates them all.
  • PCC 1.x has a rather weird name lookup scheme. In particular, it does not prevent you from defining subroutines named If or similar, which would then break almost everything. PCC2 has an (almost) consistent name resolution scheme. Elementary Commands and Elementary Functions, many of which have a special syntax, are reserved and cannot be overridden. Everything else is found using regular name lookup.
  • In some cases, name lookup rules can break things that used to work. Whereas PCC 1.x allows you to evaluate Hull(17) or even Hull(Hull$) in ship context, PCC2 does not, because in ship context, Hull refers to the ship's Hull property. In PCC 1.x, this worked because Hull was an elementary function (all functions were elementary in PCC 1.x, except for a really small number of array properties).
    I am considering implementing a hack around this, though, because it's pretty annoying.
  • Cfg() does not distinguish Integer and Boolean options, and always returns Integer.
  • System.Err can be localized in PCC2. In PCC 1.x, the last error caught using Try/Else was stored in a global System.Err property. In PCC2, you can define a local variable of that name to catch the error messages without disturbing the caller.

Unimplemented Features

  • Beams(), Engines(), Hulls(), Launchers(), Minefields(), Planets(), Players(), Ships(), Storms(), Torpedoes(): the plural array names are not implemented in PCC2. Use the singular names (e.g. Ship(), Torpedo()) instead. Although PCC 1.x originally introduced the plural names, singular names have been supported and preferred since PCC 1.0.18. Their main advantage is that they are consistent between use as array for indexing, and use in ForEach.
  • Hull().Special.Str, Ship().Hull.Special.Str: These properties have been obsolete since PCC 1.1.12 and have just returned an empty string since then. PCC2 drops them entirely.
  • PCC 1.x allows On xxx Do Return to exit a hook. Everything added after that line is not executed. This is not supported in PCC2.