SRL Archive - Reflection Development

My reflection function/procedures


Naike

2008-09-07 09:38:16

Number 1



{*******************************************************************************
function PickUpItems(ItemsID : TIntegerArray; UpText : TStringArray; MaxSL : Integer): Boolean;
By: N1ke!
Description: Picks up items with the right ID and String!
*******************************************************************************}
Function PickUpItems(ItemsID : TIntegerArray; UpText : TStringArray; MaxSL : Integer): Boolean;
var
GroundItems : array of TGroundItem;
i, x, y : integer;
Begin
If InvFull Then Exit;
If Not FindGroundItems(GroundItems, [ItemsID], MaxSL)then Exit;
For i:=0 to High(GroundItems)do
begin
Mouse(GroundItems[a].MS.x, GroundItems[a].MS.y, 2, 2, False);
ChooseOptionMulti([UpText]);
Result := True;
FFlag(0);
Wait(RandomRange(300, 1250));
end;
end;

Itemlist can be found at http://runelocus.com/?action=itemlist

HowTo Use?

PickUpItems([3414, 1241, 2515], ['Sword', 'Arrow', 'Bones'], 5);

Numbers is made up.

Note! Needs ChooseOptionMulti to work!!

ChooseOptionMulti ->
{*******************************************************************************
function ChooseOptionMulti(Text: TStringArray): Boolean;
By: Wizzup? Modifyied by N1ke!
Description: Finds Popup menu, then clicks on it.
*******************************************************************************}
function ChooseOptionMulti(Text: TStringArray): Boolean;
var
B: TBox;
TPA: TPointArray;
X, Y, I, C: Integer;
P: TPoint;

begin
Result := False;
GetClientDimensions(B.X2, B.Y2);
B.X1 := 0;
B.Y1 := 0;
FindColorsTolerance(TPA, 4674653, B.X1, B.Y1, B.X2, B.Y2, 0);
If Length(TPA) < 10 Then
Exit;
B.X2 := 0;
B.Y2 := 0;

P := TPA[0];
For I := 0 To High(TPA) - 1 Do
If TPA[I].X = TPA[I+1].X - 1 Then
Begin
If C > 5 Then
Begin
B.X1 := P.X;
B.Y1 := P.Y;
Break;
End Else
C := C + 1;
End
Else
Begin
P := TPA[I + 1];
C := 0;
End;
If I = Length(TPA) Then
Begin
WriteLn('Choose Option Menu Getting Failed');
Exit;
End;
InvertTPA(TPA);
C := 0;
P := TPA[0];
For I := 0 To High(TPA) - 1 Do
If TPA[I].X = TPA[I+1].X + 1 Then
Begin
If C > 5 Then
Begin
B.X2 := P.X;
B.Y2 := P.Y;
Break;
End Else
C := C + 1;
End Else
Begin
P := TPA[I + 1];
C := 0;
End;
If I = Length(TPA) Then
Begin
WriteLn('Choose Option Menu Getting Failed');
Exit;
End;
For i:=0 To High(Text) do
begin

If FindText(X, Y, Text[i], upchars, B.X1, B.Y1, B.X2, B.Y2) Then
Begin
Result := True;
Mouse(B.X1 + 5, y + 1, B.X2 - B.X1 - 5, 13, True);
Exit;
End;
end;

MMouse(B.X1 - 50, B.Y1 - 50, 40, B.Y2 - B.Y1);
Wait(200 + Random(100));
end;

Number 2


{*******************************************************************************
Function InsideArea(Point1, Point2 : Tpoint): Boolean;
By: N1ke!
Description: Point1 = Most north west tile of the area!
Point2 = Most south east tile of the area!
Results true if your inside.
*******************************************************************************}
Function InsideArea(Point1, Point2 : Tpoint): Boolean;
Var MyPos : Tpoint;
begin
MyPos := GetMyPos;
Result := IntInBox(MyPos.X, MyPos.Y, IntToBox(Point1.X, Point1.Y, Point2.X, Point2.Y));
end;



Will be more functions!
I would love if you could request something ;)

Narcle

2008-09-07 09:42:38

How does that pickupitems work? You tell it to mouse "x, y" but you don't declare x, y to anything. Also after it picks up it waits between 300 & 1250 seconds. You should put FFlag(0) in there then have it wait. Otherwise it might not even get to the item before the next procedure kicks in.

Sorry for the slight bash. But that's how i see it. :p

Naike

2008-09-07 09:49:25

I forgot about the x, y, Its a habbit typing x, y in mouse..

Thanks for the feedback ;)

n3ss3s

2008-09-07 09:52:34

Oh, it was fixed already :)


Nice job…

Narcle

2008-09-07 09:54:40

From: n3ss3s
Narcle… He doesn't tell it to mouse X and Y, he tells to mouse the X and Y of an item which got declared by the FindGroundItems.


No he just changed it. :p

it was just Mouse(x, y, 2, 2, false)

welcome

2008-09-15 17:44:12

I'm going to use your function! To get it to work, and it works great btw, I had to change a few things:

If Not FindGroundItems(GroundItems, [COLOR="Magenta"][ItemsID], [/COLOR]MaxSL)then Exit;

I had to take away the brackets around ItemsID, i'm assuming because it is already an array?

Mouse(GroundItems[COLOR="Magenta"][a].[/COLOR]MS.x, GroundItems[COLOR="magenta"][a].[/COLOR]MS.y, 2, 2, False);
I had to change [a] to , i'm assuming just a mistype?

ChooseOptionMulti([UpText]);
And I had to take UpText out of the brackets.
It works really well, I tested by dropping three different types of axe heads on different tiles around the ground and it picked all of them up!

Kudo's to you!