Log in

View Full Version : Area detecting



NexPB
01-31-2012, 05:17 PM
Why won't this work?

Edit: AtBank does work.


function InArea(Pt1, Pt2: TPoint): Boolean;
var
p: TPoint;
Box: TBox;
begin
p := SPS_GetMyPos;
writeln('Pos := ' + ToStr(p));
Box := PointToBox(Pt1, Pt2);
writeln('Box := ' + ToStr(Box));

if (PointInBox(p, Box)) then
begin
writeln('Player found in area.');
Result := true;
end else
Result := false;

end;

function AtTeleportArea: boolean;
begin
result := (InArea(Point(275, 985), Point(305, 965)));
end;

function AtBank: boolean;
begin
result := (InArea(Point(230, 945), Point(260, 960)));
end;


Debug:

Pos := (295, 970)
Box := (230, 945, 260, 960)
Pos := (295, 970)
Box := (230, 945, 260, 960)
Pos := (295, 970)
Box := (275, 985, 305, 965)

NexPB
02-01-2012, 08:22 PM
Bump, still need some help. Thx

x[Warrior]x3500
02-01-2012, 08:43 PM
AFAIK, sps is broken

NexPB
02-01-2012, 08:55 PM
x3500;913443']AFAIK, sps is broken
Weird it works when I'm standing in the bank :o

Sebo
02-01-2012, 09:18 PM
Your box might be too small, common overlooked problem. Try to remake your AtTeleportArea area.

Remember the area should be something like:



(x1, y1)_____
| |
| Area |
| |
|___________(x2, y2)

Hope that helps.

NexPB
02-02-2012, 04:05 PM
Your box might be too small, common overlooked problem. Try to remake your AtTeleportArea area.

Remember the area should be something like:



(x1, y1)_____
| |
| Area |
| |
|___________(x2, y2)

Hope that helps.
Edit: Thanks :D

m3gaman3g3nd
02-03-2012, 07:46 PM
you should grab the outline on the mm and make a box outa that then that way you dont have 2 specify the size... unless you want to go more advanced