Cfg(key:Str, [player:Int]):Any

Access host configuration. The first parameter is the name of a configuration option as used in pconfig.src, such as "AllowHiss" or "UnitsPerTorpRate". The function returns the value of this option, an integer or string.

If the option is an array option, the second parameter can be specified to determine which player's value to get. When the second parameter is not specified for an array option, the return value is the value for your race.

Version Differences: This function was available with a different, more complicated definition in PCC 0.98.5 up to 1.0.8, under the names Cfg and CfgL.

Version Differences: The detail behaviour for array options differs between versions. Since 2.0.7, the behaviour is as follows:

  • for regular per-player options, the second argument is optional and defaults to the current player. If EMPTY is given, the result is empty. Earlier versions of PCC2 reject EMPTY.
  • for ExperienceLevelNames and Language, if the second argument is given, the respective element is returned. If no second argument is given, the entire option is returned as a string. Versions before 2.0.7 only support the no-argument version.
  • for other array options, the argument is mandatory; passing EMPTY yields empty.

PCC 1.x behaves subtly different, which is often considered a bug.

Since: PCC 1.0.9, PCC2 1.99.8

See also: Functions