Add an "Arcane" Tab (Savage)

From HLKitWiki
Jump to: navigation, search

Context: HL KitAuthoring Examples … Savage Worlds Walk-Through 


With the basics of arcane powers now in place, we need to add a suitable tab where they can be managed by the user. We'll also need this new tab to adequately test the additional handling we must still implement for arcane powers.

Something Simple to Start With

We'll use the same technique that we used previously for obtaining a simple new tab. We'll clone the "tab_skills.dat" file and convert it over for handling arcane background details. Since the primary thing we'll be showing in this tab is a table of arcane powers, we'll convert the table over for that purpose. We'll also make use of the "SimpleItem" template within the table for expedience. Arcane powers will require that we provide our own custom template to show the various fields, but this will serve as a useful placeholder for the moment.

When the conversion is done, we'll have a single portal, layout, and panel. All of them will be tailored for their new purpose, ultimately looking something like the following.

      @text = "Add an Arcane Power - " & hero.child[resPowers].field[resSummary].text
      @text = "Arcane Powers - " & hero.child[resPowers].field[resSummary].text
      ~get the color-highlighted "add" text
      @text = field[resAddItem].text

  <portalref portal="apPowers" taborder="10"/>
    ~freeze our table in advancement mode to disable adding new choices
    ~Note: All freezing must be done *before* any positioning is performed.
    if (state.iscreate = 0) then
      portal[apPowers].freeze = 1

    ~position and size the table to span the full layout; it will only use the
    ~vertical space that it actually needs
    perform portal[apPowers].autoplace

  <layoutref layout="arcane"/>

Panel Visibility

We need to address when the "Arcane" tab appears to the user. Since the panel only applies for a character that has selected an arcane background, the panel should only be shown when a character possesses such a background. The visibility of the panel can be controlled via the Live tag expression, and that tag expression can key on whether the character possesses any "Arcane" tag. This can be implemented by adding the following line to the panel definition.


Panel Linkage

Arcane powers are exclusively selected via the "Arcane" tab. As such, any errors that may arise with arcane powers should highlight the "Arcane" tab in red so the user knows where to correct them. We can automatically associate every arcane power with the "Arcane" tab by specifying the "panellink" attribute within the "Arcane" component. Set the "panellink" attribute to "arcane" to establish the linkage for all powers.