ScriptUO

Scripting Resources & Utilities => Stealth Client => Stealth archive => Topic started by: Crome969 on April 13, 2012, 11:23:54 PM

Title: Working with Gumps [Tutorial]
Post by: Crome969 on April 13, 2012, 11:23:54 PM
Title: Re: Working with Gumps [Tutorial]
Post by: Crome969 on April 14, 2012, 01:09:05 PM
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.
Code: [Select]
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.
Title: Re: Working with Gumps [Tutorial]
Post by: Boydon on April 15, 2012, 02:38:14 AM
Very well done tutorial. :)
Title: Re: Working with Gumps [Tutorial]
Post by: TrailMyx on April 15, 2012, 09:33:31 AM
Wow, very nice Crome!
Title: Re: Working with Gumps [Tutorial]
Post by: bendel on December 03, 2012, 03:55:57 AM
Hi chrome,

when i try to debugg theses lines :

program example;
var MyGumpList :TStringList; // Datatype to save Informations
var i : Integer // We need this for the for loop
begin //Begin of MainBody
MyGumpList := TStringList.Create(); // Constructor to create a Stringlist
GetGumpFullLines((GetGumpsCount() - 1),MyGumpList ); //Saves the last Opened Gump in List
for i := to ( MyGumpList.Count() - 1 ) do //Loop who will start from first Line until End
begin //begin of Loop
AddToSystemJournal(MyGumpList[(i)]); //Calling each line and print it out.
end; // end of Loop
end. //end of MainBody


i have error in return :/ 

>>>  13:53:37:026 [******]: Compiler: [Error] (example.sc at 4:1):  Semicolon (';') expected
         13:53:37:141 [******]: Compiling failed

any idea what i did wrong ?
Title: Re: Working with Gumps [Tutorial]
Post by: Crome969 on December 03, 2012, 09:01:57 AM
Code: [Select]
var i : Integer you missed the
Code: [Select]
; at it :D
Title: Re: Working with Gumps [Tutorial]
Post by: Neo on March 03, 2013, 06:22:51 PM
Crome, this is a very nice tutorial on how to work with those gumps! Saved for future reference!

Cheers!