• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Unknown element tag 'usesource'

EightBitz

Well-known member
Disclaimer: I am still very much a novice with the authoring kit.

I created a skeleton gaming file, and edited the attributes to be attrMight, attrSpeed and attrIntel. I have not changed any timing.

I copied thing_races.dat to thing_types.dat, and I have the following code:
Code:
  <!-- Glaive -->
  <thing
    id="TypGlaive"
    name="Glaive"
    compset="Type"
    isunique="yes"
    description="Description goes here">
    
    <!-- If the race confers any special abilities, bootstrap them here
    <bootstrap thing="abSample"/>
    -->

    <!-- Define any script needed to apply changes to traits or other mechanisms
    <eval value="1" phase="PreTraits" priority="5000">
      <before name="Calc trtFinal"/><![CDATA[
      ~apply whatever adjustment(s) are needed here
      #traitbonus[attrMight] += 10
      #traitbonus[attrSpeed] += 9
      #traitbonus[attrIntel] += 6
      ~hero.child[resAbility].field[resMax].value += 1
      ~#traitbonus[attrSam] += 1
      ]]></eval>
      -->
    <usesource source="srcNumCore"/>
    </thing>

That all works fine, except that since the eval script is wrapped in a comment, it doesn't do anything.

So I then I uncommented the eval script:
Code:
  <!-- Glaive -->
  <thing
    id="TypGlaive"
    name="Glaive"
    compset="Type"
    isunique="yes"
    description="Description goes here">
    
    <!-- If the race confers any special abilities, bootstrap them here
    <bootstrap thing="abSample"/>
    -->

    <!-- Define any script needed to apply changes to traits or other mechanisms -->
    <eval value="1" phase="PreTraits" priority="5000">
      <before name="Calc trtFinal"/><![CDATA[
      ~apply whatever adjustment(s) are needed here
      #traitbonus[attrMight] += 10
      #traitbonus[attrSpeed] += 9
      #traitbonus[attrIntel] += 6
      ~hero.child[resAbility].field[resMax].value += 1
      ~#traitbonus[attrSam] += 1
      ]]></eval>

    <usesource source="srcNumCore"/>
    </thing>
And I got the following error message when trying to load the game system:
The data files could not be loaded due to the following errors:

File: thing_types.dat (line37 - Encountered unknown element tag 'usesource'
One or more timing errors were identified. Please review the timing report and correct the
errors. You can access the report under the 'Develop' menu or by clicking this link.

So then I figured I'd leave out the usesource tag:
Code:
  <!-- Glaive -->
  <thing
    id="TypGlaive"
    name="Glaive"
    compset="Type"
    isunique="yes"
    description="Description goes here">
    
    <!-- If the race confers any special abilities, bootstrap them here
    <bootstrap thing="abSample"/>
    -->

    <!-- Define any script needed to apply changes to traits or other mechanisms -->
    <eval value="1" phase="PreTraits" priority="5000">
      <before name="Calc trtFinal"/><![CDATA[
      ~apply whatever adjustment(s) are needed here
      #traitbonus[attrMight] += 10
      #traitbonus[attrSpeed] += 9
      #traitbonus[attrIntel] += 6
      ~hero.child[resAbility].field[resMax].value += 1
      ~#traitbonus[attrSam] += 1
      ]]></eval>

    </thing>
And it all worked. This tells me (I think) that the timing is working fine between the attributes and the preTraits. But adding the "usesource" line messes things up. I'd like to keep that in there.

Help?
 
"Unknown Element" means "OK, I found an <eval>, which means that the next things after that could be evalrule, pickreq, exprreq, etc." <usesource> isn't on the list of elements that can come after <eval>, so the error report it returns is that the element is unknown.
 
So its not really that its "unknown" but that its in the "wrong" area. Usesource element must come before the scripts and tags but After values. I think that is right. Let me go check a pathfinder .user file. Yep that is correct.

In this case its worth looking at how the editor for other game systems lays out the XML. You need to match that same layout as the XML Schema gets touchy about which elements come first. This is where getting familiar with other systems in XML makes the transition to the Authoring kit easier.

This should work:
Code:
  <!-- Glaive -->
  <thing
    id="TypGlaive"
    name="Glaive"
    compset="Type"
    isunique="yes"
    description="Description goes here">
    <usesource source="srcNumCore"/>
    
    <!-- If the race confers any special abilities, bootstrap them here
    <bootstrap thing="abSample"/>
    -->

    <!-- Define any script needed to apply changes to traits or other mechanisms -->
    <eval value="1" phase="PreTraits" priority="5000">
      <before name="Calc trtFinal"/><![CDATA[
      ~apply whatever adjustment(s) are needed here
      #traitbonus[attrMight] += 10
      #traitbonus[attrSpeed] += 9
      #traitbonus[attrIntel] += 6
      ~hero.child[resAbility].field[resMax].value += 1
      ~#traitbonus[attrSam] += 1
      ]]></eval>

    </thing>

On the wiki the DTD for a "Thing" is defined HERE. The order matters.
 
Thanks. :-)

I do things backwards. If I planned all this out, I'd be too intimidated to ever make any progress. If I do it a bit at a time, then I'm like, "Hey! I got THAT bit done! ... Oooh, look! Now THAT'S done, too!"

I have no idea how I'm going to do most of this stuff. So ... I'm plugging away, bit by bit.
 
It's gonna be messy, though, because I'm sick of trying to remove unnecessary bits and getting a domino effect of error messages.
 
Back
Top