ImageField Element (Data)

From HLKitWiki
Jump to: navigation, search

Context: HL KitKit Reference … Data File Reference … Portal Element (Data) 

The "image_field" Element

The role of the "image_field" element is to display an image to the user, where the actual image is determined by the contents of a field. If you have a situation where you need to display a different image based on the situation, you have two choices. The first option is to have separate image portals for each and manage the visibility so only the correct one is shown. The second option is to have one field-based image portal and select the proper image via a script. The latter approach is often easier. The complete list of attributes for this element is below.

field Id – Specifies the unique id of the field whose contents dictate the image to to be displayed within the portal. The field must be a text-based field and its contents are assumed to specify the filename of a bitmap image within the data file folder for the game system. The field must exist within the pick/thing associated with the containing template. If this portal is not defined within a template, a field-based image is not allowed.
istransparent (Optional) Boolean – Indicates whether the image should be treated as transparent, wherein the pixel color at position 0,0 is considered transparent throughout the image. Default: "no".


The following example demonstrates what a field-based image portal might look like. All default values are assumed for optional attributes.

<portal id="image" style="imgNormal">
  <image_field field="imagefile"/>