Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Authoring Kit (http://forums.wolflair.com/forumdisplay.php?f=58)
-   -   Changing the order of items listed in tables. (http://forums.wolflair.com/showthread.php?t=59214)

EightBitz September 21st, 2017 10:45 PM

Changing the order of items listed in tables.
 
When I started working in Chill, I defaulted to listing the primary attributes in alphabetical order. I did not lost the derived traits in alphabetical order, but I don't recall why. Still, the reason isn't important.

Now, I'm working on some cosmetic changes to more closely match how things are listed on the official character sheet.

I edited thing_attributes.dat, and simply changed the order of the attribute things. I reopened Hero Lab, and the order in which the attributes were now listed matched the changes I made in the .dat file.

I then similarly edited thing_traits.dat. I reopened Hero Lab, and the order of the derived traits was no different than before. The order of appearance did not match my changes, nor was in alphabetical.

I have no idea what's determining the order in which the derived traits are listed. Is it supposed to match the order in which I list them in the file?

Duggan September 22nd, 2017 02:32 AM

Assuming you're using a table to display them, it's based on the sortset (which does default to alphabetical). If you're explicitly building individual portals, it is of course according to how you did your position section.

EightBitz September 22nd, 2017 05:38 AM

Quote:

Originally Posted by Duggan (Post 256313)
Assuming you're using a table to display them, it's based on the sortset (which does default to alphabetical). If you're explicitly building individual portals, it is of course according to how you did your position section.

That's the thing, though. It's not alphabetical. It's maintaining my original order, like it's cached it and won't let go.

Duggan September 22nd, 2017 05:42 AM

Oh man... I wish I could get it to do that on some of mine. :-P

Can you provide the code for how you're displaying it?

EightBitz September 22nd, 2017 08:21 AM

Quote:

Originally Posted by Duggan (Post 256317)
Oh man... I wish I could get it to do that on some of mine. :-P

Can you provide the code for how you're displaying it?

thing_traits.dat
Code:

<document signature="Hero Lab Data">

  <!-- Stamina Trait -->
  <thing
    id="trSta"
    name="Stamina"
    compset="Trait"
    isunique="yes"
    description="\n\n{b}Source:{/b} Core Rulebook">
    <fieldval field="trtAbbrev" value="STA"/>
    <tag group="explicit" tag="2"/>
    <tag group="User" tag="Combat"/>
    <tag group="DashTacCon" tag="Combat"/>
    <tag group="DashTacCon" tag="Traits"/>

    <!-- Calculate the Initiative trait as appropriate -->
    <eval value="1" phase="Traits" priority="4000">
      <before name="Derived trtFinal"/>
      <after name="Calc trtFinal"/><![CDATA[
      var val as number
      val = (#trait[attrAgl] + #trait[attrStr])/2
      field[trtBonus].value = round(val,0,0)
      ]]></eval>
    </thing>

  <!-- Willpower Trait -->
  <thing
    id="trWill"
    name="Willpower"
    compset="Trait"
    isunique="yes"
    description="\n\n{b}Source:{/b} Core Rulebook">
    <fieldval field="trtAbbrev" value="WPR"/>
    <tag group="explicit" tag="1"/>
    <tag group="User" tag="Combat"/>
    <tag group="DashTacCon" tag="Combat"/>
    <tag group="DashTacCon" tag="Traits"/>

    <!-- Calculate the Willpower trait as appropriate -->
    <eval value="1" phase="Traits" priority="4000">
      <before name="Derived trtFinal"/>
      <after name="Calc trtFinal"/><![CDATA[
      var val as number
      val = (#trait[attrFoc] + #trait[attrPsy])/2
      field[trtBonus].value = round(val,0,0)
      ]]></eval>
    </thing>

  <!-- Reflexes Trait -->
  <thing
    id="trReflex"
    name="Reflexes"
    compset="Trait"
    isunique="yes"
    description="\n\n{b}Source:{/b} Core Rulebook">
    <fieldval field="trtAbbrev" value="REF"/>
    <tag group="explicit" tag="3"/>
    <tag group="User" tag="Combat"/>
    <tag group="DashTacCon" tag="Combat"/>

    <!-- Calcualte the Defense trait as appropriate -->
    <eval value="1" phase="Traits" priority="4000">
      <before name="Derived trtFinal"/>
      <after name="Calc trtFinal"/><![CDATA[
      var val as number
      val = (#trait[attrDex] + #trait[attrPcn])/2
      field[trtBonus].value = round(val,0,0)
      ]]></eval>
    </thing>

  <!-- Sense The Unknown Trait -->
  <thing
    id="trSense"
    name="Sense the Unknown"
    compset="Trait"
    isunique="yes"
    description="\n\n{b}Source:{/b} Core Rulebook">
    <fieldval field="trtAbbrev" value="STU"/>
    <tag group="explicit" tag="4"/>
    <tag group="User" tag="Combat"/>
    <tag group="DashTacCon" tag="Combat"/>

    <!-- Calculate the Power Points trait as appropriate -->
    <eval value="1" phase="Traits" priority="4000">
      <before name="Derived trtFinal"/>
      <after name="Calc trtFinal"/><![CDATA[
      var val as number
      val = #trait[attrPcn]/5
      field[trtBonus].value = round(val,0,0)
      ]]></eval>
    </thing>

  </document>

baTrait portal from tab_basics.dat
Code:

  <portal
    id="baTrait"
    style="tblInvis">
    <table_fixed
      component="Derived"
      showtemplate="baTrtPick"
      showsortset="explicit"
      scrollable="no">
      </table_fixed>
    </portal>

baTrtPick template from tab_basics.dat
Code:

  <template
    id="baTrtPick"
    name="Trait Pick"
    compset="Trait"
    marginhorz="16"
    marginvert="3">

    <portal
      id="name"
      style="lblSecond"
      showinvalid="yes">
      <label
        field="name">
        </label>
      </portal>

    <portal
      id="abbrev"
      style="lblXLarge"
      showinvalid="yes">
      <label
        field="trtAbbrev">
        </label>
      </portal>

    <portal
      id="details"
      style="lblXLarge">
      <label>
        <labeltext><![CDATA[
          @text = field[trtFinal].text
          ]]></labeltext>
        </label>
      <mouseinfo><![CDATA[
        ~insert appropriate code to explain how the trait was derived
        @text = "???"
        ]]></mouseinfo>
      </portal>

    <portal
      id="info"
      style="actInfo">
      <action
        action="info">
        </action>
      </portal>

    <position><![CDATA[
      ~set up our height based on our tallest portal
      height = portal[name].height + 10

      ~if this is a "sizing" calculation, we're done
      doneif (issizing <> 0)

      ~position our tallest portal at the top
      portal[info].top = 0

      ~center the other portals vertically
      perform portal[name].centervert
      perform portal[abbrev].centervert
      perform portal[details].centervert
      perform portal[info].centervert

      ~position the info portal on the far right
      perform portal[info].alignedge[right,-215]

      ~position the name on the left and give it some reasonable space
      ~portal[name].left = 0
      ~portal[name].width = 135

      ~position the details to the right of the name and the left of the info portal
      portal[details].width = 50
      portal[abbrev].width = 50
      perform portal[details].alignrel[rtol,info,-10]
      perform portal[abbrev].alignrel[rtol,details,0]
      perform portal[name].alignrel[rtol,abbrev,-10]
     
      portal[details].width = portal[info].left - portal[details].left - 10
     
      ]]></position>

    </template>

basics layout from tab_basics.dat
Code:

  <layout
    id="basics">
    <portalref portal="baAttrib" taborder="10"/>
    <portalref portal="baTrait" taborder="20"/>
    <portalref portal="Horizontal"/>

    <!-- This script sizes and positions the layout and its child visual elements. -->
    <position><![CDATA[
      ~size and position the attributes table in the top left; we set the height to
      ~the full layout height, but the table will only use the space it needs
      portal[baAttrib].width = width
      portal[baAttrib].left = 0
      portal[baAttrib].height = height

      ~set the separator width and position it beneath the attributes
      portal[Horizontal].width = portal[baAttrib].width - 30
      portal[Horizontal].top = portal[baAttrib].bottom + 15
      portal[Horizontal].left = portal[baAttrib].left + (portal[baAttrib].width - portal[Horizontal].width) / 2

      ~size and position the traits table beneath the separator; we set the height
      ~the the full layout height, but the table will only use the space it needs
      portal[baTrait].width = portal[baAttrib].width
      portal[baTrait].left = portal[baAttrib].left
      portal[baTrait].top = portal[Horizontal].bottom + 15
      portal[baTrait].height = height - portal[baTrait].top

      ~figure out the total height we need for the tab
      height = portal[baTrait].bottom
      ]]></position>

The order of display for the traits is:
WPR
STA
REF
STU

This doesn't match the order in thing_traits.dat, and it's not alphabetical.

EightBitz September 22nd, 2017 08:24 AM

The current display matches the ORIGINAL order in which I listed them in thing_traits.dat. But after I changed the order, the display did not follow suit.

Duggan September 22nd, 2017 08:35 AM

Just to be clear, the explicit tags you have (and setting the sort to explicit) indicates that you want the display to be
  1. WPR
  2. STA
  3. REF
  4. STU

Those are the Explicit tags you have on them.

EightBitz September 22nd, 2017 08:37 AM

Quote:

Originally Posted by Duggan (Post 256337)
Just to be clear, the explicit tags you have (and setting the sort to explicit) indicates that you want the display to be
  1. WPR
  2. STA
  3. REF
  4. STU

Those are the Explicit tags you have on them.

*facepalm*

EightBitz September 22nd, 2017 08:39 AM

Quote:

Originally Posted by Duggan (Post 256337)
Just to be clear, the explicit tags you have (and setting the sort to explicit) indicates that you want the display to be
  1. WPR
  2. STA
  3. REF
  4. STU

Those are the Explicit tags you have on them.

I kept thinking that explicit meant the order in which they're listed. I knew better, though. I just had a mental block.

Duggan September 22nd, 2017 08:42 AM

Quote:

Originally Posted by EightBitz (Post 256340)
I kept thinking that explicit meant the order in which they're listed. I knew better, though. I just had a mental block.

It would nice if there were an option for that. I currently have an issue with one of my lists where, depending on user input, the items can shift locations, because internally, part of the name is changing. And explicit isn't an option because the items are user-added (or via the editer).


All times are GMT -8. The time now is 03:44 AM.

Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.