Unique Ids

From HLKitWiki
Revision as of 02:21, 15 November 2008 by Rob (Talk | contribs)

Jump to: navigation, search

[Context: Basic Concepts and Terminology]

Most objects within HL are assigned a unique identifier so that they can be easily referenced throughout the data files. For example, each thing needs to have a unique value. HL uses unique ids for naming objects. Unique ids must comply with a number of rules, as outlined below. These rules enable HL to achieve significant performance optimizations at run-time, so these restrictions are important.

  1. Unique ids can be a maximum of ten (10) characters in length.
  2. Unique ids may only contain the standard alphabetic characters (A-Z and a-z), numeric characters (0-9), and the underscore (‘_’).
  3. While it is technically legal for a unique id to start with a numeric character (0-9), it is generally NOT a good idea to do so. If a unique id begins with a numeric character, it will not be able to be used in most scripts, rules, and tag expressions (since starting with a numeric character causes Hero Lab to think the unique id is a numeric value).
  4. All unique ids must be unique within a defined context. For example, it is not valid to have two different tag groups with the unique id “mygroup”. However, it IS perfectly reasonable to have a tag group named “mine” and a rule set that is also named “mine”, since they represent different contexts.

NOTE! The notable exception to #3 above is for tags, where purely numeric ids are common (to represent ranges, levels, resource costs, etc.). Since tags are always referenced with their tag group, a purely numeric tag id incurs none of the liabilities mentioned above.