I was trying to automate a process,I misspoke, I meant hIsOn1 and hIsOn2. I have an ability that relies on the number of turn attempts remaining in a day, and that itself used up turn attempts. I call them Auras. So, when I activate an Aura, available equal to the number of turn attempts remaining in the day, it puts a charge on the turning attempts, and a charge on the Aura. For example:
AuraX 0/2 : requires 2 turn attempts to use.
AuraY 0/4 : requires one turn attempt to use.
Turn Undead 0/4
Using one of the AuraX charges, you end up with:
AuraX 1/2
AuraY 0/3
Turn Undead 2/4
So I'm dynamically updating the charges (yeah, I know the dangers, I've worked past them by doing exception catches in the code). So I'm using trustme to make everything work, and the updating is sound. Now I need to know what updating is taking place (decrementing a charge, or incrementing a charge, for resetting essentially). Crazy idea huh?
This is the crazy code, without the listeners present, for a simple effect.
~ Generate our number of uses dependent on turn attempts remaining.
var current as number
trustme
current = hero.child[xTurning].field[hTotal].value - hero.child[xTurning].field[hUsed].value
~ Check for current uses on a selected ability.
field[hTotal].value = current + field[hUsed].value
~ Make sure the uses don't exceed totals.
if (field[hUsed].value > field[hTotal].value) then
field[hTotal].value = field[hUsed].value
endif
~ Determine uses of the turning ability.
if (<listener inc/dec>) then
hero.child[xTurning].field[hUsed].value += 1
~ or -1, depending on what listener returns.
endif
~ Make sure the uses don't exceed totals.
if (hero.child[xTurning].field[hUsed].value > hero.child[xTurning].field[hTotal].value) then
hero.child[xTurning].field[hUsed].value = hero.child[xTurning].field[hTotal].value
endif