Author Topic: Working with Gumps [Tutorial]  (Read 8864 times)

0 Members and 1 Guest are viewing this topic.

Offline Crome969Topic starter

  • Moderator
  • *
  • *****
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Working with Gumps [Tutorial]
« on: April 13, 2012, 11:23:54 PM »
0
« Last Edit: April 14, 2012, 12:13:40 AM by Crome969 »

Offline Crome969Topic starter

  • Moderator
  • *
  • *****
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Working with Gumps [Tutorial]
« Reply #1 on: April 14, 2012, 01:09:05 PM »
0
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.

Offline Boydon

  • Moderator
  • **
  • *****
  • Posts: 76
  • Activity:
    0%
  • Reputation Power: 3
  • Boydon has no influence.
  • Respect: +16
  • Referrals: 0
    • View Profile
Re: Working with Gumps [Tutorial]
« Reply #2 on: April 15, 2012, 02:38:14 AM »
0
Very well done tutorial. :)
Member of the Stealth development team.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Working with Gumps [Tutorial]
« Reply #3 on: April 15, 2012, 09:33:31 AM »
0
Wow, very nice Crome!
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline bendel

  • Full Member
  • ***
  • Posts: 215
  • Activity:
    0%
  • Reputation Power: 4
  • bendel has no influence.
  • Respect: +34
  • Referrals: 0
    • View Profile
Re: Working with Gumps [Tutorial]
« Reply #4 on: December 03, 2012, 03:55:57 AM »
0
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 ?

Offline Crome969Topic starter

  • Moderator
  • *
  • *****
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Working with Gumps [Tutorial]
« Reply #5 on: December 03, 2012, 09:01:57 AM »
0
Code: [Select]
var i : Integer you missed the
Code: [Select]
; at it :D

Offline Neo

  • Prime Program
  • Elite
  • *
  • *
  • Posts: 821
  • Activity:
    0%
  • Reputation Power: 13
  • Neo barely matters.Neo barely matters.
  • Respect: +155
  • Referrals: 3
    • View Profile
Re: Working with Gumps [Tutorial]
« Reply #6 on: March 03, 2013, 06:22:51 PM »
0
Crome, this is a very nice tutorial on how to work with those gumps! Saved for future reference!

Cheers!
Never refuse an invitation.
Never resist the unfamiliar.
Never fail to be polite.
And never outstay your welcome.

Tags: Stealth Tutorial