I'm attempting to write out a sub while using the for command.  What I have is a bag full of ore, and I count how much is in the bag, then set the number to %count.
Then use this line:
for %i 1 %count
It should repeat as many times as I have ore in the bag, at least thats how I understood the information on EasyUO.
Here is the sub I have written so far.  My issue is it repeats the sub twice, then moves on.
sub id_ore
finditem %ore_type C_ , %ResourcesChest
set %count #findcnt
for %i 1 %count
    {
    finditem %ore_type C_ , %ResourcesChest
    set #ltargetid #findid
    set #ltargetkind 1
    if #findcol = %iron_color
       {
       set %iron_ore #ltargetid
       ignoreitem #ltargetid
       }
    if #findcol = %dull_color
       {
       set %dull_ore #ltargetid
       ignoreitem #ltargetid
       }
    if #findcol = %shad_color
       {
       set %shad_ore #ltargetid
       ignoreitem #ltargetid
       }
    if #findcol = %copp_color
       {
       set %copp_ore #ltargetid
       ignoreitem #ltargetid
       }
    if #findcol = %brnz_color
       {
       set %brnz_ore #ltargetid
       ignoreitem #ltargetid
       }
    if #findcol = %gold_color
       {
       set %gold_ore #ltargetid
       ignoreitem #ltargetid
       }
    if #findcol = %agap_color
       {
       set %agap_ore #ltargetid
       ignoreitem #ltargetid
       }
    if #findcol = %veri_color
       {
       set %veri_ore #ltargetid
       ignoreitem #ltargetid
       }
    if #findcol = %valo_color
       {
       set %valo_ore #ltargetid
       ignoreitem #ltargetid
       }
    }
return