T,
I am pretty raw myself, but I will help as best I can.
A couple of thoughts.
100% agree with MW's suggestions for moving stuff. Standardize the format and you can use one sub to move everything.
I was looking through your gump issues and I have not sorted them out yet, but I suspect its in the click structure you are using. I don't think you care where the gumps are on the screen and I would not bother moving them around for a craft script. You are using gump clicks, but it looks like your script assigns #ContPosX and Y to a variable %gumpx and y and uses these to perform gump clicks. The problem you are having might be that if the container, in this case the craft gump, moves, then those values will be wrong. I like the system TM has posted for gump clicks because it continually calculates the gump offset based on the current value. It won't matter if the gump moves if you are always using the current position value. I don't see much value in re-assigning container variables, but maybe I am missing something. Its at:
http://www.scriptuo.com/index.php?topic=505.0;highlight=offset+click Switching over might fix your problem.
It looks like you are hard-coding the waits after the clicks. This works fine for lots of scripts. I often see a "wait 20" or something like that in craft scripts after a gump click with a check to see if it worked. Personally I prefer a gumpwait sub that will give me a return result if the gump doesn't open within a time window. You can set the timeout to a length of time that should never occur (its a craft script!) and then if it doesn't work, then you put in code to cycle back to the beginning of the click series. I would start with sorting out your gump clicks though, as I suspect that is where things are going wrong.
Here is the structure of gumpwaits I have been using for craft scripts:
SomethingWentWrongLoop:
Gosub OffSetClick 280 450 ; make last
gosub waitforgump %cwin
if ! #result
{
Goto SomethingWentWrongLoop
}
;================== Wait for gump ======================
sub waitforgump
set %timeout #scnt + 10
while #contsize <> %1
{
wait 1
if #scnt > %timeout
{
return #false
}
}
wait %gumpwait
return #true
You also need to have defined the gumps you will use in the script and the gump wait interval in your setup like this:
set %cwin 530_507 ; Crafting window size
set %gumpwait 1 ; Increase number to slow down clicks on menus. 20 = 1 second.
As an aside, I would never start working from on a script with the menu. Although that's where most scripts start from the user side, beginning your draft work there introduces another layer of opportunity to introduce errors. Better to get the script doing what its supposed to first and then put the menus on -- although I generally never get to that!!
Ps. Just a heads up, the real coders on this board abhore goto's and don't like the loop I use in my gump-waits because you can't proof the script. If I find a cleaner way to do the same thing I will change my ways!!