View Single Post
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,502

Old March 23rd, 2018, 10:51 AM
As I have covered before, I have a situation where Skills in my system (Planet Mercenary) can have Specialties added to them under certain circumstances (namely, specialties are particular to a given skill, most specialties are unique and can only be added once, and you can't have more specialties than you have ranks in the skill). At the time, it seemed the easiest way to do it was by borrowing some code from the Doctor Who implementation and setting up a Gizmo on the skills so that I could set up field that limited the Specialty choices to those that match up to the skill.

Code:
<portal
  id="prtSpec"
  style="tblNormal">
  <table_dynamic
    component="Specialty"
    showtemplate="SpecPick"
    choosetemplate="SpecPick2"
    scrollable="yes"
    alwaysupdate="yes"
    candidatepick="SpecHelp"
    candidatefield="SpecExpr"
    addpick="SpecHelp">
    
    <titlebar><![CDATA[
      @text = "Add a Specialty"
      ]]></titlebar>
    <!--headertitle><![CDATA[
      @text = "Specialty"
      ]]></headertitle-->
    <additem><![CDATA[
      @text = "Add Specialty"
      ]]>
      </additem>
    </table_dynamic>      
  </portal>
and set here:
Code:
<procedure id="SetSpcExpr" context="pick"><![CDATA[
  ~make sure there's a gizmo to travel to
  doneif (isgizmo = 0)
  
  ~set up our tag expression for selecting appropriate specialty
  var expr as string
  var myId as string

  expr = "component.Specialty & " & myId

  debug "expr: " & expr
  gizmo.childfound[SpecHelp].field[SpecExpr].text = expr
  ]]></procedure>
This results in the situation where the Specialty is added to the skill itself (or, I suppose to its Gizmo), and then shadowed onto the main Hero. The thing is, while this is the primary way for a user to add the Specialty, there are two other ways for it to happen. One, some backgrounds/command packages/sophont types give a bonus Specialty. Two, one of the options for Advancement is adding a Specialty. The second is not really a factor right now, but the former sort of is, in that any Specialty added via a background trait of some sort also shows up as a valid choice on the table, since it doesn't exist on the Skill in question.

TL;DR: Is there any way to set the "target" of the table to be the Hero instead of the Skill? Since skills are never deleted, there should never be a situation where it matters where the Specialty resides.

I can also provide more code. I'm trying to only quote the relevant bits.
Duggan is offline   #1 Reply With Quote