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)
-   -   Trying to Puzzle out Advances (http://forums.wolflair.com/showthread.php?t=59220)

Duggan September 23rd, 2017 07:06 AM

Trying to Puzzle out Advances
 
In Planet Mercenary, the system I'm working on, there are essentially two advances. Either you gain a point in three distinct skills (two of which you're supposed to have used in the course of the scenario, but of course that's not really part of the program logic), or you buy a skill specialty. I'm working on the latter right now, and hitting some issues.

Background info
  • Specializations exist as picks in a gizmo on the related skill. That was the easiest way to set up dialogs to pick specialties off of character creation so that only Specialties related to a skill where displayed.
  • Most Specialties are unique, but there are two that are not and have a domain.
  • You cannot have more Specialties than you have ranks in a skill.

Exclusion expression
The skeleton code has code for excluding unique items we've already added before:
Code:

foreach pick in hero where "component.Skill"
  foreach pick in eachpick.gizmo where "component.Specialty & !Hide.Specialty"
 
    if (each.isunique <> 0) then
      tagexpr &= " & !Specialty." & each.idstring
      endif
    nexteach
  nexteach

For my character with two specialties already, that means an exclusion expression like "& !Specialty.spLongBeam & !Specialty.spMechJury" which is neat and tidy and works.

That works just fine, but I want to only display skills where it's possible to add a specialty, so I have code to try to exclude specialties which can't be added because there aren't sufficient skill ranks. I wound up with the following:
Code:

foreach pick in hero where "component.Skill"
  var skillID as string
  var skillrank as number
  var speccount as number
  skillID = eachpick.idstring
  skillrank = eachpick.field[trtFinal].value
  speccount = eachpick.tagcount[User.HasSpec]
  debug skillrank & ", " & speccount
  if (speccount < skillrank) then
    foreach pick in eachpick.gizmo where "component.Specialty & !Hide.Specialty"
      debug eachpick.idstring
      if (each.isunique <> 0) then
        tagexpr &= " & !Specialty." & each.idstring
      endif
    nexteach
  else
  ~  debug skillID
    foreach thing in Specialty where "Skill." & skillID
      tagexpr &= " & !Specialty." & eachthing.idstring
    nexteach
  endif
nexteach

That, for the same character, produces an exclusion string of "& !Specialty.spAirEvad & !Specialty.spAirNav & !Specialty.spAirPurs & !Specialty.spAirStnt & !Specialty.spAthClmb & !Specialty.spAthFlght & !Specialty.spAthJump & !Specialty.spAthPurs & !Specialty.spAthRun & !Specialty.spAthStr & !Specialty.spAthSwim & !Specialty.spCarbBeam & !Specialty.spCarbNL & !Specialty.spCarbProj & !Specialty.spDecBluff & !Specialty.spDecDisg & !Specialty.spDecDist & !Specialty.spEconLcl & !Specialty.spEconPlan & !Specialty.spEconSec & !Specialty.spEmpGamb & !Specialty.spEmpGInfo & !Specialty.spEmpInfl & !Specialty.spEmpRSoph & !Specialty.spEngArch & !Specialty.spEngHab & !Specialty.spEngPlVeh & !Specialty.spEngVess & !Specialty.spExpBld & !Specialty.spExpDet & !Specialty.spExpDearm & !Specialty.spExpPlac & !Specialty.spGrndEvad & !Specialty.spGrndNav & !Specialty.spGrndPurs & !Specialty.spGrndStnt & !Specialty.spHvyBeam & !Specialty.spHvyNL & !Specialty.spHvyProj & !Specialty.spHistMil & !Specialty.spHistPoli & !Specialty.spHistRel & !Specialty.spHistSoph & !Specialty.spInspLead & !Specialty.spInspOra & !Specialty.spInspSed & !Specialty.spIntCoer & !Specialty.spIntInter & !Specialty.spIntTort & !Specialty.spLarcBE & !Specialty.spLarcPLoc & !Specialty.spLarcPPoc & !Specialty.spLarcSlgt & !Specialty.spLongBeam & !Specialty.spMechJury & !Specialty.spMedBatt & !Specialty.spMedFAid & !Specialty.spMedSurg & !Specialty.spMeleeCom & !Specialty.spMeleeEx & !Specialty.spMeleeUn & !Specialty.spMeleeWr & !Specialty.spNegBlck & !Specialty.spNegHagg & !Specialty.spNegPers & !Specialty.spPercHear & !Specialty.spPercMag & !Specialty.spPercSght & !Specialty.spPercSmll & !Specialty.spPercTste & !Specialty.spPercThrm & !Specialty.spPercTch & !Specialty.spPerfAct & !Specialty.spPerfCom & !Specialty.spPerfDnce & !Specialty.spPerfSong & !Specialty.spPistBeam & !Specialty.spPistNL & !Specialty.spPistProj & !Specialty.spScatBeam & !Specialty.spScatNL & !Specialty.spScatProj & !Specialty.spSpcEvad & !Specialty.spSpcNav & !Specialty.spSpcPurs & !Specialty.spSpcStnt & !Specialty.spStaWBall & !Specialty.spStaWBeam & !Specialty.spStaWMiss & !Specialty.spStlthHid & !Specialty.spStlthTai & !Specialty.spThrwAero & !Specialty.spThrwGren & !Specialty.spThrwImpr & !Specialty.spWatrEvad & !Specialty.spWatrNav & !Specialty.spWatrPurs & !Specialty.spWatStnt & !Specialty.spWillFort & !Specialty.spWillTena & !Specialty.spXenoWrld", which is long, but looks to hit all of the points. Except, well, it's not working. Every Specialty shows up, including the ones that were excluded before. Am I running into a limit on how large the field can be? It still prints without being cut off in the debug window. Maybe a limit for using it for tag exclusion? If I manually input a value of about half of those, it does work, which is suggestive.

I suppose I could rewrite the code as being "here's the list of things you can pick," but then I have the opposite issue of someone with 1 in each skill having every non-picked specialty on the list.

Or is there perhaps a way to set up subsequent changer tables so that they pick a skill, and then pick a relevant Specialty, like how the character creation does it?

Where does the Advance go?
Right now, the specialty isn't showing up, presumably because it didn't get added to the relevant skill. Where does it get assigned to? The Gizmo? The Advance thing? I'm having little luck figuring it out via the documentation and the debug window, although I'm still plugging away.

----

I previously had a small issue with how to display Specialty values differently (since they're not specifically being brought up from the skills), but a look at the Savage World code provided a solution there.

Thank you.

Duggan September 23rd, 2017 07:28 AM

I'm fairly certain for the latter, I need something with pushtags, or maybe pulltags, but I haven't quite figured out where yet.

Duggan October 12th, 2017 06:48 AM

I'm an idiot. That field explicitly sets a size limit of a 1000 characters, but that's 2,355 right there. Expanding the size creates a different error, where I'm getting picks that have nothing to do with Specialties, but I also haven't touched this code in a while, so this is likely a side effect from somewhere else.

Duggan October 12th, 2017 08:30 AM

And... not quite the idiot I thought I was. I expanded the field. It's still not working over a certain amount of characters. 990 characters goes through. I will keep experimenting to see what that upper limit is.

Mathias October 12th, 2017 08:51 AM

I'm sorry I haven't been able to give you much help recently, with so much to do for Starfinder, but the limit is 5000 characters, and this problem is why the <needtag> and <denytag> options were added to tables, because even at 5000 characters, you're eventually going to run into something that breaks that limit.

Duggan October 12th, 2017 09:21 AM

1058 doesn't work. Somewhere between 990 and 1012 is where it seems to ignore the entire tag expression. That's also the line between 43 and 44 conditions inside the expression if that makes a difference. I guess I have hit some sort of internal limit. I'll probably try a different approach tonight.

@Matthias: I figured something had drawn you away. No worries.

Duggan October 27th, 2017 11:25 AM

Incidentally, I found a partial solution. Because every Specialty is tagged with the skill it applies to, I was able to instead bar individual skills when there were no possibilities (which is the case when the number of ranks in the skill are not greater than the number of specialties the character has in that skill). Since most characters have many skills they have no ranks in, this will work for now, but I feel like this is bound to break again at some point.

Code:

<!-- Add Specialty advance -->
  <thing
    id="advSpec"
    name="Add Specialty"
    compset="Advance"
    description="Add a skill specialty">
    <fieldval field="advAction" value="Add Specialty"/>
    <fieldval field="advDynamic" value="component.Specialty &amp; !Hide.Specialty"/>
    <tag group="Advance" tag="AddNew"/>
    <eval value="1" phase="Render" priority="1000">
      <before name="Assign Dynamic Tagexpr"/><![CDATA[
      ~get the list of all unique specialties on the hero and assemble it as a list of precluded tags
      debug "Assign Dynamic"
      var tagexpr as string
      foreach pick in hero where "component.Skill"
        var skillID as string
        var skillrank as number
        var speccount as number
        skillID = eachpick.idstring
        skillrank = eachpick.field[trtFinal].value
        speccount = eachpick.tagcount[User.HasSpec]

        if (speccount < skillrank) then
          foreach pick in eachpick.gizmo where "component.Specialty & !Hide.Specialty"
            ~ debug eachpick.idstring
            if (each.isunique <> 0) then
              tagexpr &= " & !Specialty." & each.idstring
            endif
          nexteach
        else
          tagexpr &= " & !Skill." & skillID
        endif
      nexteach
      ~ debug "Precluded: " & tagexpr
     
      ~if there are any tags to exclude, append them to the tagexpr appropriately
      if (empty(tagexpr) = 0) then
        field[advDynamic].text &= tagexpr
        debug "advDynamic: " & field[advDynamic].text
      endif
      ]]></eval>
<child entity="Advance">
<tag group="Advance" tag="MustChoose"/>
</child></thing>

Next step is to figure out if there's a nice way to define three independent skills for the "Advance 3 different skills by 1 point" Advance without having to define a custom portal for each.

Duggan December 30th, 2017 03:18 PM

I couldn't find a way to avoid the separate portals. *shrug* Small things. Now, to prevent the form from validating if the same skills are picked for two or more of the choices.

EightBitz January 6th, 2018 02:34 AM

Would it not be simpler to just display the specialties, regardless of skill ranks, and use the validation rules to warn about insufficient skill ranks?

Duggan January 6th, 2018 06:11 PM

That's a possibility. I partly limited the list because otherwise it's just way too much.

I also got it to avoid allowing skill duplication.


All times are GMT -8. The time now is 12:36 AM.

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