Jump to content
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
Link to comment
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 =)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...