Difference between revisions of "Property Element"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>JRoush
imported>JRoush
Line 59: Line 59:
== Text ==
== Text ==
Properties specific to the [[Menu Element#Text|Text Element]]
Properties specific to the [[Menu Element#Text|Text Element]]
*'''Red, Green, Blue''' (Numeric) Specifies the color of the text element. Values are from 0 to 255 and use html colors. Example: "red 0, green 0, blue 0" results in a black color, "red 255, green 0, blue 0" results in a red color. Any combination can be made.
*'''String''' (String) The text to be displayed.
*'''Red, Green, Blue''' (Numeric) Specifies the color of the text. Values are from 0 to 255 - the greater the value, the more of that color. Example: "red 0, green 0, blue 0" results in a black color, and "red 255, green 0, blue 0" results in a red color. Any combination can be made.
*'''Font''' (Numeric) Specifies the font for the text element. Values are from 1 to 5, associated with the Oblivion.ini fonts. When missing or with an invalid number the game will default it to 1.
*'''Font''' (Numeric) Specifies the font for the text element. Values are from 1 to 5, associated with the Oblivion.ini fonts. When missing or with an invalid number the game will default it to 1.
*'''Justify''' (Numeric) Specifies where the text begins relative to the element's position. Options are "&left;", "&center;" and "&right;". Can be used to align things but will require adjustments to the element's position when not using "&left;". Example, using "&left;" the text will start at the same position of the element. But when using "&center;" the text will be positioned in a way that puts the center of the text at the position of the element. Using "&right" will position the text in a way that puts the end of it at the same position of the element.
*'''Justify''' (Numeric) Specifies where the text begins relative to the element's X coordinate. Options are "&left;", "&center;" and "&right;":
  || Is root position of the text element
  <text>
    <string> Hello World </string>
|| (<justify> &left; </justify>)
    <justify> &right; </justify>
  Hello World.
  </text>
    || (<justify> &center; </justify>)
<text>
  Hello World.
    <string> Hello World </string>
            || (<justify> &right; </justify>)
    <justify> &center; </justify>
  Hello World.
  </text>
*String
<text>
*Wrapwidth
    <string> Hello World </string>
    <justify> &left; </justify>
</text>
 
Output ("X" marks the X position of the element):
          X
  Hello World
      Hello World
          Hello World
*'''Wrapwidth''' (Numeric) the maximum width, in pixels, of the element.  If the text is long enough to extend past this width, it is split into multiple lines.  This is the only way to control the size of a text element - the width and height properties set by the game engine to whatever the final dimensions of the element end up being.


== Menu ==
== Menu ==

Revision as of 23:58, 18 December 2009


Property Elements are a subgroup of the elements in the Oblivion XML schema, always found as children of Menu Elements. Loosely put, property elements define the properties of their parent element - position on the screen, color, texture, etc. In this sense they are similar to traditional xml traits.

There are two basic data types for properties - numeric and string. A number of Oblivion-specific XML entities are defined for commonly used constants of both types. Particularly useful are the numeric entities "&true;" (numeric value 2) and "&false;" (1), used to with boolean properties like Visible or Targetable.

Property elements may contain literal values, or a set of Operator Elements as children (but not both). When the menu is rendered, the Oblivion parser evaluates each property element to obtain the value of the property (see the operator element page for a description on how they are evaluated). If a menu element contains more than one property element of the same type, the last one defined will take precedence. If it contains no property elements for an applicable property, the default value is used (usually zero or the empty string).

General

Properties which any menu element of any type might define.

  • ID (Numeric) Specifies which part of the internal menu "class" the element corresponds to, for the purposes of updating and accepting player input. For example, the game treats whatever element has an ID of 3 in the Recharge menu as the exit button, regardless of the type, name, or any other property of the element - if it can be clicked on, then doing so will close the menu. Likewise, the element with ID 2 in the Enchantment Settings menu is treated as the effect icon and will have its filename property updated by the game (even if it shouldn't have one). Valid ID values depend on the menu class, but generally range 1-20. Giving an element an ID not recognized for that menu will have no effect, while changing an existing ID will prevent the element from updating or accepting input.
  • User# (type flexible) Element types beginning in "user" are not in general part of the Oblivion XML schema. They may, however, be recognized by specific menu classes and set to specific values. For example, in most contexts an element of type User4 would be parsed and then ignored. The internal class of the Spellmaking menu, though, will look for a User4 property element that is a child of the root Menu Element, and update its value to the current magicka cost.

Sizeable

Properties defining the size and screen position of a menu element, and possibly its children.

  • X,Y (Numeric) The coordinates (in pixels) of the upper-left hand corner of an element. These coordinates can be absolute or relative to the position of the parent element (see Locus). For text elements, this marks the "root" position (see Justify).
  • Height, Width (Numeric) The height and width (in pixels) of the element. For text elements, the width and height are set by the game engine automatically depending on the font and text contents.
  • Locus (Numeric: Boolean) If true then the elements coordinates are taken as relative to the position of its parent. If false, then the elements coordinates are taken as absolute, from the upper-left hand corner of the screen.

Rendered

Properties for any menu element with a visible effect, i.e. Image and Text elements. Note, however, that setting the Visible property to false on any element will hide all of it's children.

  • Visible
  • Alpha
  • Depth
  • Clips

Mouse Targetable

Properties for any menu elements that can be the focus of mouse events, i.e. the Image and Rect elements.

  • Target (Numeric: Boolean) If true, the element may have mouse or keyboard focus - the Mouseover and Clicked traits will be set accordingly by the engine, and clicking on the element will play the corresponding Clicksound. If false, then the element is just part of the background, and won't react to player input at all.
  • Clicksound (Numeric) Which in-game click sound effect to play when the element is clicked.
  • Mouseover (Numeric) For targetable elements, this property is set automatically by the game engine. Its value is 1 when the element has mouse focus, and 0 at all other times.
  • Clicked (Numeric) For targetable elements, this property is set automatically by the game engine. Its value is 1 for a single frame after the element is clicked by the mouse. There are a number of clever uses for this property - the generic scroll bars, for example, use it to count how many times the player has clicked on the increase/decrease buttons.

Textured

Properties specific to the Image Element. Note that the texture displayed by an image element is automatically cropped to fit within the elements width and height.

  • Filename (String) Specifies the .dds texture file that the element will display. The file path should be specified relative to the Oblivion\Data\Textures\ directory.
  • Zoom (Numeric) Specifies the zoom percentage of the image. Setting it to 0 will result in a hidden image and can be larger than 100 to magnify the source texture. When using a value of -1 the image will be resized to fit the width and height of the element (and therefore not cropped).
  • CropX,CropY (Numeric) Specify the point on the texture, in pixels, that will be placed at the upper left hand corner of the image element. Because the texture is cropped to fit inside the image element, this essentially cuts CropX pixels off of the left of the image and CropY off of the bottom. Note: CropX/CropY are calculated after the zoom property has been applied, so the point (5,10) in the original image would be (10,20) after a 200% zoom.

Examples using all_small_icons.dds (a 384x32 texture containing twelve 32x32 icons in a horizontal row)

<image name="MyIcon">
   <!-- Display the gold piece icon, which is 8th from the left -->
   <filename> Menus\Shared\all_small_icons.dds </filename> 
   <width> 32 </width>
   <height> 32 </height>
   <cropx> 224 </cropx> <-- 7*32 = 224 -->
</image>
<image name="MyIcon">
   <!-- Same as above, but at 200% size -->    
   <filename> Menus\Shared\all_small_icons.dds </filename>
   <zoom> 200 </zoom>
   <width> 64 </width> <-- 32*200% = 64 -->
   <height> 64 </height>
   <cropx> 448 </cropx> <-- 7*32*200% = 448 -->
</image>

Text

Properties specific to the Text Element

  • String (String) The text to be displayed.
  • Red, Green, Blue (Numeric) Specifies the color of the text. Values are from 0 to 255 - the greater the value, the more of that color. Example: "red 0, green 0, blue 0" results in a black color, and "red 255, green 0, blue 0" results in a red color. Any combination can be made.
  • Font (Numeric) Specifies the font for the text element. Values are from 1 to 5, associated with the Oblivion.ini fonts. When missing or with an invalid number the game will default it to 1.
  • Justify (Numeric) Specifies where the text begins relative to the element's X coordinate. Options are "&left;", "&center;" and "&right;":
<text> 
   <string> Hello World </string>
   <justify> &right; </justify>
</text>
<text>
   <string> Hello World </string>
   <justify> &center; </justify>
</text>
<text>
   <string> Hello World </string>
   <justify> &left; </justify>
</text>
Output ("X" marks the X position of the element):
          X 
Hello World
     Hello World
          Hello World
  • Wrapwidth (Numeric) the maximum width, in pixels, of the element. If the text is long enough to extend past this width, it is split into multiple lines. This is the only way to control the size of a text element - the width and height properties set by the game engine to whatever the final dimensions of the element end up being.

Menu

Properties specific to the Menu Element

  • Class (Numeric) Specifies which internal menu "class" to use for handling input & output to the menu. Values match those returned by MenuMode, but are generally specified using a set of XML entities closely based on the menu name (e.g. "&RechargeMenu;" for the Recharge menu, with numerical value 1049). Values for which no internal menu class exists (like zero) will result in a "dead" menu - the menu will open, but will not be updated or accept input.
  • Stackingtype (Numeric) Specifies whether or not the menu blocks the use of other menus and or the gameplay controls while open. Most menus do; only the HUD and the magic effects popup do not by default. Possible values are "&no_click_past;" (numerical value 6006) and "&does_not_stack;" (6008), although any value other than 6006 appears to cause non-blocking behavior.
  • Menufade (Numeric) Specifies the duration (in seconds) of the "fade in" and "fade out" effect when the menu is opened and closed, respectively. While fading, the menu is open but does not update or accept input.