Character Sheet Refinement (Savage)

From HLKitWiki
Revision as of 03:45, 21 January 2009 by Rob (talk | contribs) (→‎Gap on Right)
Jump to navigationJump to search

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

Overview

Our basic character sheet is complete. Now we need to take a look at it and determine what is missing and/or needs to be refined.

Gap on Right

One mildly annoying facet of our character sheet is the gap that appears on the right side beneath the gear table. We need to position the adjustments and condition layout at the bottom in order to determine how much space we have left for everything else. However, if everything else doesn't need all that space, we're left with a gap that looks rather odd. It would probably look better if the layout at the bottom we positioned directly beneath the gear.

Fortunately, we can accomplish this very easily. After the gear layout is rendered within the Position script of the sheet, we can check to see if there is any open space beneath it. If there is open space, we can move the adjustments layout upwards so that it is placed immediately beneath the gear layout. This is achieved by adding the following lines of code to the very end of the Position script.

~if there is open space beneath the gear layout, move the adjustments upward
if (layout[oAdjust].top > layout[oGear].bottom + global[sectiongap]) then
  layout[oAdjust].top = layout[oGear].bottom + global[sectiongap]
  endif

Wait a minute. That's not going to work all the time. What if the gear layout doesn't fit? Looking back at all the special handling we've got for possibly omitting the gear and maybe the armory layouts, we have to handle all those cases for closing the gap. This entails extending our logic to the three different cases: gear layout present, gear layout omitted but armory layout present, and neither layout present. The revised script code should look like the following.

~if the gear layout is visible and there is open space beneath it, move the
~adjustments layout upward
if (layout[oGear].visible <> 0) then
  if (layout[oAdjust].top > layout[oGear].bottom + global[sectiongap]) then
    layout[oAdjust].top = layout[oGear].bottom + global[sectiongap]
    endif

~otherwise, do the same check with respect to the armory layout
elseif (layout[oArmory].visible <> 0) then
  if (layout[oAdjust].top > layout[oArmory].bottom + global[sectiongap]) then
    layout[oAdjust].top = layout[oArmory].bottom + global[sectiongap]
    endif

~otherwise, position relative to the right-side layout
else
  if (layout[oAdjust].top > layout[oRightSide].bottom + global[sectiongap]) then
    layout[oAdjust].top = layout[oRightSide].bottom + global[sectiongap]
    endif
  endif

Spillover Sheet