Thread: Two questions
View Single Post
EightBitz
Senior Member
 
Join Date: May 2013
Posts: 1,458

Old January 27th, 2016, 12:17 PM
Quote:
Originally Posted by Mathias View Post
Ah, I see that you are setting the maximum in a script, so you will need to go with the large value route.
I was actually experimenting with that while waiting for your reply. It only works if I set a literal value for the tracker max.
Code:
  <thing
    id="trkMight"
    name="Might Pool"
    compset="Tracker">

    <!-- Automatically add the tracker to every actor -->
    <tag group="Helper" tag="Bootstrap"/>

    <!-- Resetting the tracker sets the value to the maximum -->
    <tag group="Helper" tag="ResetMax"/>

    <!-- Use the starting power points as our initial maximum -->
    <eval index="1" phase="Final" priority="1000"><![CDATA[
      field[trkMin].value = 0
      ~field[trkMax].value = #trait[attrMight]
      field[trkMax].value = 100
      ]]></eval>
So I ended up doing this:
Code:
  <thing
    id="trkMight"
    name="Might Pool"
    compset="Tracker">

    <!-- Automatically add the tracker to every actor -->
    <tag group="Helper" tag="Bootstrap"/>

    <!-- Resetting the tracker sets the value to the maximum -->
    <tag group="Helper" tag="ResetMax"/>

    <!-- Use the starting power points as our initial maximum -->
    <eval index="1" phase="Final" priority="1000"><![CDATA[
      field[trkMin].value = 0
      if (#trait[attrMight] = 0) then 
        field[trkMax].value = 100
      else
        field[trkMax].value = #trait[attrMight]
      endif
      ]]></eval>
      
    </thing>
It's a bit awkward in that if someone goes to the In-Play tab before selecting a Type, they'll see 100/100. Other than that, it works. So it's functional, but has a temporarily cosmetic drawback.

Thanks for your help.
EightBitz is offline   #14 Reply With Quote