EDF string reference

From Eternity Wiki
Revision as of 15:04, 3 March 2012 by Printz (talk | contribs) (Created page with "New to EDF 1.4, strings allow custom messages to be defined which may be used directly by various game engine subsystems and can be used by other facilities such as the [[ShowMes...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

New to EDF 1.4, strings allow custom messages to be defined which may be used directly by various game engine subsystems and can be used by other facilities such as the ShowMessage codepointer.

Each string must be given a unique mnemonic in its definition's header, and this is the name used to identify the string elsewhere. Each field in the string definition is optional. If a field is not provided, it takes on the default value indicated below the syntax information. Fields may also be provided in any order.

As of EDF 1.5, string definitions may also be provided within special lumps named ESTRINGS. The ESTRINGS lump is parsed separately after the root EDF has been processed, and thus all string definitions found within the ESTRINGS lump are additive over those defined through the root EDF. If string definitions within the ESTRINGS lump have the same mnemonic as one already defined, they will overwrite the original definitions (note this also includes the numeric id field).

Back to EDF

Syntax

string <mnemonic>
{
   num <unique number>
   val <string>
}

Explanation of Fields

  • num
Default: -1
Some subsystems which use EDF strings, such as the ShowMessage codepointer, require the strings they use to have a numeric ID. This field sets the optional numeric ID of an EDF string to the value given. The default of -1 means that the string has no numeric ID and is thus not accessible to such subsystems. This ID number must be unique unless it is equal to -1.
  • val
Default = ""
This is the text which will be stored inside the string object.

Restrictions and Caveats

  • All strings must have a unique mnemonic no longer than 32 characters. They should only contain alphanumeric characters and underscores. Length will be verified, but format will not (non-unique mnemonics will overwrite previous definitions, see below). All string mnemonics beginning with an underscore character are reserved for use by strings for which the use is engine-defined. See a list below for engine-defined string mnemonics.
  • All strings with a numeric ID not equal to -1 must have a unique numeric ID. Any strings with a non-unique numeric ID will cause an error.

Replacing Existing Strings

To replace the values of an existing EDF string definition, simply define a new string with the exact same mnemonic value (as stated above, all strings need a unique mnemonic, so duplicate mnemonics serve to indicate that an existing string should be replaced).

Full Example

# Define a string for use by the ShowMessage codepointer

string CyberMsg
{
   num 0;
   val "Moooo!";
}

# Define a string for use by the intermission
# See below for notes on reserved mnemonics and how the game engine uses them.

string _IN_NAME_MAP01 { val = "The Slough of Despond" }

Engine-Defined String Mnemonics

The following string mnemonics, if defined and properly enabled, will be used by game engine subsystems directly for the indicated purposes. All reserved mnemonics start with underscores. Using mnemonics that begin with underscores for your own strings is done at your own risk, since this may break compatibility of your patch with future versions of the Eternity Engine.

Mnemonic Name or Class           Purpose                         Use Enabled By
-------------------------------------------------------------------------------
_IN_NAME_*                       Intermission map names          MapInfo
-------------------------------------------------------------------------------