Senior Member
Join Date: May 2013
Posts: 1,458
|
OK, three things. With the trackers I'm working with, the maximum value is based on the value of related attributes. So there's a "Might" attribute and a "Might" tracker. The value of the Might attribute is supposed to be the maximum value for the Might pool.
The Might attribute starts at 0 until someone picks a Type (analogous to a class or a profession or a template). So, Might is 0. Pick a template, then Might gets a proper value. The max for Might Pool is derived from Might. Now, if I use literal values in both the creation script and the Might Pool thing, it all works. When I go to the In-Play tab, I see "5/20". Which perfectly met my expectations. Code:
------ components.core excerpt------ . . . <creation><![CDATA[ if (tagis[Helper.ResetMax] <> 0) then ~field[trkUser].value = field[trkMax].value field[trkUser].value = 5 endif ]]></creation> </component> ------ end components.core ------ --------- thing_miscellaneous.dat excerpt --------- <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 = 20 ]]></eval> </thing> --------- end excerpt --------- Code:
------ components.core excerpt------ . . . <creation><![CDATA[ if (tagis[Helper.ResetMax] <> 0) then field[trkUser].value = field[trkMax].value ~field[trkUser].value = 5 endif ]]></creation> </component> ------ end components.core ------ --------- thing_miscellaneous.dat excerpt --------- <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 = 20 ]]></eval> </thing> --------- end excerpt --------- So, something is happening that I don't understand. |
#11 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
trkMax is something you're setting in a <fieldval> on the item, right?
You're not setting it in a script? Because <creation> scripts are run only one time, when that pick is first added to the character, and then never run again, if you're setting the trkMax in a script, then it's too late - the creation script has already run. If you are setting the trkMax in a script, then your creation script would need to look like this: Code:
<creation><![CDATA[ ~if we'll be resetting to our maximum, then set our starting value to a very big number, which will later be corrected to be the maximum by the field's <bound> script if (tagis[Helper.ResetMax] <> 0) then field[trkUser].value = 9999999999 endif ]]></creation> |
#12 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Ah, I see that you are setting the maximum in a script, so you will need to go with the large value route.
|
#13 |
Senior Member
Join Date: May 2013
Posts: 1,458
|
Quote:
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> 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> Thanks for your help. |
|
#14 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
In that case, instead of setting a default value that's not useful, how about using tags to hide the tracker until it can show a useful value?
|
#15 |
Senior Member
Join Date: May 2013
Posts: 1,458
|
Which is a great idea, except it's still not working right. If I switch between Types with different values for the attributes, the value for the trkUser field will get stuck on the lowest value. So if switch to a Glaive that has a Might of 12, I'll see the tracker at 12/12. Then I switch to a Nano with a Might of 7, and I'll see the tracker at 7/7. If I switch back to a Glaive, the Might attribute gets reset to 12, but I'll see the tracker at 7/12 instead of 12/12.
EDIT: Likewise, there are attribute points that can be spent to increase the attributes. So if I select a Glaive, the Might attribute is set to 12, and the tracker is 12/12. Then I spend two points on Might to increase it to 14, but the tracker says 12/14 instead of 14/14. Basically, what I want is that when I'm done with character creation, and when an attribute is increased through an Advance, all the trackers with the ResetMax tag are maxed out. And if I have to do that manually, so be it. But there's that trigger script on the in-play tab that maxes everything out when you hit the reset button. That's the functionality I'm looking for. Last edited by EightBitz; January 27th, 2016 at 12:42 PM. |
#16 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Re-examine this tracker - do you really need the "reset to maximum"? Why can't 0/12 mean nothing spent - why does 12/12 have to represent that?
If you really do want to display things as 12/12 meaning "nothing spent", then re-examine how you're displaying things - currently, it displays field[trkUser].value & "/" & field[trkMax].value (I'm referring to the finalize script on the trkUser field, BTW). Maybe change that to display field[trkLeft].value & "/" & field[trkMax].value. That way, changing the maximum doesn't mean that the amount spent has to change. |
#17 |
Senior Member
Join Date: May 2013
Posts: 1,458
|
Quote:
I did try changing trkUser to trkLeft, but I got an error. I must have done it in the wrong place. I'll take another look. |
|
#18 |
Senior Member
Join Date: May 2013
Posts: 1,458
|
Aaaand, I give up. I'll move on to other things for now. Maybe if I get enough things functional, someone else might be interested enough to help optimize.
|
#19 |
Senior Member
Volunteer Data File Contributor
Join Date: Nov 2009
Posts: 1,502
|
Ran into this thread while researching a different problem. Out of curiousity, did you ever figure it out?
|
#20 |
|
|