SRL Archive - Reflection Help

I need help with items


Camaro'

2009-05-05 05:39:20

i dont get how to click items with there id .. i needz help.. thanks


i need help with click an inventory item with a certain id. Or using an array of ids if thats possible.

mormonman

2009-05-05 05:40:47

Click in inv? on ground?

Camaro'

2009-05-05 05:48:40

inventory, sorry, i edited main post… Maybe its a little more clear.

mormonman

2009-05-05 05:52:38

{*******************************************************************************
function R_MouseItemID(ID: integer; Option: string): Boolean;
By: lordsaturn
Description: Clicks an item with the given ID and chooses the given option.
*******************************************************************************}

senrath

2009-05-05 05:52:41

{*******************************************************************************
procedure R_ClickAllItems(IDs: TIntegerArray; Options: TStringArray);
By: lordsaturn
Description: Clicks all of the items with the given IDs and options corresponding
to each other's indexes.
*******************************************************************************}

Methinks that's what you want.

mormonman

2009-05-05 05:56:52

Just whipped this up :p

{*******************************************************************************
function R_MouseItemIDs(ID: TIntegerArray; Option: string): Boolean;
By: lordsaturn modded by mormonman
Description: Clicks an item with the given ID and chooses the given option.
*******************************************************************************}
function R_MouseItemIDs(ID: TIntegerArray; Option: string): Boolean;
var
Inv, x, y, itemID, i, t: integer;
B: TBox;
begin
Inv := GetInterface(149, 0);
Result := False;
for t := 0 to High(ID) do
begin
for i := 0 to 27 do
begin
itemID := SmartGetFieldArrayInt(Inv, InventoryItemIDs, i);
if (itemID > 0) and (itemID = ID[t]) then
begin
B := InvBox(i+1);
MMouse(B.x1, B.y1, B.x2-B.x1, B.y2-B.y1);
Wait(50+Random(50));
if OptionExists(Option) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Result := R_ChooseOption(Option);
Break;
end;
end;
end;
end;
SmartFreeObject(Inv);
end;

E: senrath, you fail… i think he wants to click food? and that means that he doesn't want to click them all at once.

Camaro'

2009-05-05 06:18:58

From: mormonman
Just whipped this up :p

{*******************************************************************************
function R_MouseItemIDs(ID: TIntegerArray; Option: string): Boolean;
By: lordsaturn modded by mormonman
Description: Clicks an item with the given ID and chooses the given option.
*******************************************************************************}
function R_MouseItemIDs(ID: TIntegerArray; Option: string): Boolean;
var
Inv, x, y, itemID, i, t: integer;
B: TBox;
begin
Inv := GetInterface(149, 0);
Result := False;
for t := 0 to High(ID) do
begin
for i := 0 to 27 do
begin
itemID := SmartGetFieldArrayInt(Inv, InventoryItemIDs, i);
if (itemID > 0) and (itemID = ID[t]) then
begin
B := InvBox(i+1);
MMouse(B.x1, B.y1, B.x2-B.x1, B.y2-B.y1);
Wait(50+Random(50));
if OptionExists(Option) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Result := R_ChooseOption(Option);
Break;
end;
end;
end;
end;
SmartFreeObject(Inv);
end;

E: senrath, you fail… i think he wants to click food? and that means that he doesn't want to click them all at once.


You got it rite on, but i havent tested that new one you gave me. The other one, didnt work. So ill try this one tommrowo