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

Old December 13th, 2017, 12:55 PM
I'm an idiot. I added a gizmo to this so that it would have something to hook onto. I re-used the SpecHelp that I used for the Specialty. It sets correctly, as per the debug statement, but setting that chooser_table's candidatepick to "SpecHelp" and candidatefield to "SpecExpr" still doesn't restrict the pick.

Code:
<thing
  id="fRPlusSp"
  name="Bonus Specialty"
  compset="cmpsetSB"
  description="Adds the selected specialty.">
  <fieldval field="usrCandid2" value="component.Specialty"/>
  <tag group="Hide" tag="Special"/>
  <eval index="1" phase="PreTraits" priority="4900">
    <before name="Calc trtFinal"/><![CDATA[
    ~build the candidate expression out of our specialty tags
    var specs as string
    specs = tagids[Specialty.?, " | "]
    var skills as string
    skills = tagids[Skill.?, " | "]

    var combined as string
    if (tagis[Skill.?] <> 0) then
      if (tagis[Specialty.?] <> 0) then
        combined = skills & " | " & specs
      else
        combined = skills
      endif
    else
      combined = specs
    endif

    debug "combined: " & combined
    gizmo.childfound[SpecHelp].field[SpecExpr].text = combined
    ]]></eval>
  
  <child entity="entSpec" />
  </thing>
For example, I have it set to "Specialty.spEngArch | Specialty.spPistBeam" according to the debug statement, but it still displays all of the items.

Putting that same string inside a candidate element does work. Is there a way to simply set it programmatically there?

Ok... and I'm definitely doing something wrong. If I add two fRPlusSp items (to allow the user to pick two Specialties), changing one changes both of them. *sigh* Back to the drawing board...

Last edited by Duggan; December 13th, 2017 at 02:16 PM.
Duggan is offline   #3 Reply With Quote