I am trying to make a script that adds one to the count for an advance only if the advance has a cost of 4 xp. I'd like for the iteration to ignore advances in the count if it has a cost other than 4xp. Ultimately, once the code is counting correctly I will divide it by 4 and round up so the advance applies to the level it was attained at.
Here is the code I came up with.
For some reason it's still counting the advances that cost less than 4 xp and I want it to not do that. How could I fix the code? Ideas?
Here is the code I came up with.
For some reason it's still counting the advances that cost less than 4 xp and I want it to not do that. How could I fix the code? Ideas?
Code:
doneif (field[advCost].value <> 4)
if (tagis[AdvanceCat.Advancement] <> 0) then
var advcount as number
var advcur as number
var i as number
advcur = field[advOrder].value
for i = 1 to advcur
if (field[advCost].value = 4) then
advcount += 1
endif
next
field[advCount].value = advcount
advcount /= 4
advcount = round(advcount,0,1)
endif