Fields

From HLKitWiki
Revision as of 13:58, 21 November 2008 by Rob (talk | contribs)
Jump to navigationJump to search

[Context: HL Kit … Basic Concepts and Terminology … Structural Building Blocks]

Overview

Field represent values that can be assigned to things. For example, a weapon might have a field to specify the damage it does, while a skill would have a field to track how proficient the character is with that skill. Fields can be specified as being either numeric or text-based in nature, with text-based fields requiring that a maximum character length be designated.

Fields are defined within components. As such, a given field is inherited by every compset that incorporates the component it is defined within. This means that the fields possessed by a thing are dictated by the compset it is based upon, with all the fields defined within the compset's constituent components being possessed by the thing.

Every component can define zero of more fields. No fields are actually required for a component, and there are times when using no fields is appropriate, but most components will be defined with at least one field.

Field Values

Fields can be assigned a default value when defined within a component. This value will be inherited as the default value for every thing that includes the field. When defining a thing, you can either inherit the default value for a field or specify the appropriate value to use for it.

The values of fields can be dynamically modified at run-time in response to events triggered by user selections. Many fields will be wholly derived at run-time, such as a character's attack skill with a particular weapon, which must be calculated from all the various factors that contribute to the final result. This is achieved via the use of scripts.

The Kit also supports the definition of fields as both arrays and matrices. If this is done, the maximum dimensions of the array or matrix must be specified and HL will allocate storage for all elements in the array/matrix. Further details on arrays and matrices are defined as an advanced concept.

NOTE! Any attempt to assign a text value longer than the defined maximum to a given field will result in the text being truncated at the maximum length.