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

From HLKitWiki
Jump to: navigation, search
 
Line 7: Line 7:
 
===Replace Content ===
 
===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.
+
The Skeleton data files provide a "static" form 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.
+
Looking at the contents of the "static" form 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 in one portal involved: a dynamic label that incorporates both a identifying prefix and the character data. We'll follow the same logic, resulting in three 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 three portals.
  
 
<pre>
 
<pre>
<portal
 
  id="lblhealth"
 
  style="lblStatic">
 
  <label
 
    text="Health: ">
 
    </label>
 
  </portal>
 
 
 
<portal
 
<portal
 
   id="health"
 
   id="health"
 
   style="lblStatic">
 
   style="lblStatic">
   <label
+
   <label>
    field="acDmgSumm">
+
     <labeltext><![CDATA[
     </label>
+
      @text = "Health: " & herofield[acDmgSumm].text
  </portal>
+
      ]]></labeltext>
 
+
<portal
+
  id="lblpower"
+
  style="lblStatic">
+
  <label
+
    text="Power: ">
+
 
     </label>
 
     </label>
 
   </portal>
 
   </portal>
Line 39: Line 25:
 
   id="power"
 
   id="power"
 
   style="lblStatic">
 
   style="lblStatic">
   <label
+
   <label>
    field="acPPSumm">
+
     <labeltext><![CDATA[
     </label>
+
      @text = "Power: " & herofield[acPPSumm].text
  </portal>
+
      ]]></labeltext>
 
+
<portal
+
  id="lblbennies"
+
  style="lblStatic">
+
  <label
+
    text="Ben: ">
+
 
     </label>
 
     </label>
 
   </portal>
 
   </portal>
Line 57: Line 37:
 
   <label>
 
   <label>
 
     <labeltext><![CDATA[
 
     <labeltext><![CDATA[
       @text = hero.child[trkBennies].field[trkUser].value
+
       @text = "Bennies: " & hero.child[trkBennies].field[trkUser].text
 
       ]]></labeltext>
 
       ]]></labeltext>
 
     </label>
 
     </label>
   </portal>  
+
   </portal>
 
</pre>
 
</pre>
  
 
===Positioning Everything===
 
===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.
+
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 axis, the portals simply line up, left to right, with suitable gaps between them. The final task 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.
  
 
<pre>
 
<pre>
~position the health portals horizontally
+
~position the health portal on the left
portal[lblhealth].left = 0
+
portal[health].left = 0
perform portal[health].alignrel[ltor,lblhealth,5]
+
 
~position the power point portals horizontally or hide them if not applicable
+
~position the power point portal horizontally or hide it if not applicable
 
var x as number
 
var x as number
 
if (hero.tagis[Arcane.?] <> 0) then
 
if (hero.tagis[Arcane.?] <> 0) then
   perform portal[lblpower].alignrel[ltor,health,15]
+
   perform portal[power].alignrel[ltor,health,15]
  perform portal[power].alignrel[ltor,lblpower,5]
+
 
   x = portal[power].right
 
   x = portal[power].right
 
else
 
else
  portal[lblpower].visible = 0
 
 
   portal[power].visible = 0
 
   portal[power].visible = 0
 
   x = portal[health].right
 
   x = portal[health].right
 
   endif
 
   endif
~position the Bennies portals horizontally
+
 
portal[lblbennies].left = x + 15
+
~position the Bennies portal horizontally
perform portal[bennies].alignrel[ltor,lblbennies,5]
+
portal[bennies].left = x + 15
~our dimensions are the extent of our portals
+
 
 +
~hide any portals that don't fully fit within the visible horizontal space
 +
if (portal[power].right > width) then
 +
  portal[power].visible = 0
 +
  endif
 +
if (portal[bennies].right > width) then
 +
  portal[bennies].visible = 0
 +
  endif
 +
 
 +
~our height is the bottommost extent of our portals
 
height = portal[bennies].bottom
 
height = portal[bennies].bottom
width = portal[bennies].right
 
 
</pre>
 
</pre>

Latest revision as of 02:35, 18 December 2008

Context: HL KitAuthoring 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" form 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" form 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 in one portal involved: a dynamic label that incorporates both a identifying prefix and the character data. We'll follow the same logic, resulting in three 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 three portals.

<portal
  id="health"
  style="lblStatic">
  <label>
    <labeltext><![CDATA[
      @text = "Health: " & herofield[acDmgSumm].text
      ]]></labeltext>
    </label>
  </portal>

<portal
  id="power"
  style="lblStatic">
  <label>
    <labeltext><![CDATA[
      @text = "Power: " & herofield[acPPSumm].text
      ]]></labeltext>
    </label>
  </portal>

<portal
  id="bennies"
  style="lblStatic">
  <label>
    <labeltext><![CDATA[
      @text = "Bennies: " & hero.child[trkBennies].field[trkUser].text
      ]]></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 axis, the portals simply line up, left to right, with suitable gaps between them. The final task 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 portal on the left
portal[health].left = 0

~position the power point portal horizontally or hide it if not applicable
var x as number
if (hero.tagis[Arcane.?] <> 0) then
  perform portal[power].alignrel[ltor,health,15]
  x = portal[power].right
else
  portal[power].visible = 0
  x = portal[health].right
  endif

~position the Bennies portal horizontally
portal[bennies].left = x + 15

~hide any portals that don't fully fit within the visible horizontal space
if (portal[power].right > width) then
  portal[power].visible = 0
  endif
if (portal[bennies].right > width) then
  portal[bennies].visible = 0
  endif

~our height is the bottommost extent of our portals
height = portal[bennies].bottom