SRL Archive - SRL Positioning System

Custom map switching


CynicRus

2012-09-14 05:20:31

Hi all. It took me sps switch between custom maps in real time, and this is what came of it:


//function for dinamically map switching in script
function SPS_SwitchMap(surface: integer; areas: TStringArray):boolean;
var
t: integer;
tmp: TMufasaBitmap;
begin
SetLength(SPS_Areas,0);
SetLength(SPS_AreaMaps,0);
t:=getSystemTime;
SPS_MultiMouse := true;
SPS_Accuracy := 4;
if (length(areas) > 0) then
begin
SetLength(areas,1);
if (surface = RUNESCAPE_OTHER) or (surface = RUNESCAPE_SURFACE) then
if (length(areas) = 1) then
tmp := SPS_GetArea(areas[0], surface)
else begin
writeln('SPS_SwitchMap(): Invalid custom map. You can only select one!');
exit;
end;
result := true;
{$IFDEF SIMBAMAJOR990}
SPS_BitmapToMap(tmp, SPS_Accuracy, SPS_AreaMaps);
{$ELSE}
SPS_AreaMaps := SPS_BitmapToMap(tmp, SPS_Accuracy);
{$ENDIF}
if (surface = RUNESCAPE_OTHER) then
SPS_Areas := areas;
tmp.free();
end else
writeln('SPS_SwitchMap(): ERROR: SPS areas are not set!');

t := (getSystemTime - t);
if (SPS_Debug) and (result) then
writeln('[SPS] SPS_SwitchMap() took '+toStr(t)+' ms. Areas: '+toStr(SPS_Areas));
end;
How to use:

//***WALKING ROUTINE***
// 2 map sps setup
procedure InitMap;
begin
if mode then
begin
ClickNorth(SRL_ANGLE_HIGH);
SPS_SwitchMap(RUNESCAPE_OTHER,['mg_highlevel']);
end
else
begin
ClickNorth(SRL_ANGLE_HIGH);
SPS_SwitchMap(RUNESCAPE_OTHER,['mg_lowlevel']);
end;
end;
procedure ToMine;
var
ToMinePath: TPointArray;
begin
ToMinePath:=[Point(139,276),Point(159,279),Point(180,282),Point(208,283)];
if SPS_WalkPath(ToMinePath) then
Status := 'ToMine'
else begin
Status :='Failed ToMine';
WriteLn(status + '#Time Running:' +TimeRunning);
Logout;
TerminateScript;
end;
WriteLn(status + '#Time Running:' +TimeRunning);
WriteLn(toStr(SPS_GetMyPos));
end;

procedure ToGuild;
var
ToGuildPath: TPointArray;
begin
ToGuildPath:=[Point(242,205),Point(247,187),Point(262,186),Point(283,189),Point(293,202),Point(292,223),Point(312,238),Point(317,256),Point(319,280),Point(313,294),Point(274,280)];
if SPS_WalkPath(ToGuildPath) then
Status := 'ToGuild'
else begin
Status :='Failed ToGuild';
WriteLn(status + '#Time Running:' +TimeRunning);
Logout;
TerminateScript;
end;
WriteLn(status + '#Time Running:' +TimeRunning);
WriteLn('Im in point: '+toStr(SPS_GetMyPos));
mode:= false;
wait(5000);
//here insert your ladder down routine.
InitMap;
wait(1000);
ToMine;
end;
Test output:

ToGuild#Time Running:36 Seconds
Im in point: (275, 287)
ToMine#Time Running:52 Seconds
(155, 275)
Successfully executed.


procedure InitMap;
begin
if mode then
begin
ClickNorth(SRL_ANGLE_HIGH);
SPS_SwitchMap(RUNESCAPE_OTHER,['mg_highlevel']);
WriteLn(toStr(SPS_Areas));
end
else
begin
ClickNorth(SRL_ANGLE_HIGH);
SPS_SwitchMap(RUNESCAPE_OTHER,['mg_lowlevel']);
WriteLn(toStr(SPS_Areas));
end;
end;
//*******TEST OUTPUT
['mg_highlevel']
ToGuild#Time Running:22 Seconds
Im in point: (279, 287)
['mg_lowlevel']
ToMine#Time Running:40 Seconds
(143, 311)
Successfully executed.
Maps for testing in attachment:

Thanks for you advance, Cynic.

NKN

2012-09-14 07:16:24

Is this just like SPS_SetUp(RUNESCAPEOTHER,['Map Name Here'])?

CynicRus

2012-09-14 07:26:16

Something like that, only SPS_Setup when loaded map may not always switch to another. I rewrote it a few for this purpose.

VastlySuperior

2012-09-14 11:06:12

I take it that you would be able to call runescape_surface the same way?

CynicRus

2012-09-14 11:41:11

I do not understand for what.

Solar

2012-09-14 11:43:38

From: VastlySuperior
I take it that you would be able to call runescape_surface the same way?


I guess so, it's just a different folder. Depends where the map file is saved.

CynicRus

2012-09-14 12:04:28

A. Well, in that case, I think it makes no sense to keep a directory with the main RS map.
But if you need RUNESCAPE_SURFACE support, then just change

if (surface = RUNESCAPE_OTHER) then

to


if (surface = RUNESCAPE_OTHER) or (surface - RUNESCAPE_SURFACE) then

VastlySuperior

2012-09-14 12:32:29

This will come in handy as sps setup has a problem when you try to access different map areas. I t walk the first path with the current map but the moment you call another map it just stand there doing nothing.

CynicRus

2012-09-14 12:36:27

Well, the reason I used a modified implementation of this.

VastlySuperior

2012-09-14 12:40:31

You should ask them to include this in sps. It will sort out a lot of problems.

CynicRus

2012-09-14 12:44:48

I think if anyone is interested, it will include in the SPS. If not, anyone in need can use it independently.

speedster

2012-10-11 14:26:40

This, function doesn't help… At least when i try to switch maps I get the same behaviour … which means it doesn't initialise the map.

Olly

2012-10-11 15:45:45

From: speedster
This, function doesn't help… At least when i try to switch maps I get the same behaviour … which means it doesn't initialise the map.


Then just do spssetup['maphere'] blah blah?

speedster

2012-10-18 12:09:19

I wouldn't have used the OPs function if that worked lol../

Olly

2012-10-18 12:30:58

From: speedster
I wouldn't have used the OPs function if that worked lol../


Well then this wont work :P, this is near enough the same without setting up the sps vars and such.

CynicRus

2012-11-02 08:18:56

*fixed* now that should be work correctly

Coh3n

2013-01-02 15:38:15

I don't think you need a separate function for this. You can just call SPS_Setup again and it will reset the maps. Example:

SPS_Setup(RUNESCAPE_SURFACE, ['10_3']);
walkToLadders();
SPS_Setup(RUNESCAPE_OTHER, ['dwarven_mine']);
walkToCenter();

CynicRus

2013-01-19 03:22:32

I tried, but it did not work.

Coh3n

2013-01-19 16:05:44

From: CynicRus
I tried, but it did not work.
Well, what happened? Lol. :p

CynicRus

2013-01-20 00:28:09

The memory remains the first loaded map only:(

Coh3n

2013-01-20 00:44:49

Can you show me how you're using it? It works just fine for me.

program new;
{$i srl/srl.simba}
{$i sps/sps.simba}

begin
SetupSRL();
ClearDebug();

SPS_Setup(RUNESCAPE_SURFACE, ['10_3']);
Writeln(ToStr(SPS_Areas));

SPS_Setup(RUNESCAPE_OTHER, ['dwarven_mine']);
Writeln(ToStr(SPS_Areas));
end.

['10_3']
['dwarven_mine']
Successfully executed.

CynicRus

2013-01-20 00:53:17

Yep, I tried to do the same, and area switched , but in the memory we have old area map.

DannyRS

2013-01-20 00:59:56

From: Coh3n
Can you show me how you're using it? It works just fine for me.

program new;
{$i srl/srl.simba}
{$i sps/sps.simba}

begin
SetupSRL();
ClearDebug();

SPS_Setup(RUNESCAPE_SURFACE, ['10_3']);
Writeln(ToStr(SPS_Areas));

SPS_Setup(RUNESCAPE_OTHER, ['dwarven_mine']);
Writeln(ToStr(SPS_Areas));
end.

['10_3']
['dwarven_mine']
Successfully executed.


Mine never worked switching maps either, does it have anything to do with Smart or some other include?

Did you try print size of the bmp or something to check? The name might switch but not the image

Edit - maybe as Cynic said the image is never changed in the memory

Coh3n

2013-01-20 01:01:01

From: CynicRus
Yep, I tried to do the same, and area switched , but in the memory we have old area map.
How did you test that?

I just saved the bitmap during each call, and it saved 10_3 and dwarven_mine maps just fine. :unsure:

E: @DannyRS, I just saved the images. How do you know it never switched? Like, how did you test it?

E2: Now that I think about it, that's exactly how MSI switched surfaces for its dwarven miner, and it worked just fine (aside from the actual map being buggy). Same with all the runecrafters.

E3: I'd like to see exactly how you guys were using it when you think it didn't work.

DannyRS

2013-01-20 01:06:57

I tried to do exactly what you did for the print out, but it was WalkPath not writeln, so a real world attempt like, setup(varrock) walkpath(etc) setup(altars) walkpath(etc), but if I remember I was always trying to load from Runescape_Other folder, could that cause something? The map never switched, and the second points never worked, but after the path timed out, the first points would still work, seemed from the first call of Sps setup, you couldent change the map

Tried it with several different maps and etc too, still never worked

Coh3n

2013-01-20 01:14:01

From: DannyRS
I tried to do exactly what you did for the print out, but it was WalkPath not writeln, so a real world attempt like, setup(varrock) walkpath(etc) setup(altars) walkpath(etc), but if I remember I was always trying to load from Runescape_Other folder, could that cause something? The map never switched, and the second points never worked, but after the path timed out, the first points would still work, seemed from the first call of Sps setup, you couldent change the map

Tried it with several different maps and etc too, still never worked
You can't always load from the RUNESCAPE_OTHER folder. That only works if the map you want to load is in that folder. For Runecrafting, your initial call would be SPS_Setup(RUNESCAPE_SURFACE, []) and your second call (when you want to switch areas) would be SPS_Setup(RUNESCAPE_OTHER, []) - you need to switch surface constants.

DannyRS

2013-01-20 01:52:50

From: Coh3n
You can't always load from the RUNESCAPE_OTHER folder. That only works if the map you want to load is in that folder. For Runecrafting, your initial call would be SPS_Setup(RUNESCAPE_SURFACE, []) and your second call (when you want to switch areas) would be SPS_Setup(RUNESCAPE_OTHER, []) - you need to switch surface constants.


Yea ofcourse, i used other in both calls, both custom made maps, tripple checked everything duno why it never works

Coh3n

2013-01-20 13:41:09

From: DannyRS
Yea ofcourse, i used other in both calls, both custom made maps, tripple checked everything duno why it never works
Hm, that doesn't make sense. Any chance you can write out the code, test that it doesn't work, then post it here? Like I said, it works for me, so I'd like to see the code that doesn't work for you.

DannyRS

2013-01-20 14:52:12

From: Coh3n
Hm, that doesn't make sense. Any chance you can write out the code, test that it doesn't work, then post it here? Like I said, it works for me, so I'd like to see the code that doesn't work for you.


I'll try and edit this with result when I can, haven't tried it in a few weeks tho

CynicRus

2013-01-21 01:15:18

From: Coh3n
Hm, that doesn't make sense. Any chance you can write out the code, test that it doesn't work, then post it here? Like I said, it works for me, so I'd like to see the code that doesn't work for you.



program Walker;
//The code was generated with the path generator for SPS version 2 by Cynic
{$DEFINE SMART}
{$i SRL/srl.simba}
{$i sps/sps.simba}



var
//place your variables here
Status: string;
EnterMine, MineLadders: integer;
mode: boolean;//high level or low level??



procedure DeclarePlayers;
begin
HowManyPlayers:=1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:=0;
with Players[0] do
begin
Name:='';
Pass:='';
LampSkill:=SKILL_ATTACK;
Pin:='';
Active:=true;
end;
end;
//***LADDERS ROUTINE***

function LadderDown(x, y: Integer): Boolean;
var
CTS, i: Integer;
MyTPA: TPointArray;
ATPA: T2DPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.06, 1.87);

FindColorsSpiralTolerance(MSCX, MSCY, MyTPA, 3367290, MSX1, MSY1, MSX2, MSY2, 7);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(MyTPA, 30, 30);
SortATPASize(ATPA, True);

for i := 0 to Min(High(ATPA), 5) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 0, 0);

if WaitUpTextMulti(['add', 'der'], RandomRange(500, 1000)) then
begin
ClickMouse2(mouse_Left);
Result := WaitFunc(@DidRedClick, 1, 150);
Break;
end else
WriteLn('Ladder was not found @LadderDown');
end;
end;

procedure ClimbDown;
var
x, y: Integer;
v: TVariantArray;
begin
v := ['mineladders'];
Status:='ClimbDown';
WriteLn(Status);
if not LoggedIn then
Exit;

if LadderDown(x, y) then
begin
WaitFunc(@IsMoving, 10, 1000);
while IsMoving do
Wait(5);

if not WaitFuncEx('Location', v, 350, 6500) then
exit;
end else
WriteLn('No ladder @ClimbDown');
end;

Procedure Loads();
begin
EnterMine := DTMFromString('mbQAAAHicY2VgYChmYmDIBuIOIE4B4nAgbgeKZwNxFhDPAOISIP7//z/DZ6AcMv4PFJdEw4xAzIKGwQAAXHAM3g==');
MineLadders := DTMFromString('mWAAAAHicY2FgYChlYmCoAuJCJgh7GlBsChBPAuJuIA434ELBYkAxZMyEhkEAAJKHBs0=');
end;
//***WALKING ROUTINE***
// 2 map sps setup
procedure InitMap;
begin
if mode then
begin
ClickNorth(SRL_ANGLE_HIGH);
SPS_Setup(RUNESCAPE_OTHER,['mg_highlevel']);
WriteLn(toStr(SPS_Areas));
end
else
begin
ClickNorth(SRL_ANGLE_HIGH);
SPS_Setup(RUNESCAPE_OTHER,['mg_lowlevel']);
WriteLn(toStr(SPS_Areas));
end;
end;
procedure ToMine;
var
ToMinePath: TPointArray;
begin
ToMinePath:=[Point(139,276),Point(159,279),Point(180,282),Point(208,283)];
if SPS_WalkPath(ToMinePath) then
Status := 'ToMine'
else begin
Status :='Failed ToMine';
WriteLn(status + '#Time Running:' +TimeRunning);
Logout;
TerminateScript;
end;
WriteLn(status + '#Time Running:' +TimeRunning);
WriteLn(toStr(SPS_GetMyPos));
end;

procedure ToGuild;
var
ToGuildPath: TPointArray;
begin
ToGuildPath:=[Point(242,205),Point(247,187),Point(262,186),Point(283,189),Point(293,202),Point(292,223),Point(312,238),Point(317,256),Point(319,280),Point(313,294),Point(274,280)];
if SPS_WalkPath(ToGuildPath) then
Status := 'ToGuild'
else begin
Status :='Failed ToGuild';
WriteLn(status + '#Time Running:' +TimeRunning);
Logout;
TerminateScript;
end;
WriteLn(status + '#Time Running:' +TimeRunning);
WriteLn('Im in point: '+toStr(SPS_GetMyPos));
mode:= false;
wait(5000);
InitMap;
wait(1000);
ToMine;
end;

procedure fromGuild;
var
fromGuildPath: TPointArray;
begin
fromGuildPath:=[Point(273,279),Point(319,289),Point(319,263),Point(311,239),Point(297,224),Point(284,194),Point(259,186),Point(251,211)];
if SPS_WalkPath(fromGuildPath) then
Status := 'fromGuild'
else begin
Status :='Failed fromGuild';
WriteLn(status + '#Time Running:' +TimeRunning);
Logout;
TerminateScript;
end;
WriteLn(status + '#Time Running:' +TimeRunning);
end;

procedure OutMine;
var
OutMinePath: TPointArray;
begin
OutMinePath:=[Point(214,282),Point(187,282),Point(167,281),Point(141,276)];
if SPS_WalkPath(OutMinePath) then
Status := 'OutMine'
else begin
Status :='Failed OutMine';
WriteLn(status + '#Time Running:' +TimeRunning);
Logout;
TerminateScript;
end;
WriteLn(status + '#Time Running:' +TimeRunning);
end;
procedure SetupWalker;
begin
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
SetupSRL;
DeclarePlayers;
LoginPlayer;
Wait(567+ Random(120));
ClickNorth(SRL_ANGLE_HIGH);
SPS_Setup(RUNESCAPE_OTHER,['mg_highlevel']);
WriteLn(toStr(SPS_Areas));
Mode:=true;
end;
begin
SetupWalker;
toGuild;
Wait(2000+random(100));

Suppose that's a code does not work, although showing the correct names SPS_Areas. With Single map that work fine.

Coh3n

2013-01-21 16:33:36

Can you post the rest of your mainloop?

CynicRus

2013-01-21 22:17:27

The script is a full, change maps should be a function of the path. Juast add 'end;'.

Coh3n

2013-01-21 23:43:53

No, I mean at the end you have:

begin
SetupWalker;
toGuild;
Wait(2000+random(100));
You're saying that's the end of the script? I need to know what else you call to make sure everything is called properly.

CynicRus

2013-01-22 00:15:22

If you look to guild function:


***
procedure ToGuild;
var
ToGuildPath: TPointArray;
begin
ToGuildPath:=[Point(242,205),Point(247,187),Point(262,186),Point(283,189),Point(293,202),Point(292,223),Point(312,238),Point(317,256),Point(319,280),Point(313,294),Point(274,280)];
if SPS_WalkPath(ToGuildPath) then
Status := 'ToGuild'
else begin
Status :='Failed ToGuild';
WriteLn(status + '#Time Running:' +TimeRunning);
Logout;
TerminateScript;
end;
WriteLn(status + '#Time Running:' +TimeRunning);
WriteLn('Im in point: '+toStr(SPS_GetMyPos));
mode:= false;
wait(5000);
InitMap;
wait(1000);
ToMine;
end;
- look last 5 lines. This is just map switching test anyway.

Coh3n

2013-01-22 11:57:30

Okay, well from what I can see, you don't have any code that climbs down the ladders, so it makes sense that it wouldn't walk in the lower level when you're not in the lower level.

Maybe you can send me your custom maps and I can test it myself.

CynicRus

2013-01-23 03:24:01

From: Coh3n
Okay, well from what I can see, you don't have any code that climbs down the ladders, so it makes sense that it wouldn't walk in the lower level when you're not in the lower level.

Maybe you can send me your custom maps and I can test it myself.

They are listed in first post:)

Coh3n

2013-01-23 11:53:13

I haven't tested yet, but I was looking at your SwitchMap function and SPS_Setup. You know that the only difference is you took out an if statement that wouldn't do anything if the surface is set to RUNESCAPE_OTHER. So, in your case (using 2 custom maps), your function is exactly the same as SPS_Setup.

E: Tested the script you posted above (I added in climbDown in the toMine procedure, and had to comment out lines 182-183 because 'Location' isn't a valid procedure name), and it worked perfectly. Walked from the bank to the ladders, climbed down, and walked to the center of the mine.

So I'm not sure what your issue was/is. :unsure:

Here's the script with the small changes if you want to see it:

program Walker;
//The code was generated with the path generator for SPS version 2 by Cynic
{$DEFINE SMART8}
{$i SRL/srl.simba}
{$i sps/sps.simba}



var
//place your variables here
Status: string;
EnterMine, MineLadders: integer;
mode: boolean;//high level or low level??



procedure DeclarePlayers;
begin
HowManyPlayers:=1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:=0;
with Players[0] do
begin
Name:='';
Pass:='';
LampSkill:=SKILL_ATTACK;
Pin:='';
Active:=true;
end;
end;
//***LADDERS ROUTINE***

function LadderDown(x, y: Integer): Boolean;
var
CTS, i: Integer;
MyTPA: TPointArray;
ATPA: T2DPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.06, 1.87);

FindColorsSpiralTolerance(MSCX, MSCY, MyTPA, 3367290, MSX1, MSY1, MSX2, MSY2, 7);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(MyTPA, 30, 30);
SortATPASize(ATPA, True);

for i := 0 to Min(High(ATPA), 5) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 0, 0);

if WaitUpTextMulti(['add', 'der'], RandomRange(500, 1000)) then
begin
ClickMouse2(mouse_Left);
Result := WaitFunc(@DidRedClick, 1, 150);
Break;
end else
WriteLn('Ladder was not found @LadderDown');
end;
end;

procedure ClimbDown;
var
x, y: Integer;
v: TVariantArray;
begin
v := ['mineladders'];
Status:='ClimbDown';
WriteLn(Status);
if not LoggedIn then
Exit;

if LadderDown(x, y) then
begin
WaitFunc(@IsMoving, 10, 1000);
while IsMoving do
Wait(5);

wait(3000);

//if not WaitFuncEx('Location', v, 350, 6500) then
//exit;
end else
WriteLn('No ladder @ClimbDown');
end;

Procedure Loads();
begin
EnterMine := DTMFromString('mbQAAAHicY2VgYChmYmDIBuIOIE4B4nAgbgeKZwNxFhDPAOISIP7//z/DZ6AcMv4PFJdEw4xAzIKGwQAAXHAM3g==');
MineLadders := DTMFromString('mWAAAAHicY2FgYChlYmCoAuJCJgh7GlBsChBPAuJuIA434ELBYkAxZMyEhkEAAJKHBs0=');
end;
//***WALKING ROUTINE***
// 2 map sps setup
procedure InitMap;
begin
if mode then
begin
ClickNorth(SRL_ANGLE_HIGH);
SPS_Setup(RUNESCAPE_OTHER,['mg_highlevel']);
WriteLn(toStr(SPS_Areas));
end
else
begin
ClickNorth(SRL_ANGLE_HIGH);
SPS_Setup(RUNESCAPE_OTHER,['mg_lowlevel']);
WriteLn(toStr(SPS_Areas));
end;
end;
procedure ToMine;
var
ToMinePath: TPointArray;
begin
ToMinePath:=[Point(139,276),Point(159,279),Point(180,282),Point(208,283)];
if SPS_WalkPath(ToMinePath) then
Status := 'ToMine'
else begin
Status :='Failed ToMine';
WriteLn(status + '#Time Running:' +TimeRunning);
Logout;
TerminateScript;
end;
WriteLn(status + '#Time Running:' +TimeRunning);
WriteLn(toStr(SPS_GetMyPos));
end;

procedure ToGuild;
var
ToGuildPath: TPointArray;
begin
ToGuildPath:=[Point(242,205),Point(247,187),Point(262,186),Point(283,189),Point(293,202),Point(292,223),Point(312,238),Point(317,256),Point(319,280),Point(313,294),Point(274,280)];
if SPS_WalkPath(ToGuildPath) then
Status := 'ToGuild'
else begin
Status :='Failed ToGuild';
WriteLn(status + '#Time Running:' +TimeRunning);
Logout;
TerminateScript;
end;
WriteLn(status + '#Time Running:' +TimeRunning);
WriteLn('Im in point: '+toStr(SPS_GetMyPos));
climbDown();
mode:= false;
wait(5000);
InitMap;
wait(1000);
ToMine;
end;

procedure fromGuild;
var
fromGuildPath: TPointArray;
begin
fromGuildPath:=[Point(273,279),Point(319,289),Point(319,263),Point(311,239),Point(297,224),Point(284,194),Point(259,186),Point(251,211)];
if SPS_WalkPath(fromGuildPath) then
Status := 'fromGuild'
else begin
Status :='Failed fromGuild';
WriteLn(status + '#Time Running:' +TimeRunning);
Logout;
TerminateScript;
end;
WriteLn(status + '#Time Running:' +TimeRunning);
end;

procedure OutMine;
var
OutMinePath: TPointArray;
begin
OutMinePath:=[Point(214,282),Point(187,282),Point(167,281),Point(141,276)];
if SPS_WalkPath(OutMinePath) then
Status := 'OutMine'
else begin
Status :='Failed OutMine';
WriteLn(status + '#Time Running:' +TimeRunning);
Logout;
TerminateScript;
end;
WriteLn(status + '#Time Running:' +TimeRunning);
end;
procedure SetupWalker;
begin
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
SetupSRL;
DeclarePlayers;
LoginPlayer;
Wait(567+ Random(120));
ClickNorth(SRL_ANGLE_HIGH);
SPS_Setup(RUNESCAPE_OTHER,['mg_highlevel']);
WriteLn(toStr(SPS_Areas));
Mode:=true;
end;
begin
SetupWalker;
toGuild;
Wait(2000+random(100));
end.

CynicRus

2013-01-24 02:00:39

Wow!

Coh3n

2013-01-28 17:29:35

From: CynicRus
Wow!
Lol, I'm assuming that means it also works for you?

CynicRus

2013-01-29 00:24:34

From: Coh3n
Lol, I'm assuming that means it also works for you?


Yep. But I dont have any idea, why this approach has not worked before.

Coh3n

2013-01-29 22:50:24

I want to say sps.simba in the updater wasn't updated to the version I've been using. I've been using the version in the repo. for months and months. It wasn't until last week that it came to my attention that the code in the updater was very outdated.

That could have been the issue.

CynicRus

2013-02-01 11:32:50

Thank you!

Zorgatone

2013-02-02 08:42:47

From: VastlySuperior
This will come in handy as sps setup has a problem when you try to access different map areas. I t walk the first path with the current map but the moment you call another map it just stand there doing nothing.


Hey guys, I have the same problem.. But slightly different.. To avoid the map switching problem I've made a custom map with the two pieces from the world map that I needed, but it only works for the first path, and not the next ones..
Maybe the problem is after I'm teleporting??

[ATTACH=CONFIG]18928[/ATTACH] After I teleport to barbarian outpost it stops there.. If I start from the Barbarian outpost it works with the same code -.-' The map is saved in RUNESCAPE_OTHER.

From: CynicRus
I think if anyone is interested, it will include in the SPS. If not, anyone in need can use it independently.

Please do it! I've found about three other people with the same problem :(

http://villavu.com/forum/showthread.php?t=95950 , http://villavu.com/forum/showthread.php?t=95984 , And me -> http://villavu.com/forum/showthread.php?t=95934

Maybe I should enable the SPS rotated minimap thing? I've also tried to load all the pieces that I need from the RUNESCAPE_SURFACE, all in one SPS_Setup call, and it did not work..

Thanks guys..

Coh3n

2013-02-02 17:05:51

From: Zorgatone
Hey guys, I have the same problem.. But slightly different.. To avoid the map switching problem I've made a custom map with the two pieces from the world map that I needed, but it only works for the first path, and not the next ones..
Maybe the problem is after I'm teleporting??

Please do it! I've found about three other people with the same problem :(
Like I said earlier in the thread, the function in the first post is EXACTLY the same as SPS_Setup, so adding it to the rep

From: Zorgatone

Maybe I should enable the SPS rotated minimap thing? I've also tried to load all the pieces that I need from the RUNESCAPE_SURFACE, all in one SPS_Setup call, and it did not work..
That has nothing to do with your problem. You can enable it if you want, but it likely won't make a difference.

Can you please post the code that doesn't work? Or a test file that simulates what you're doing, and also doesn't work? If you post your script, I would prefer it with the SPS areas as opposed to your custom map.

E: You could also set SPS_Debug := true; to see if anything is printed when your problem occurs.

E2: Also, could you run this little script please? It saves the SPS maps you load to a file so you can see for sure if the map is changing. Just paste it in Simba and hit run. You can also change up the map areas to test different combinations.

program new;
{$i srl/srl.simba}
{$i sps/sps.simba}

var
counter: integer;

function SPS_SetupEx(surface: integer; areas: TStringArray): boolean;
var
t: integer;
tmp: TMufasaBitmap;
begin
t := getSystemTime;

SPS_MultiMouse := true;
SPS_Accuracy := 4;

if (length(areas) > 0) then
begin
if (surface = RUNESCAPE_SURFACE) then
tmp := SPS_MergeAreas(areas) // combine the SPS areas into 1; makes for a more accurate read
else
if (surface = RUNESCAPE_OTHER) then
if (length(areas) = 1) then
tmp := SPS_GetArea(areas[0], surface)
else begin
writeln('SPS_Setup(): Invalid dungeon areas. You can only select one!');
exit;
end;

SPS_IsSetup := true;
result := true;
tmp.SaveToFile(appPath+toStr(counter)+'.png');
inc(counter);

{$IFDEF SIMBAMAJOR990}
SPS_BitmapToMap(tmp, SPS_Accuracy, SPS_AreaMaps);
{$ELSE}
SPS_AreaMaps := SPS_BitmapToMap(tmp, SPS_Accuracy);
{$ENDIF}

if (surface = RUNESCAPE_SURFACE) then
SPS_Areas := SPS_SortAreas(areas)
else
if (surface = RUNESCAPE_OTHER) then
SPS_Areas := areas;

tmp.free();

end else
writeln('SPS_Setup(): ERROR: SPS areas are not set!');

t := (getSystemTime - t);

if (SPS_Debug) and (result) then
writeln('[SPS] SPS_Setup() took '+toStr(t)+' ms. Areas: '+toStr(SPS_Areas));
end;

begin
ClearDebug();
SPS_SetupEx(RUNESCAPE_SURFACE, ['11_7']);
SPS_SetupEx(RUNESCAPE_OTHER, ['dwarven_mine']);
end.

Zorgatone

2013-02-03 01:32:35

From: Coh3n
Like I said earlier in the thread, the function in the first post is EXACTLY the same as SPS_Setup, so adding it to the rep

That has nothing to do with your problem. You can enable it if you want, but it likely won't make a difference.

Can you please post the code that doesn't work? Or a test file that simulates what you're doing, and also doesn't work? If you post your script, I would prefer it with the SPS areas as opposed to your custom map.

E: You could also set SPS_Debug := true; to see if anything is printed when your problem occurs.

E2: Also, could you run this little script please? It saves the SPS maps you load to a file so you can see for sure if the map is changing. Just paste it in Simba and hit run. You can also change up the map areas to test different combinations.

program new;
{$i srl/srl.simba}
{$i sps/sps.simba}

var
counter: integer;

function SPS_SetupEx(surface: integer; areas: TStringArray): boolean;
var
t: integer;
tmp: TMufasaBitmap;
begin
t := getSystemTime;

SPS_MultiMouse := true;
SPS_Accuracy := 4;

if (length(areas) > 0) then
begin
if (surface = RUNESCAPE_SURFACE) then
tmp := SPS_MergeAreas(areas) // combine the SPS areas into 1; makes for a more accurate read
else
if (surface = RUNESCAPE_OTHER) then
if (length(areas) = 1) then
tmp := SPS_GetArea(areas[0], surface)
else begin
writeln('SPS_Setup(): Invalid dungeon areas. You can only select one!');
exit;
end;

SPS_IsSetup := true;
result := true;
tmp.SaveToFile(appPath+toStr(counter)+'.png');
inc(counter);

{$IFDEF SIMBAMAJOR990}
SPS_BitmapToMap(tmp, SPS_Accuracy, SPS_AreaMaps);
{$ELSE}
SPS_AreaMaps := SPS_BitmapToMap(tmp, SPS_Accuracy);
{$ENDIF}

if (surface = RUNESCAPE_SURFACE) then
SPS_Areas := SPS_SortAreas(areas)
else
if (surface = RUNESCAPE_OTHER) then
SPS_Areas := areas;

tmp.free();

end else
writeln('SPS_Setup(): ERROR: SPS areas are not set!');

t := (getSystemTime - t);

if (SPS_Debug) and (result) then
writeln('[SPS] SPS_Setup() took '+toStr(t)+' ms. Areas: '+toStr(SPS_Areas));
end;

begin
ClearDebug();
SPS_SetupEx(RUNESCAPE_SURFACE, ['11_7']);
SPS_SetupEx(RUNESCAPE_OTHER, ['dwarven_mine']);
end.


[ATTACH=CONFIG]18949[/ATTACH][ATTACH=CONFIG]18950[/ATTACH]

Well, here are the maps that your script saved… And here the code of my test script that doesn't work: http://pastebin.com/DKDXTe2g


EDIT: Even trying new scripts and paths, with custom map either it will always run only the first path..
If I test the paths individually they work.. If I put them all in the same script and I run the script, It'll walk only the first one. After that I teleport and I get this messages:
SPS_GetMyPos: Finished in 670 ms. Result = (-1, -1)
SPS_GetMyPos: Finished in 686 ms. Result = (-1, -1)

SPS_GetMyPos: Finished in 670 ms. Result = (-1, -1)
SPS_GetMyPos: Finished in 686 ms. Result = (-1, -1)

SPS_GetMyPos: Finished in 670 ms. Result = (-1, -1)
SPS_GetMyPos: Finished in 686 ms. Result = (-1, -1)
And so on… (infinite loop?)

I don't know what I'm doing wrong..

New code: http://pastebin.com/NKx0nrwY

Maps: [ATTACH=CONFIG]18951[/ATTACH][ATTACH=CONFIG]18952[/ATTACH]

I've commented out the first path to test the second one.. Just remove the comment from pastebin

E2: Similar problem Here > http://villavu.com/forum/showthread.php?t=95984

E3: Anyway Even with one map only.. I'm trying jumping into the barbarian outpost's whirlpool and after that It doesn't walk the second path (the map is the same), even if I'm calling sps_setup again..
This issue happens everytime I teleport somewhere and the paths I made are correct.. Same happens using games necklace

Coh3n

2013-02-03 15:09:05

Okay, so good and bad news.

Bad news: I haven't solved the problem yet.

Good news: I was finally able to recreate the problem (I was unable to before; I'm not sure why yet), so that's the first step to solving the problem.

I'll keep you guys updated.

Zorgatone

2013-02-03 15:40:10

From: Coh3n
Okay, so good and bad news.

Bad news: I haven't solved the problem yet.

Good news: I was finally able to recreate the problem (I was unable to before; I'm not sure why yet), so that's the first step to solving the problem.

I'll keep you guys updated.


Thanks! I'm happy to hear that you'll work to fix that problem to everyone! :)
I appreciate your help, keep us updated.

Zorgatone.


E1: I think you never tried 3 different paths with two teleports like I did :P It might be the problem.
E2: You might also check the official SPS maps to be sure they're updated, but this is not the cause of this issue.

CynicRus

2013-02-03 16:06:50

I believe that it is necessary to clean the SPS variables in memory. Completely. Maybe then all the work. Need function like SPS_Reset.


Procedure Reset;
begin
SetLEngth(SPS_Areas,0);
SetLengthSPS_AreaMaps,0);
end;
or something like this.

Coh3n

2013-02-03 16:12:30

From: CynicRus
I believe that it is necessary to clean the SPS variables in memory. Completely. Maybe then all the work. Need function like SPS_Reset.


Procedure Reset;
begin
SetLEngth(SPS_Areas,0);
SetLengthSPS_AreaMaps,0);
end;
or something like this.
Hehe you're right. I found and fixed this issue a few minutes ago. I'm about to make the update thread now.

E: http://villavu.com/forum/showthread.php?t=96051

Coh3n

2013-02-03 16:35:07

http://villavu.com/forum/showthread.php?t=96051

Hopefully that fixes your issue. :)

Zorgatone

2013-02-03 18:11:38

From: CynicRus
I believe that it is necessary to clean the SPS variables in memory. Completely. Maybe then all the work. Need function like SPS_Reset.


Procedure Reset;
begin
SetLEngth(SPS_Areas,0);
SetLengthSPS_AreaMaps,0);
end;
or something like this.

From: Coh3n
Hehe you're right. I found and fixed this issue a few minutes ago. I'm about to make the update thread now.

E: http://villavu.com/forum/showthread.php?t=96051

From: Coh3n
http://villavu.com/forum/showthread.php?t=96051

Hopefully that fixes your issue. :)

Oh my GOD!!! You fixed that! You're my God, I love you ALL! XD
Now my script is working great! Awesome..

Thank you very much! You cannot imagine how much I needed this! I couldn't teleport anywhere without it
Zorgatone