Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Authoring Kit
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
Kevlyn
Member
 
Join Date: Oct 2012
Posts: 37

Old February 25th, 2013, 06:51 AM
Yeah, I don't have any code for this, as nothing I've done has worked so I keep deleting it.

Code:
    <!-- Calculate the Damage Modifier trait as appropriate -->
    <eval value="1" phase="Traits" priority="4000">
      <after name="Calc trtFinal"/><![CDATA[
      var dammod as number
      dammod = #trait[attrStr] + #trait[attrSiz]
      field[trtDisplay].text = round( dammod / 5, 0, 1)
      ]]></eval>
    </thing>
I set this up like the die type from Savage Worlds but it just doesn't seem to be working.

Last edited by Kevlyn; February 25th, 2013 at 07:05 AM.
Kevlyn is offline   #21 Reply With Quote
evildmguy
Senior Member
 
Join Date: Nov 2007
Location: Des Moines, IA
Posts: 349

Old February 25th, 2013, 07:46 AM
Quote:
Originally Posted by Kevlyn View Post
Yeah, I don't have any code for this, as nothing I've done has worked so I keep deleting it.

Code:
    <!-- Calculate the Damage Modifier trait as appropriate -->
    <eval value="1" phase="Traits" priority="4000">
      <after name="Calc trtFinal"/><![CDATA[
      var dammod as number
      dammod = #trait[attrStr] + #trait[attrSiz]
      field[trtDisplay].text = "-" & round( dammod / 5, 0, 1) & "d8"
      ]]></eval>
    </thing>
I set this up like the die type from Savage Worlds but it just doesn't seem to be working.
Okay, does the above bolded area add what you needed? Basically, add your text around the calculation.
evildmguy is offline   #22 Reply With Quote
Kevlyn
Member
 
Join Date: Oct 2012
Posts: 37

Old February 25th, 2013, 08:30 AM
No, if trtDisplay is being updated it is not visible on the screen. All that's being displayed is the derived traits table, and the damage modifier is reading 0. With this code in place trtBonus.value is still 0.
Kevlyn is offline   #23 Reply With Quote
evildmguy
Senior Member
 
Join Date: Nov 2007
Location: Des Moines, IA
Posts: 349

Old February 25th, 2013, 09:56 AM
Look at the value of the fields via the floating info windows and see if the field does get updated or not. Or put in debug statements to test that it gets to those lines of code?

Hmm. Is this an eval on trtBonus? If so, you are telling it not to evaluate until after trtFinal is done. The <after name="Calc trtFinal"> line is what is doing that.
evildmguy is offline   #24 Reply With Quote
Kevlyn
Member
 
Join Date: Oct 2012
Posts: 37

Old February 25th, 2013, 11:46 AM
Here's the whole derived attribute

Code:
  <!-- Damage Modifier Trait -->
  <thing
    id="trDamMod"
    name="Damage Modifier"
    compset="Trait"
    isunique="yes"
    description="The bonus amount of damage a character inflicts when they physically strike or apply force.">
    <fieldval field="trtAbbrev" value="Dam"/>
    <fieldval field="trtDisplay" value="+0"/>
    <tag group="explicit" tag="2"/>
    <tag group="User" tag="Combat"/>
    <tag group="DashTacCon" tag="Combat"/>
    <tag group="DashTacCon" tag="Traits"/>

    <!-- Calculate the Damage Modifier trait as appropriate -->
    <eval value="1" phase="Traits" priority="4000">
      <after name="Calc trtFinal"/><![CDATA[
      var dammod as number
      dammod = #trait[attrStr] + #trait[attrSiz]
      field[trtDisplay].text = "-" & round( dammod / 5, 0, 1) & "d8"
      ]]></eval>
    </thing>
And in the info window there's the trtDisplay that has the value, but it's not showing.
Kevlyn is offline   #25 Reply With Quote
evildmguy
Senior Member
 
Join Date: Nov 2007
Location: Des Moines, IA
Posts: 349

Old February 25th, 2013, 12:06 PM
aha. Maybe.

I think it's timing again. On your trait component, when do you calculate Display? Is it after this and it sets it to the blank?
evildmguy is offline   #26 Reply With Quote
Kevlyn
Member
 
Join Date: Oct 2012
Posts: 37

Old February 25th, 2013, 03:56 PM
I stopped try to calculate the derived trait, so the only thing that it's racing against here is trtBonus.value which is being displayed instead.
Kevlyn is offline   #27 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old February 26th, 2013, 08:47 AM
Code:
 
    <!-- Calculate the Damage Modifier trait as appropriate -->
    <eval value="1" phase="Traits" priority="4000">
      <after name="Calc trtFinal"/><![CDATA[
      var dammod as number
      dammod = #trait[attrStr] + #trait[attrSiz]
      field[trtDisplay].text = "-" & round( dammod / 5, 0, 1) & "d8"
      ]]></eval>
    </thing>
The scripting language doesn't usually like it when you try to put math operations like round() on the same line as text operations like &. Try this:

Code:
 
    <!-- Calculate the Damage Modifier trait as appropriate -->
    <eval value="1" phase="Traits" priority="4000">
      <after name="Calc trtFinal"/><![CDATA[
      var dammod as number
      dammod = #trait[attrStr] + #trait[attrSiz]
      dammod = round( dammod / 5, 0, 1)
      field[trtDisplay].text = "-" & dammod & "d8"
      ]]></eval>
    </thing>
Mathias is online now   #28 Reply With Quote
Kevlyn
Member
 
Join Date: Oct 2012
Posts: 37

Old February 26th, 2013, 08:57 AM
Alright, trtDisplay is updated via the info panel. But the tab_basics is still displaying the derived trait as Damage Modifier: 0
Kevlyn is offline   #29 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old February 26th, 2013, 09:09 AM
I'll need to see the code for the portal that's displaying that 0.
Mathias is online now   #30 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 04:37 PM.


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