String Importer

From C4 Engine Wiki
Jump to navigation Jump to search

The String Importer is a plugin that ships with the C4 Engine, and it generates string table resources in the engine's proprietary .str file format.

The String Importer can be run by choosing Import String Table from the C4 Menu or by typing istring [name] in the Command Console. If the Import String Table menu item is selected (or name is omitted from the console command), then a dialog appears to let you select a text file from the Import directory.

The text file to be imported must conform to the OpenDDL format. A single data structure type called Entry is used to declare each string together with its ID as follows.

Entry (id = 'abcd') {string {"The string."}}

The id property accepts a 32-bit unsigned integer that is usually expressed as a four-character code, as in the above example. The identifiers are used to select strings in the imported resource.

Strings may be organized into a hierarchy that is up to five levels deep by including Entry structures inside the data payloads of other Entry structures as in the following example.

Entry (id = 'type')
{
    string {"Top-level string"}
    Entry (id = 'abcd') {string {"Substring 1"}}
    Entry (id = 'efgh') {string {"Substring 2"}}
}

Here, the string with ID equal to StringID('type') is "Top-level string", the string with ID equal to StringID('type', 'abcd') is "Substring 1", and the string with ID equal to StringID('type', 'efgh') is "Substring 2".

See Also