SRL Archive - Reflection Help

R_TileInBox


fre

2011-08-06 05:36:01

[php]
Procedure GetFight;
var
NPCS:TNPCArray;
NPC: TNPC;
i: Integer;
Box, Boxx: TBox;
begin
Box.x1:= 2860;
Box.y1:= 4223;
Box.x2:= 2864;
Box.x2:= 4219;
Boxx.x1:= 2862;
Boxx.y1:= 4219;
Boxx.x2:= 2866;
Boxx.x2:= 4218;
NPCs:=R_GetNPCs('Monster', False);
for i := 0 to high(NPCs) do
begin
if NPCs.Animation = -1 then
if ((R_TileInBox(Box, NPCs.tile)) or (R_TileInBox(Boxx, NPCs.tile))) then
begin
writeln(tostr(NPCs.tile));
MMouseToMS(NPCs.tile,5);
wait(10+random(10));
if R_WaitUpText('ttack',100) then
ClickMouse(True);
Exit;
end;
end;
end;
[/php]

It often clicks on monsters below 4218, altough i set that as the lowest y coordinate possible to attack monsters.

Any idea how this may happen?

~Fre

masterBB

2011-08-06 11:45:20

Box.x1:= 2860;
Box.y1:= 4223;
Box.x2:= 2864;
Box.x2:= 4219;

should be:

Box.x1:= 2860;
Box.y1:= 4223;
Box.x2:= 2864;
Box.y2:= 4219;

The same for boxx.

fre

2011-08-07 16:35:46

HAHA, damn
i checked the values like 1000 times, but i never checked the vars.

thx :)

Dgby714

2011-08-07 19:22:13

Bored cleanup….

function GetFight(): boolean;
var
NPCs: TNPCArray;
Boxes: array[0..1] of TBox;
I, H: LongInt;
begin
Boxes[0] := IntToBox(2860, 4223, 2864, 4219);
Boxes[1] := IntToBox(2862, 4219, 2866, 4218);
NPCs := R_GetNPCs('Monster', False);
H := High(NPCs);
for I := 0 to H do
if (NPCs[I].Animation = -1) then
if (R_TileInBox(Boxes[0], NPCs[I].Tile) or R_TileInBox(Boxes[1], NPCs[I].Tile)) then
begin
MMouseToMS(NPCs[I].Tile, 5);
Wait(10 + Random(10));
if (R_WaitUpText('ttack', 100)) then
begin
DebugLn(ToStr(NPCs[I]));
Result := True;
Exit;
end;
end;
end;

Edit: Noticed a small mistype.