Revamp the "Static" Form (Savage): Difference between revisions

From HLKitWiki
Jump to navigationJump to search
No edit summary
(No difference)

Revision as of 09:26, 18 December 2008

Context: HL Kit … Authoring Examples … Savage Worlds Walk-Through 

Overview

The area across the top of the main HL window is referred to as the "static" form (or sometimes panel), and now is an excellent time to re-work its contents for Savage Worlds. The form contents are defined within the file "form_static.dat".

Replace Content

The Skeleton data files provide a "static" panel with some standard, basic elements that we'll revise and adapt. The character name should almost never need to be changed, and we can definitely leave it untouched for Savage Worlds. Since Savage Worlds also supports multiple races, we can also leave the race chooser in place. For the remaining elements, we need to determine what users will find most helpful to have visible for Savage Worlds. While there is no "right" answer, we're going to settle on showing the character's health, power points, and Bennies.

Looking at the contents of the "static" panel within the data files, there are three visual elements (portals and templates) that comprise the layout. All of the information that we're going to be replacing is found within the "stActor" template, so we'll focus our attention there. For each piece of information, there are two portals involved: a static label that identifies the contents and a dynamic label that presents the character data. We'll follow the same logic, resulting in three pairs of portals. For the health and power points, we can display the summary fields that are already being synthesized on the "Actor" component. For the Bennies, we'll need to directly access the value we want to display. The net result is the following.

<portal
  id="lblhealth"
  style="lblStatic">
  <label
    text="Health: ">
    </label>
  </portal>

<portal
  id="health"
  style="lblStatic">
  <label
    field="acDmgSumm">
    </label>
  </portal>

<portal
  id="lblpower"
  style="lblStatic">
  <label
    text="Power: ">
    </label>
  </portal>

<portal
  id="power"
  style="lblStatic">
  <label
    field="acPPSumm">
    </label>
  </portal>

<portal
  id="lblbennies"
  style="lblStatic">
  <label
    text="Ben: ">
    </label>
  </portal>

<portal
  id="bennies"
  style="lblStatic">
  <label>
    <labeltext><![CDATA[
      @text = hero.child[trkBennies].field[trkUser].value
      ]]></labeltext>
    </label>
  </portal> 

Positioning Everything

The positioning of the various portals within the template is quick and painless. All of the portals use the same style, so they all have the same height characteristics. Consequently, we can ignore vertical alignment altogether. Along the horizontal plane, the portals simply line up, left to right, with suitable gaps between them. The final thing we need to do is determine the dimensions of the template based on the contents within, so we simply determine the extent of the rightmost and bottommost portals. The only thing special we need to accommodate is that a character without an arcane background should not show any power points, so we need to hide it when necessary. This yields a Position script that looks something like the one below.

~position the health portals horizontally
portal[lblhealth].left = 0
perform portal[health].alignrel[ltor,lblhealth,5]
~position the power point portals horizontally or hide them if not applicable
var x as number
if (hero.tagis[Arcane.?] <> 0) then
  perform portal[lblpower].alignrel[ltor,health,15]
  perform portal[power].alignrel[ltor,lblpower,5]
  x = portal[power].right
else
  portal[lblpower].visible = 0
  portal[power].visible = 0
  x = portal[health].right
  endif
~position the Bennies portals horizontally
portal[lblbennies].left = x + 15
perform portal[bennies].alignrel[ltor,lblbennies,5]
~our dimensions are the extent of our portals
height = portal[bennies].bottom
width = portal[bennies].right