Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
sjesper

CompareInvSlots - Function

Recommended Posts

Hello.

 

I felt boring so i made this little function:

 

[sCAR]program New;

 

{$DEFINE RS2}

{$DEFINE OSI_Color_Anti_Randoms}

{$DEFINE SMART}

 

{$I OSI\OSI.scar}

 

procedure ScriptTerminate;

begin

FreeOSI;

end;

 

function CompareInvSlots(Slot_1, Slot_2, Tolerance: Integer): Boolean;

var

TBA: TBoxArray;

Bmp: Integer;

x, y: Integer;

begin

TBA[0] := GetItemBounds(Slot_1);

TBA[1] := GetItemBounds(Slot_2);

Bmp := BitmapFromString(35, 31, '');

 

CopyClientToBitmap(Bmp, TBA[0].X1, TBA[0].Y1, TBA[0].X2, TBA[0].Y2)

 

Result := FindBitmapToleranceIn(Bmp, x, y, TBA[1].X1, TBA[1].Y1, TBA[1].X2, TBA[1].Y2, Tolerance);

FreeBitmap(Bmp);

end;

 

begin

SetUpOSI;

writeln(CompareInvSlots(1, 0, 22));

end.

[/sCAR]

What it does is that it take a picture of 2 invslots and see if they are almost the same.

 

If you need to compare teleporttabs or other items that are very identical then use a tolerance of ~ >18, but 22 works with the most items :-)

Edited by sjesper

Share this post


Link to post
Share on other sites

The main problem with inventory items, is every once in a while they are Chopped up a little lol. Like for me Rune essence looks different sometimes (IDK why its weird). This is good might add it to the Inventory functions in GMRL's RS2 include.

Share this post


Link to post
Share on other sites
The main problem with inventory items, is every once in a while they are Chopped up a little lol. Like for me Rune essence looks different sometimes (IDK why its weird). This is good might add it to the Inventory functions in GMRL's RS2 include.

 

Meaby it would help to set the 35 * 31 bounds to something like 20 * 16. Is it only the outside of the rune essence that looks difrence something? Then this would help =)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×