I just tried doing it like this thinking it would go through each of the items in advances and pick off a count for only certain ones but it seems to not work like I intended.
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
i = 1
foreach pick in hero from Advance where "AdvanceCat.Advancement"
while (i <= field[advOrder].value)
if (eachpick.field[advCost].value = 4) then
advcount += 1
endif
i += 1
loop
nexteach
field[advCount].value = advcount
advcount /= 4
advcount = round(advcount,0,1)
endif