Code
  1. Code
  2. CODE-73

Using 'defined' var value sets var to 0?

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.16.2
    • Fix Version/s: 6.03.06
    • Component/s: None
    • Labels:
      None

      Description

      To reproduce:

      load rsrd (3.5 RSRD basics or more) and the BugTest dataset.

      create neutral good human cleric (one lvl).
      Add Turn Undead class ability.
      (check preview: turn undead lvl 1)
      add 1 level of BugTestClass
      (check preview: turn undead lvl 0)

      Previous Information:
      > PCGen 5.16.2
      > rsrd + homebrew
      >
      > I ran into this trying to create an ability for a prestige class that is
      > based on Turn Undead.
      >
      > When I tried to increase the relevant VAR with the turn undead var, something
      > weird happened. This is (part of) my code:
      > CLASS:MySpecialPrc<NEWLINE>
      > 1<TAB>BONUS:VAR|PurgeUndeadLevel|TurnLevelUndead
      >
      > As a result, My Turn undead level (as displayed on the html preview) is set
      > to 0, and the PurgeUndeadLevel remains at 0.
      >
      > If, instead, I use TurnLevelBase, My Turn Undead level (as displayed) is
      > correct, and the PurgeUndeadLevel is set correctly.
      >
      > I noticed that TurnLevelUndead is set with a define
      > (DEFINE:TurnLevelUndead|TurnLevelBase) instead of with a bonus
      > (DEFINE:TurnLevelUndead|0<TAB>BONUS:VAR|TurnLevelUndead|TurnLevelBase) in the
      > RSRD.
      >
      > I changed the Turn Undead entry in the RSRD to use the define|0 and
      > bonus|var, and this leads to correct behaviour in my prc.
      >
      > Conclusion:
      >
      > 1. Something strange happening when using DEFINE:MyVar1|MyVar2
      >
      > I think this should either be disallowed (default define to 0 and remove
      > optional initialization parameter) or fixed
      >
      > 2. RSRD should use working data, so change RSRD to use
      > DEFINE:TurnLevelUndead|0 etc.

      1. bugtest.rar
        1.0 kB
        Martijn Verburg

        Activity

        Hide
        Andrew Wilson
        added a comment -

        If you save the test character and then close and reopen it, the numbers come out right.

        Show
        Andrew Wilson
        added a comment - If you save the test character and then close and reopen it, the numbers come out right.
        Hide
        James Dempsey
        added a comment -

        Andrew Maitland Tom Parker Any objections if I make define report an error if the initial value is not 0?

        Show
        James Dempsey
        added a comment - Andrew Maitland Tom Parker Any objections if I make define report an error if the initial value is not 0?
        Hide
        Andrew Maitland
        added a comment -

        Not at all. I did a massive sweep to prep us for next cycle's migration to the new formula parser. If we have any DEFINE not at 0 I would like to know about it.

        Show
        Andrew Maitland
        added a comment - Not at all. I did a massive sweep to prep us for next cycle's migration to the new formula parser. If we have any DEFINE not at 0 I would like to know about it.
        Hide
        James Dempsey
        added a comment -

        I've have this working locally. There are still quite a few instances of non zero defines in the data. A couple of examples are:

        SRD Dragons
            Define must always have a starting value of 0, but was: 1 (Source: file:/D:/
        Projects/pcgendev/data/3e/wizards_of_the_coast/srd/monsters/srd_races__dragons.l
        st ),
            Illegal Token 'DEFINE' 'DragonAge|1' for pcgen.core.Race Dragon (Black Wyrml
        ing) in file:/D:/Projects/pcgendev/data/3e/wizards_of_the_coast/srd/monsters/srd
        _races__dragons.lst,
        
        Spycraft
        Define must always have a starting value of 0, but was:
        var("MaxRank")-30 (Source: file:/D:/Projects/pcgendev/data/spycraft/crafty_games
        /spycraft/spycraft/spycraft_skills_mod.lst ),
            Illegal Token 'DEFINE' 'MaxRankIntimidate|var("MaxRank")-30' for pcgen.core.
        Skill Intimidate in file:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycra
        ft/spycraft/spycraft_skills_mod.lst,
            Define must always have a starting value of 0, but was: (TL/4)+1 (Source: fi
        le:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycraft/spycraft/spycraft_f
        eats.lst ),
            Illegal Token 'DEFINE' 'FastSlip|(TL/4)+1' for pcgen.core.Ability Nimble Fin
        gers in file:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycraft/spycraft/
        spycraft_feats.lst,
            Define must always have a starting value of 0, but was: (TL/4)+1 (Source: fi
        le:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycraft/spycraft/spycraft_f
        eats.lst ),
            Illegal Token 'DEFINE' 'FastPick|(TL/4)+1' for pcgen.core.Ability Nimble Fin
        gers in file:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycraft/spycraft/
        spycraft_feats.lst,
            Define must always have a starting value of 0, but was: (TL/4)+1 (Source: fi
        le:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycraft/spycraft/spycraft_f
        eats.lst ),
            Illegal Token 'DEFINE' 'FastSwipe|(TL/4)+1' for pcgen.core.Ability Nimble Fi
        ngers in file:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycraft/spycraft
        /spycraft_feats.lst
        

        Two options:

        1. Commit as is
        2. Mark formula as errors (e.g. (TL/4)+1 from Spycraft), but non zero static values as warnings (or allow).

        Andrew Maitland Did you have a preference?

        Show
        James Dempsey
        added a comment - I've have this working locally. There are still quite a few instances of non zero defines in the data. A couple of examples are: SRD Dragons Define must always have a starting value of 0, but was: 1 (Source: file:/D:/ Projects/pcgendev/data/3e/wizards_of_the_coast/srd/monsters/srd_races__dragons.l st ), Illegal Token 'DEFINE' 'DragonAge|1' for pcgen.core.Race Dragon (Black Wyrml ing) in file:/D:/Projects/pcgendev/data/3e/wizards_of_the_coast/srd/monsters/srd _races__dragons.lst, Spycraft Define must always have a starting value of 0, but was: var ( "MaxRank" )-30 (Source: file:/D:/Projects/pcgendev/data/spycraft/crafty_games /spycraft/spycraft/spycraft_skills_mod.lst ), Illegal Token 'DEFINE' 'MaxRankIntimidate| var ( "MaxRank" )-30' for pcgen.core. Skill Intimidate in file:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycra ft/spycraft/spycraft_skills_mod.lst, Define must always have a starting value of 0, but was: (TL/4)+1 (Source: fi le:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycraft/spycraft/spycraft_f eats.lst ), Illegal Token 'DEFINE' 'FastSlip|(TL/4)+1' for pcgen.core.Ability Nimble Fin gers in file:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycraft/spycraft/ spycraft_feats.lst, Define must always have a starting value of 0, but was: (TL/4)+1 (Source: fi le:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycraft/spycraft/spycraft_f eats.lst ), Illegal Token 'DEFINE' 'FastPick|(TL/4)+1' for pcgen.core.Ability Nimble Fin gers in file:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycraft/spycraft/ spycraft_feats.lst, Define must always have a starting value of 0, but was: (TL/4)+1 (Source: fi le:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycraft/spycraft/spycraft_f eats.lst ), Illegal Token 'DEFINE' 'FastSwipe|(TL/4)+1' for pcgen.core.Ability Nimble Fi ngers in file:/D:/Projects/pcgendev/data/spycraft/crafty_games/spycraft/spycraft /spycraft_feats.lst Two options: Commit as is Mark formula as errors (e.g. (TL/4)+1 from Spycraft), but non zero static values as warnings (or allow). Andrew Maitland Did you have a preference?
        Hide
        Andrew Maitland
        added a comment -

        Commit as is, I'll tackle them in a few.

        Show
        Andrew Maitland
        added a comment - Commit as is, I'll tackle them in a few.
        Hide
        James Dempsey
        added a comment -

        I've opted to deprecate the non 0 values. That way the data can be cleaned up first. This also follows our standard policy of not making immediate removals of old LST format.

        Show
        James Dempsey
        added a comment - I've opted to deprecate the non 0 values. That way the data can be cleaned up first. This also follows our standard policy of not making immediate removals of old LST format.

          People

          • Assignee:
            James Dempsey
            Reporter:
            Martijn Verburg
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: