SRL Archive - OSR Help

Pointinbox not working well


rj

2013-04-12 20:58:38

So I am attempting to use SPS to get my position in a dungeon, and it seems that it is getting my position right everytime, but it is not getting my location right:

{$DEFINE SMART}
{$i srl/srl.simba}
{$i sps/sps.simba}
procedure WalkBank;
var
ToBankVar: TPointArray;
P:Tpoint;
begin
//MakeCompass(360 - Random(10));
SPS_Setup(RUNESCAPE_OTHER,['dwarven_mine']);
// SPS_WalkPath(ToBankVar)
// SPS_MatchesPercent := 0.40; //.4, 500
// SPS_Tolerance := 550.000;
writeln(SPS_getmypos);
p := SPS_Getmypos;
if PointInBox(p, IntToBox(195, 623, 167, 639)) then
begin
writeln('left side')
end;
end;
begin
setupSRL;
WalkBank;
repeat
walkbank;
until false;
end.


If I am within that box it is supposed to tell me "left side" but it never tells me, so I don't know what the problem is

Olly

2013-04-12 21:01:04

What point is it returning?

rj

2013-04-12 21:03:05

From: Ollybest
What point is it returning?


Top left

(195, 619)
(just changed wowo)

bottom right:

(171, 639)

Middle:

(187, 627)

Olly

2013-04-12 21:10:36

program new;

var
bmp: integer;

begin

bmp := createBitmap(700, 700);

fastSetPixel(bmp, 195, 623, 255);

fastSetPixel(bmp, 167, 639, 2206051);

DrawBitmapDebugImg(bmp);
DisplayDebugImgWindow(700, 700);
end.

what kind of box is that..? box := intToBox(topleftX, topLeftY, bottomRightX, bottomRightY);

rj

2013-04-12 21:11:47

From: Ollybest
program new;

var
bmp: integer;

begin

bmp := createBitmap(700, 700);

fastSetPixel(bmp, 195, 623, 255);

fastSetPixel(bmp, 167, 639, 2206051);

DrawBitmapDebugImg(bmp);
DisplayDebugImgWindow(700, 700);
end.

what kind of box is that..? box := intToBox(topleftX, topLeftY, bottomRightX, bottomRightY);

thats what i did

Olly

2013-04-12 21:13:31

run the script..
http://i.imgur.com/aIww7pW.png

looks like sort of wrong to me.

rj

2013-04-12 21:24:23

From: Ollybest
run the script..
http://i.imgur.com/aIww7pW.png

looks like sort of wrong to me.


Ok heres the points i'm getting:


So if im standing in the middle point is should be returning "left side"

Olly

2013-04-12 21:28:48

From: Officer Barbrady
Ok heres the points i'm getting:


So if im standing in the middle point is should be returning "left side"


make the box from the sps map

rj

2013-04-12 21:31:36

From: Ollybest
make the box from the sps map


Lol i found the problem I was getting my pos not facing north, ty sir

Nebula

2013-04-12 21:31:47

Make SPS_MatchesPercent higher.. the default is .3 but because of the black area you should use .45 atleast, probably .5

rj

2013-04-12 21:32:36

From: Nebula
Make SPS_MatchesPercent higher.. the default is .3 but because of the black area you should use .45 atleast, probably .5


what about the tol? i set to 550

Nebula

2013-04-12 21:34:38

Dunno about tol… the default is 600 I belive and since you have a custom map you won't need as much tolerance so yeah 550 seems alright.

rj

2013-04-12 22:40:46

From: Nebula
Dunno about tol… the default is 600 I belive and since you have a custom map you won't need as much tolerance so yeah 550 seems alright.


Actually I'm using the one in the include when I try to use my own custom one it does not work: http://uppit.com/z79if86ah0xw/sps_coal.png