Overview

Where possible, share the engine Coding Conventions.

Naming Conventions

Use only alphanumerics (A..Z, a..z, 0-9) and underscores (_) for object names and parameters. Various special characters are reserved for use as delimiters and markers (particularly semicolons).

Technically, the hyphen or dash (-) can be used interchangeably with hyphens, but you'll need to reference the string in a different way. For example:

object.cell_id

is exactly equivalent to

object["cell-id"]

Variable Casing

Functions, variables, and objects written in JavaScript should be created using camelCase capitalisation (the first word is in lowercase, and any additional words in title-case eg: setModifiedFlag()).

For XML names, use all title-casing. (Eg: MyExampleName?)

Example of conventional scripted casing:

<object name="ExampleObject" style="ModernStyle">
        <action on="Press">
            guiHide(this.name);
        </action>
</object>

XML Formatting

Some JavaScript operators (like &&) interfere with the XML parser and need to be surrounded with <![CDATA[someCode]]>. The above example with CDATA looks like:

  <object name="ExampleObject" style="ModernStyle">
          <action on="Press"><![CDATA[
                 guiHide(this.name);
          ]]></action>
  </object>
Last modified 3 years ago Last modified on Apr 30, 2014, 8:01:28 AM