SRL Archive - Research & Development Lounge

Walking with SPS trouble.


CynicRus

2012-06-19 02:51:03

Hello. I have some trouble with SPS. I use latest Simba and SPS version.
For testing i use some code:
[PHP]
procedure SetupSps;
begin
SPS_Setup(RUNESCAPE_SURFACE, ['6_8']);
SPS_Debug := True;
end;

****
procedure GoToPoint(Point: TPoint);
var
TempPoint: TPoint;
begin
MakeCompass('n');
Writeln('Walking to point');
Writeln(ToStr(SPS_GetMyPos));
TempPoint:=SPS_GetMyPos;
if TempPoint<>Point then
SPS_WalkToPos(Point);
while(IsMoving) do
Wait(Random(5000));
WriteLn('Im in point');
end;
[/PHP]
For getting area code and waypoint's I use Wolygon's path creator v 0.9.
This code is compile without any error's, but after run i see in debug window:
[PHP]
SRL Compiled in 16 msec
SMART Initialized.
Loaded: Server 123, Members: True, Signed: True, Super Detail: False.
Current player: lalalalalalala
Walking to point
SPS_GetMyPos: Finished in 156 ms. Result = (-1, -1)
(-1, -1)
SPS_GetMyPos: Finished in 187 ms. Result = (-1, -1)
SPS_GetMyPos: Finished in 172 ms. Result = (-1, -1)
Im in point
[/PHP]
But in smart - doesn't any happens. How i can fix it?

PS: Sorry for my bad English, it is not my native language.

(s)okkr7

2012-06-19 03:02:54

Hey, it all looks good imo. Only I do it a little bit different:

For walking I use just this:

Procedure Walkwherever;
Var
WalkW: TPointArray; //declares that path is a TPA
Begin
SetAngle(SRL_ANGLE_HIGH); //Sets the angle high, not necessary though
MakeCompass('N'); //makes compass 'North'
WalkW := //this is where your points would go ex: Point[234, 238] , Point[]
Sps_WalkPath(WalkW); //this tells it to walk the path WalkW
End;

then in your mainloop down below I usually have:

Smart_Server  := 18;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;

SetupSRL;
DeclarePlayers;
Loginplayer;
SPS_Setup(RUNESCAPE_SURFACE,['10_6','10_7']); //need this here!
MouseSpeed:= 30;
If (not LoggedIn) then
TerminateScript();

Hope I helped, if not, feel free to ask me questions via skype! :)
Also, for future reference, use simba tags ;)

CynicRus

2012-06-19 03:13:18

From: Sokkr7
Hey, it all looks good imo. Only I do it a little bit different:

For walking I use just this:

Procedure Walkwherever;
Var
WalkW: TPointArray; //declares that path is a TPA
Begin
SetAngle(SRL_ANGLE_HIGH); //Sets the angle high, not necessary though
MakeCompass('N'); //makes compass 'North'
WalkW := //this is where your points would go ex: Point[234, 238] , Point[]
Sps_WalkPath(WalkW); //this tells it to walk the path WalkW
End;

then in your mainloop down below I usually have:

Smart_Server  := 18;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;

SetupSRL;
DeclarePlayers;
Loginplayer;
SPS_Setup(RUNESCAPE_SURFACE,['10_6','10_7']); //need this here!
MouseSpeed:= 30;
If (not LoggedIn) then
TerminateScript();

Hope I helped, if not, feel free to ask me questions via skype! :)
Also, for future reference, use simba tags ;)

I don't have skype now, im in work-)
So, this is just sps test, because if i use code:

procedure GoToBank;
var
GoBank: TPointArray;
begin
ClickNorth(SRL_ANGLE_None);
Writeln('Walking to Bank...');
GoBank := [Point(2505, 3412), Point(2455, 3465), Point(2431, 3489), Point(2411, 3495), Point(2408, 3518), Point(2410, 3524), Point(2418, 3525), Point(2428, 3525), Point(2447, 3524)];
if SPS_WalkPath(GoBank) then
Writeln('At the Bank..');
while(IsMoving) do
Wait(Random(5000));
end;
I have some result:

SPS_GetMyPos: Finished in 296 ms. Result = (-1, -1)
SPS_GetMyPos: Finished in 297 ms. Result = (-1, -1)
SPS_GetMyPos: Finished in 281 ms. Result = (-1, -1)
And i have no idea, why-(

And in my loop i call my spsprocedure before GoToPoint or GoToBank procedure.

Recursive

2012-06-19 03:26:17

If you are using simba v 7.1 (ie the newest one), it is recommended that you downgrade your simba and sps to the next lower version cause it is still a bit buggy atm.

You can use this function created by MAT to check if you are in the desired area:

function InArea(Pt1, Pt2: TPoint): Boolean;
var
Loc: TPoint;
Box: TBox;
begin
Loc := SPS_GetMyPos;
Box := PointToBox(Pt1, Pt2);
if (PointInBox(Loc, Box)) then
Result := true else
if NOT (PointInBox(Loc, Box)) then
Result := false;
end;

So in Pt1 and Pt2, you simply enter your top left point and bottom right points.

CynicRus

2012-06-19 03:35:30

In simba about i have:
You are currently using version: 984

In sps version i have: 87

I suspect that the problem in runescape_surface, but i have no idea, how to fix it. Because SPS_GetMyPos is return -1,-1-(

Recursive

2012-06-19 03:39:20

I say update the maps you are using. Read up on how to update maps and make new ones using Runescape maps and then try using those to walk again. If the problem persists then it is a problem with SPS

putonajonny

2012-06-19 04:48:11

From: Chig
function InArea(Pt1, Pt2: TPoint): Boolean;
var
Loc: TPoint;
Box: TBox;
begin
Loc := SPS_GetMyPos;
Box := PointToBox(Pt1, Pt2);
if (PointInBox(Loc, Box)) then
Result := true else
if NOT (PointInBox(Loc, Box)) then
Result := false;
end;
Why do you check if the point is in the box twice?

CynicRus

2012-06-19 05:10:54

So, i update simba to v 0.99, and after compile code:

procedure GoToPoint(Point: TPoint);
var
TempPoint: TPoint;
begin
MakeCompass('n');
Writeln('Walking to point');
Writeln(ToStr(SPS_GetMyPos));
TempPoint:=SPS_GetMyPos;
if TempPoint<>Point then
SPS_WalkToPos(Point);
while(IsMoving) do
Wait(Random(5000));
TempPoint:=SPS_GetMyPos;
if TempPoint=Point then
WriteLn('Im in point')
else
Writeln('Move fails');
end;

i have in debug window:

Walking to point
SPS_GetMyPos: Finished in 297 ms. Result = (2503, 3411)
(2503, 3411)
SPS_GetMyPos: Finished in 312 ms. Result = (2503, 3411)
SPS_GetMyPos: Finished in 280 ms. Result = (2503, 3411)
SPS_GetMyPos: Finished in 280 ms. Result = (2503, 3411)
Move fails
Any idea?

akon100

2012-07-14 06:34:15

this is nice i like it…

Sirenia

2012-08-04 11:18:58

I bet its the maps, got the same problem in some areas

bishknight

2012-08-04 11:44:41

Areas of the maps are outdated, two areas I know of are Edgeville and Rimmington

Olly

2012-08-04 11:58:11

Make a custom map that's where sps really does work :P