Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,214
|
I have a set of items I'm adding to my game system - some have variable costs. I have the code written to switch portals between a display for those with a fixed cost and an incrementer for those with a variable cost. The problem is that in one cast, the incrementer I need is 2, not 1 (the thing allows costs of 2, 4, or 6). I had already writtten a field (with defvalue="1") into this thing in order to allow the user to set a different increment when needed, but when I tried to set;
<incrementer field="valCost" interval="valInc" </incrementer> it gave me an error. For now, I'm going to write a second incrementer, with increment="2", and add an if/then to switch between them. |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
Your solution is correct. Each incrementer can be assigned an interval, but that value must be an explicit integer. That means you'll need two separate portals if you want one with an increment of one and another with an increment of two.
The other approach you might consider is to always use an increment of one and then setup the multiplier internally. For example, if you look at the Savage Worlds example files, they use a range of 2-6 with an increment of 1, then they multiply everything by 2 for final display. The user sees it as a range of 4-12 with an increment of 2, but it's actually tracked as a range of 2-6 internally. |
#2 |
|
|