Well, I really wasn't sure what to title this post, but I'm working on a Ore Smelting script. I'm able to get it working overall, but I am fine tuning some parts, and have hit a wall.
In my sub, where I identify the ore to be smelted, I am using a #findindex to search the bag, and I ignore all the ore that is not what I need (i.e. searching for iron). Then do a search in the bag for #findcnt and if no ore is left in the bag, uncheck the checkbox, reset the ignoreitem and begin the next search.
Why do I ignore it?
Well I'm using a Check Box in my menu that lets people select what type of ore they want to smelt at that time. I know it seems silly, but even I have only wanted to smelt some Verite when I need some, and have a bag full of ore.
Now I have just figured out that #findindex is a great way to search through the bag, and I'm attempting to condense my scripts and simplify them without using #finditem over and over and over as I have done in the past.
Here is what I have written to accomplish my task. However it always skips over the #findcnt section, so it never resets the ignoreitem, and does not uncheck the checkbox pertaining to that type of ore.
menu get iron pertains to the checkbox that is for Iron Ore.
%ore_type is the 4 types of ore that can be found (small broken, small, medium and large)
%resource_bag is obviously the bag full of ore
smelt_iron is the number of ore they are smelting at one time
%iron_color is 0, I have designated the color of each ore to identify them by, it works.
finditem %ore_type C_ , %resource_bag
menu get iron
if #menures = #true
{
for #findindex 1 #findcnt
{
if #findcol = %iron_color
{
set %ore #findid
set %smelt smelt_iron
}
if #findcol <> %iron_col
ignoreitem #findid 1
if #findcnt < 1
{
menu set iron #false
ignoreitem reset 1
gosub select_ore
}
}
return
}
It repeats the #findindex the number of times that I have ore in the pack, but once it goes through the last loop, it does not go through the if #findcnt < 1 section.
I know it may seem silly to you TM, but It looks correct to me. Why isn't it working?