Another Example:
Get some Tongs and shadow Iron(or change the arguments for the procedure Craft;) ).
Open the Tool a single one and modify ressource to a complete different color than shadow.
then run my code while staying at anvil and forge.
Then you see how fast the Serial handling and the GumpID handling could work.
It will craft you once a shadow iron ringmail sleeve(or different item if you have changed craftmenu or changed the packet to server.
program Bodfiller;
const CraftGumpType = 949095101;
const RessourceButton = '7';
//#######################################
//---------------------------------------
//#######################################
procedure WaitForCraft();
begin
while GetGumpID((GetGumpsCount() - 1)) <> CraftGumpType do
begin
Wait(100);
end;
end;
//---------------------------------------
procedure OpenTool(ToolID:Integer);
begin
while GetGumpID((GetGumpsCount() - 1)) <> CraftGumpType do
begin
UseObject(ToolID);
wait(300);
end;
end;
//--------------------------------------
procedure CloseTool();
begin
while GetGumpID((GetGumpsCount() - 1)) = CraftGumpType do
begin
CloseSimpleGump((GetGumpsCount() - 1));
end;
end;
//---------------------------------------
procedure ClickButton(Click:String);
var Serial:Integer;
var tmp : Boolean;
begin
Serial := GetGumpSerial((GetGumpsCount() - 1));
while tmp = false do
begin
if GetGumpID((GetGumpsCount() - 1)) = CraftGumpType then
begin
if Serial <> GetGumpSerial((GetGumpsCount() - 1)) then
begin
tmp := true;
end else
begin
WaitGump(Click);
Wait(300);
end;
end;
end;
end;
//---------------------------------------
procedure Craft(ToolID:Integer;Cat,Button,Res:String);
begin
if GetType(ToolID) > 0 then
begin
OpenTool(ToolID)
ClickButton(RessourceButton);
ClickButton(Res);
ClickButton(Cat);
ClickButton(Button);
WaitForCraft();
CloseTool();
end;
end;
//#######################################
//---------------------------------------
//#######################################
begin
Craft($4012D6EB,'1','16','20');
AddToSystemJournal('Done');
end.
Instead of $4012D6EB give it an ID of a Tool of yours. when you see the first line, it were some start for the Bodfiller iam working on.