Quick note, you are closing your While loops before you ever run anything.
LOL hahaha
so I like to make my waits variable rather than static... In my experience (may be different on OSI) after clicking the shovel button, you have to wait for the gump to reappear to close it, this takes somewhere beteween 1400 and 1800ms sometimes more (I also have to deal with 4 second saves every now and then, where the screen freezes)
I could use a wait 20 which would cover the gump reappearing most of the time, but that doesn't cover the server saves, so I'd have to go with a wait 90 to compensate, but that would be real lame as it wastes a lot of time, so writing my waits like:
while something not true || something true
{
}
allows for variable wait times that always wait the minimal amount of time (including lag) before performing the next action. I sometimes write gotos with ifs if the procedure calls for it:
set %propcheck #property
finditem * c
propwait:
event property #findid
if #property = %propcheck
goto propwait
that's not really the best example, but I did use something like that for about 2 weeks, before I found a better way.
Keep it simple, after you are done making a shovel just click Exit ("click #contposx+30 #contposy+450" if a crafting gump on OSI). Don't forget to wait until the Gump returns after making the shovel before you move to the next one. I would also suggest eliminating #contkind.
I use a "ClickAndWait" sub which clicks where you want it to click and waits for the Gump to respond before moving on to the next line of code. Fell free to check out my standard subs in my script library, maybe it will help.
X
I use
click #contposx #contposy f r
to close everything with no issues, though I haven't tried it on runebooks because of their oddball #contsize
I also use #contkind and #contsize quite liberally with no issues, and on my miner I have pulled the check values out and put them in the header, so any user could readily change their values if needed.
I agree it's not the simplest approach, but it's the only way I've found to achieve the performance I want
*edit*
PEBKAC at top