All this small script does is:
- Convert coordinates based off of map segments to global coordinates, for use in scripts.
- Debug points found in an existing SPS Path onto runescape
- Allow you to adjust tolerance of SPS while debugging, to find what works best
How to use?
Click the 'New Image' button
Choose the map you will be working off of, and remember the name of it. This will be your 'Area Coordinate'
After choosing press open to load the map into the PathMaker
Create your path In the path maker. Just click all the points you want the script to walk to. I recommend having the slightly close together, so that 3-4 points are showing on the minimap at a time, total.
When finished creating your path, click this box to generate your path.
Copy the contents of this box for use in your script, after conversion
To convert the Path generated by the program, you will need to run it through the conversion function i created below.
an example conversion:
Simba Code:
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}
{$i sps/sps.simba}
var
myPath : TPointArray;
function convertPath(area:String;Path:TPointArray):TPointArray;
var
i:Integer;
newPath : TPointArray;
begin
newPath := path;
for i := 0 to length(Path)-1 do
begin
newPath[i] := SPS_LocalToGlobal(area,newPath[i].x,newPath[i].y);
end;
result := newPath;
end;
function MakePathDeclaration(area:String;Path:TPointArray):String;
begin
result:= 'myPath := ' + Replace(tostr(convertPath(area,Path)),'(','Point(');
end;
begin
myPath := [Point(239, 158), Point(236, 169), Point(246, 170), Point(257, 170), Point(270, 170), Point(277, 170), Point(283, 172), Point(290, 193), Point(290, 202), Point(290, 212), Point(288, 235), Point(291, 252), Point(293, 269), Point(302, 294), Point(312, 303), Point(331, 319), Point(350, 338), Point(369, 359), Point(383, 381), Point(390, 397), Point(425, 394), Point(441, 388), Point(455, 382)];
writeln(MakePathDeclaration('0_2',myPath) + ';');
end.
If you replace 'myPath' With the path declaration u copied from wolygons path maker, this will print out the converted path, for use in your scripts.
This is the full Utility:
Simba Code:
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}
{$i sps/sps.simba}
const
surface = RUNESCAPE_SURFACE; //surface the map was in
area = '0_2'; //set to the area map you used
SPS_Tolerance = -1; //new tolerance to use for finding current position.
//set tol to -1 to use default
paintPoints = true; //paint path points on SMART canvas?
MinInterval = 3000; //Minimum time it takes for mainloop to execute once
var
myPath : TPointArray;
TP : TPoint;
I : Integer;
foundOne : Boolean;
T:LongInt;
function convertPath(area:String;Path:TPointArray):TPointArray;
var
i:Integer;
newPath : TPointArray;
begin
newPath := path;
for i := 0 to length(Path)-1 do
begin
newPath[i] := SPS_LocalToGlobal(area,newPath[i].x,newPath[i].y);
end;
result := newPath;
end;
function MakePathDeclaration(area:String;Path:TPointArray):String;
begin
result:= 'myPath := ' + Replace(tostr(convertPath(area,Path)),'(','Point(');
end;
begin
{$ifdef SMART}
Smart_Members := True;
Smart_Server := 100;
Smart_Signed := False;
Smart_SuperDetail := False;
{$endif}
SetupSRL;
SPS_Setup(surface,[area]);
if (SPS_Tolerance <> -1) then
SPS_Surface.Tolerance := SPS_Tolerance;
repeat
MarkTime(T);
if paintPoints and (length(myPath) > 0) then
begin
SMART_ClearCanvas;
foundOne := False;
for I := 0 to length(mypath)-1 do
begin
TP := SPS_PosToMM(mypath[I]);
writeln(tostr(SPS_GetMyPos) + '->' + inttostr(I) + ': ' + tostr(TP));
if TP.y > 0 then
foundOne := true;
if foundOne and (TP.y < 0) then
break;
SMART_DrawCircle(false,TP,3,false,clRed);
end;
end else
writeln(SPS_GetMyPos);
wait(Max(0,MinInterval-TimeFromMark(T)));
until false; {}
end.
EDIT: updated with pics;