SRL Archive - SRL Snippets

SPS Debug Procedures


Olly

2012-12-05 14:37:38

Here are some debug procedures for SPS.


SPS_SPS_DebugLocOnMap - This will show your current position on the SPS map your using, this is handy for seeing how accurate SPS/your map is. (this will only work with custom sps maps stored in "runescape_other")




procedure SPS_DebugLocOnMap(Area: string; Pos: TPoint);
var
bmp, i, w, h: Integer;
Pts, CPts: TPointArray;
Path: string;
begin
Path := IncludePath + 'SPS\img\runescape_other\' + Area + '.png';

if not FileExists(Path) then
begin
srl_Warn('SPS_DebugLocOnMap', '[' + Path + '] does not exist', warn_AllVersions);
Exit;
end;

ClearDebugImg;
BMP := LoadBitmap(Path);
GetBitmapSize(bmp, w, h);
DisplayDebugImgWindow(W + 5, H + 5);
TPAFromCircleWrap(Pos.X, Pos.Y, 76, CPts);
TPAFromCircleWrap(Pos.X, Pos.Y, 2, Pts);
FillEllipse(pts);

for i := 0 to high(pts) do
begin
try
FastSetPixel(bmp, pts[i].x, pts[i].y, cllime);
except
end;
end;

for i := 0 to high(Cpts) do
begin
try
FastSetPixel(bmp, Cpts[i].x, Cpts[i].y, cllime);
except
end;
end;

DrawBitmapDebugImg(bmp);
FreeBitmap(BMP);
end;


il add more in the future…

Mat

2012-12-05 14:39:08

Very Nice I like it :)

Google

2012-12-05 14:39:52

Could this be used for the whole path or just one point?

Olly

2012-12-05 14:41:34

From: Google
Could this be used for the whole path or just one point?


Just a point currently, I could make it so it records a path it walks?

Mat

2012-12-05 14:50:43

In theory once you have your current pos it shouldn't be that hard to calc where all the points will be.
Mat

Olly

2012-12-05 21:28:21

From: Mat
In theory once you have your current pos it shouldn't be that hard to calc where all the points will be.
Mat


Yeah but sps_pos isnt 100% accurate so over the course of the path it would go way off + the "stretch" of the minimap will make the points even more off.

Justin

2012-12-07 01:02:54

Nice work Olly, Keep it up

P1ng

2012-12-07 18:29:11

This looks really nice, I've always been a bit on and off with SPS so hopefully this will make debugging some errors a bit easier

Coh3n

2012-12-12 00:25:54

From: Ollybest
Yeah its quite useful, I was actually surprised at how accurate it was on world map(an outdated map at that). It could do with some extra features such as loading maps from runescape_surface and maybe some cleaning up.
That's the easy part. ;) Just add a parameter for the image path.

Better yet, since every area has a unique name, you could just take the area name as a parameter (like you do now), and in your function (or write a separate one), loop through the SPS img/ directory looking for the write file. May not be necessary, but would be cool. :)

Olly

2012-12-12 00:28:59

From: Coh3n
That's the easy part. ;) Just add a parameter for the image path.

Better yet, since every area has a unique name, you could just take the area name as a parameter (like you do now), and in your function (or write a separate one), loop through the SPS img/ directory looking for the write file. May not be necessary, but would be cool. :)


Thats a great idea actually, thanks :p

edit: actually couldn't I just use the SPS_AreaMaps global var, as in use that as the bitmap?
edit2: actually sps_areamaps is T3DIntegerArray, throws that idea away :p

Coh3n

2012-12-12 00:40:32

From: Ollybest
Thats a great idea actually, thanks :p

edit: actually couldn't I just use the SPS_AreaMaps global var, as in use that as the bitmap?
edit2: actually sps_areamaps is T3DIntegerArray, throws that idea away :p
That was the first thing I thought of too, then realized it's used to store some math work from the plugin.

Shatterhand

2012-12-13 11:44:31

Great idea. This could be very useful. Nice work. :)