SRL Archive - SRL Suggestions

R_ClickItem


rogeruk

2009-08-30 17:14:31

{*******************************************************************************
function R_ClickItemID(ID: integer): Boolean;
Description: Clicks an item with the given ID and chooses the given option.
*******************************************************************************}
function R_ClickItemID(ID: integer): Boolean;
var
Inv, x, y, itemID, i: integer;
B: TBox;
begin
Inv := GetInterface(149, 0);
Result := False;
for i := 0 to 27 do
begin
itemID := SmartGetFieldArrayInt(Inv, InventoryItemIDs, i);
if (itemID > 0) and (itemID = ID) then
begin
B := InvBox(i+1);
MouseBox(B.x1, B.y1, B.x2, B.y2, 1);
Wait(50+Random(50));
Break;
end;
end;
SmartFreeObject(Inv);
end;

Sabzi

2009-08-30 18:00:25

Pretty much the same as the fixed version I fixed from Coh3n's one:
http://www.villavu.com/forum/showpost.php?p=616780&postcount=6

No offence because this can't really be done any different way. Just to inform you :).
And also to make ensure this will be added. As you are not the only one thinking about this.

EDIT:
Also, will this ever returns true?
There is just one line setting it false. Then result is not set any more.
Either this should be a procedure and let the user check before this for the item is it exists or not or
Result := True; before B := In …

rogeruk

2009-08-30 19:54:29

Didnt bother searching. I needed the function for a script so i altered the current MouseItemID.

Sir R. M8gic1an

2009-08-31 15:50:13

These forums are not for the reflection include…. :p

~RM