PDA

View Full Version : This inventory snippet o' mine.



n3ss3s
08-28-2007, 03:26 PM
Basically, the meaning of this function is to return all the stuff in inventory, which is not supposed to be there.

SRL Members, etc dont propably need advice on how it works, but anyways,

Set the "Range" to the range from the middle of inventory slot, to the max area away from your DTM.

It does following to every inventory slot:

Creates the "box" around current slot, checks if the DTM of "Item Supposed to Exist" is there, if not, it saves it to an array, gets the name.

Returns names of "Bad stuffs" to the "Stuffs", and returns the points of them as the result.


function BadStuff(ExceptForDTM: TIntegerArray; Range: Integer;
var Stuffs: TStringArray): TPointArray;
var
I, Inv, Ix1, Iy1, Ix2, Iy2, X, Y, Stringz: Integer;
var
Item: TPoint;
begin
for Inv := 1 to 28 do
begin
Item := ItemCoords(Inv);
Ix1 := Item.x - Range;
Iy1 := Item.y - Range;
Ix2 := Item.x + Range;
Iy2 := Item.y + Range;
for I := 0 to GetArrayLength(ExceptForDTM) - 1 do
begin
if(FindDTM(ExceptForDTM[i], X, Y, Ix1, Iy1, Ix2, Iy2))then
begin
SetArrayLength(Result, Length(Result) + 1);
Result[Length(Result) - 1].x := X;
Result[Length(Result) - 1].x := X;
end;
end;
end;
Item.x := 0;
Item.y := 0;
for Stringz := 0 to GetArrayLength(Result) - 1 do
begin
Item := Result[stringz];
MMouse(Item.x, Item.y, 3, 3);
SetArrayLength(Stuffs, Length(Stuffs) + 1);
Stuffs[Length(Stuffs) - 1] := GetTextAtEx(7, 7, 100, upchars, True, True, 0,
2, 3569100, 50, False, tr_AllChars);
end;
end;


Umm, havent tested... Anyways, in theory it should propably work.

Pancakes
10-03-2007, 12:24 AM
Couldn't you just drop everything that isn't the DTM though?