SRL Archive - SRL Suggestions

Universal Tool finding for use with /skill


NCDS

2010-07-07 13:15:40

Well, me and Coh3n were talking and this idea came to me. One universal function to find all the tools needed for use in /skill.

The following function could find any tool in the Inventory by simply specifying the correct bitmap to search for.

function TinderBoxExists(var x, y: Integer): Boolean;
begin
Gametab(tab_Inv);
Wait(300 + Random(300));
Result := FindBitmapToleranceIn(TinderBox, x, y, MIx1, MIy1, MIx2, MIy2, 10);
end;

So, by generalizing the name to something like 'InvItemExists()' (credits to Coh3n for that) and making it take in a bitmap parameter we could eliminate a good amount of repeated code in the include.

Coh3n also said that if this were to be done, it would fit best in Inventory.simba, which I agree with.

Post your thought's.

Coh3n

2010-07-07 13:18:12

I would much rather see DTMs being used rather than Bitmaps, but that's just me. In my experience, DTMs have been more reliable.

Nava2

2010-07-07 16:41:37

DTMs > Bitmaps.

Coh3n

2010-07-07 17:18:01

Committed this:

{*******************************************************************************
function ExistsItemDTM(dtm: Integer; var x, y: Integer): Boolean;
By: NCDS
Description: Checks if the item with dtm is in the inventory. Returns the item's
coordinates.
*******************************************************************************}
function ExistsItemDTM(dtm: Integer; var x, y: Integer): Boolean;
begin
Gametab(tab_Inv);
Wait(300 + Random(300));
Result := FindDTM(dtm, x, y, MIx1, MIy1, MIx2, MIy2);
end;

NCDS

2010-07-07 17:32:21

From: Coh3n
Committed this:

{*******************************************************************************
function ExistsItemDTM(dtm: Integer; var x, y: Integer): Boolean;
By: NCDS
Description: Checks if the item with dtm is in the inventory. Returns the item's
coordinates.
*******************************************************************************}
function ExistsItemDTM(dtm: Integer; var x, y: Integer): Boolean;
begin
Gametab(tab_Inv);
Wait(300 + Random(300));
Result := FindDTM(dtm, x, y, MIx1, MIy1, MIx2, MIy2);
end;


Thanks man :)