SRL Archive - OSR Help

Looting with Reflection?


bas

2014-10-01 12:04:29

Title say it.

How do i loot ground items with Reflection?
Also if there any other ways possible to accurate looting?

Thanks! Bas.

Fitta

2014-10-01 12:40:55


function IntInArrEx(var index: integer; iarr: TIntegerArray; int: Integer): boolean;
var
I: Integer;
begin
For I:=0 to High(iarr)do
if iarr[I] = int then
begin
Result := True;
Index := I;
Exit;
end;

end;

function FindExtras: boolean;
var
Items: TGroundItemArray;
IDs: TIntegerArray;
ExName: TStringArray;
MP: TPoint;
I, L, H: Integer;
begin
If (Not LoggedIn)then
Exit;

Items := R_GetGroundItemsDistance(30);
H := High(Items);
If H = -1 then
Exit;

IDs := [561, 563, 9142];
ExName := ['Take Nature rune', 'Take Law rune', 'Take Mithril bolt'];

For I:=0 to High(Items)do
If IntInArrEx(L, IDs, Items[I].ID) then
begin

If (r_InvFull)then
Exit;

If Not r_TileOnMS(Items[I].Tile)then
Continue;

// First check if uptext is correct
If R_IsUpText(ExName[L])then
begin
CMHere(True);
WaitPickUp(Items[I].Tile);
Result := True;
Continue;
end;

MP := r_TileToMS(Items[I].Tile);
MMouse(MP.X, MP.Y, 5, 5);

If R_WaitUpText(ExName[L], 200+Random(200))then
begin
CMHere(True);
WaitPickUp(Items[I].Tile);
Result := True;
Continue;
end else
begin
Writeln('Hard time finding item');
If r_IsUpText('Walk here')then
Exit;

CMHere(False);
Result := r_WaitChooseOption(ExName[L], 200+Random(200));
WaitPickUp(Items[I].Tile);
end;


end;


end;

That's my function from my druidkiller.. Read the code, if you don't understand one/or any part of it, just post :)

bas

2014-10-01 13:21:04

From: Fitta

function IntInArrEx(var index: integer; iarr: TIntegerArray; int: Integer): boolean;
var
I: Integer;
begin
For I:=0 to High(iarr)do
if iarr[I] = int then
begin
Result := True;
Index := I;
Exit;
end;

end;

function FindExtras: boolean;
var
Items: TGroundItemArray;
IDs: TIntegerArray;
ExName: TStringArray;
MP: TPoint;
I, L, H: Integer;
begin
If (Not LoggedIn)then
Exit;

Items := R_GetGroundItemsDistance(30);
H := High(Items);
If H = -1 then
Exit;

IDs := [561, 563, 9142];
ExName := ['Take Nature rune', 'Take Law rune', 'Take Mithril bolt'];

For I:=0 to High(Items)do
If IntInArrEx(L, IDs, Items[I].ID) then
begin

If (r_InvFull)then
Exit;

If Not r_TileOnMS(Items[I].Tile)then
Continue;

// First check if uptext is correct
If R_IsUpText(ExName[L])then
begin
CMHere(True);
WaitPickUp(Items[I].Tile);
Result := True;
Continue;
end;

MP := r_TileToMS(Items[I].Tile);
MMouse(MP.X, MP.Y, 5, 5);

If R_WaitUpText(ExName[L], 200+Random(200))then
begin
CMHere(True);
WaitPickUp(Items[I].Tile);
Result := True;
Continue;
end else
begin
Writeln('Hard time finding item');
If r_IsUpText('Walk here')then
Exit;

CMHere(False);
Result := r_WaitChooseOption(ExName[L], 200+Random(200));
WaitPickUp(Items[I].Tile);
end;


end;


end;

That's my function from my druidkiller.. Read the code, if you don't understand one/or any part of it, just post :)


Thank you very much, i will try!

Edit

Throw me a error!

it line up the Continue;

[Error] C:\Usermba(1040:14): Unknown identifier 'r_TileOnMS' at line 1040

When i remove


If Not r_TileOnMS(Items.Tile)then
Continue;

it throw me

[Error] :\Usmba(1044:9): Unknown identifier 'CMHere' at line 1044