Add an "Arcane" Tab (Savage)

From HLKitWiki
Jump to navigationJump to search

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

Overview

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.

<portal
  id="apPowers"
  style="tblNormal">
  <table_dynamic
    component="Power"
    showtemplate="SimpleItem"
    choosetemplate="SimpleItem"
    addthing="resPowers"
    addspace="2">
    <titlebar><![CDATA[
      @text = "Add an Arcane Power - " & hero.child[resPowers].field[resSummary].text
      ]]></titlebar>
    <headertitle><![CDATA[
      @text = "Arcane Powers - " & hero.child[resPowers].field[resSummary].text
      ]]></headertitle>
    <additem><![CDATA[
      ~get the color-highlighted "add" text
      @text = field[resAddItem].text
      ]]></additem>
    </table_dynamic>
  </portal>

<layout
  id="arcane">
  <portalref portal="apPowers" taborder="10"/>
  <position><![CDATA[
    ~size the table to span the full layout width
    portal[apPowers].width = width
    ~set the height of the table to the full height of the layout; the table
    ~will actually only use the vertical space it needs if it's smaller
    portal[apPowers].height = height - portal[apPowers].top
    ]]></position>
  </layout>

<panel
  id="arcane"
  name="Arcane"
  marginhorz="5"
  marginvert="5"
  order="140">
  <layoutref layout="arcane"/>
  <position><![CDATA[
    ]]></position>
  </panel> 

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.

<live>Arcane.?</live> 

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.