PDA

View Full Version : [Resolved] Custom map switching



CynicRus
09-14-2012, 09:20 AM
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
09-14-2012, 11:16 AM
Is this just like SPS_SetUp(RUNESCAPEOTHER,['Map Name Here'])?

CynicRus
09-14-2012, 11:26 AM
Something like that, only SPS_Setup when loaded map may not always switch to another. I rewrote it a few for this purpose.

VastlySuperior
09-14-2012, 03:06 PM
I take it that you would be able to call runescape_surface the same way?

CynicRus
09-14-2012, 03:41 PM
I do not understand for what.

Solar
09-14-2012, 03:43 PM
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
09-14-2012, 04:04 PM
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
09-14-2012, 04:32 PM
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
09-14-2012, 04:36 PM
Well, the reason I used a modified implementation of this.

VastlySuperior
09-14-2012, 04:40 PM
You should ask them to include this in sps. It will sort out a lot of problems.

CynicRus
09-14-2012, 04:44 PM
I think if anyone is interested, it will include in the SPS. If not, anyone in need can use it independently.

speedster
10-11-2012, 06:26 PM
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
10-11-2012, 07:45 PM
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
10-18-2012, 04:09 PM
I wouldn't have used the OPs function if that worked lol../

Olly
10-18-2012, 04:30 PM
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
11-02-2012, 12:18 PM
*fixed* now that should be work correctly

Coh3n
01-02-2013, 08:38 PM
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
01-19-2013, 08:22 AM
I tried, but it did not work.

Coh3n
01-19-2013, 09:05 PM
I tried, but it did not work.Well, what happened? Lol. :p

CynicRus
01-20-2013, 05:28 AM
The memory remains the first loaded map only:(

Coh3n
01-20-2013, 05:44 AM
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
01-20-2013, 05:53 AM
Yep, I tried to do the same, and area switched , but in the memory we have old area map.

DannyRS
01-20-2013, 05:59 AM
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
01-20-2013, 06:01 AM
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
01-20-2013, 06:06 AM
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
01-20-2013, 06:14 AM
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 workedYou 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
01-20-2013, 06:52 AM
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
01-20-2013, 06:41 PM
Yea ofcourse, i used other in both calls, both custom made maps, tripple checked everything duno why it never worksHm, 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
01-20-2013, 07:52 PM
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
01-21-2013, 06:15 AM
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('mbQAAAHicY2VgYChmYmDIBuIOIE4B4nAgbg eKZwNxFhDPAOISIP7//z/DZ6AcMv4PFJdEw4xAzIKGwQAAXHAM3g==');
MineLadders := DTMFromString('mWAAAAHicY2FgYChlYmCoAuJCJgh7GlBsCh BPAuJuIA434ELBYkAxZMyEhkEAAJKHBs0=');
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
01-21-2013, 09:33 PM
Can you post the rest of your mainloop?

CynicRus
01-22-2013, 03:17 AM
The script is a full, change maps should be a function of the path. Juast add 'end;'.

Coh3n
01-22-2013, 04:43 AM
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
01-22-2013, 05:15 AM
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
01-22-2013, 04:57 PM
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
01-23-2013, 08:24 AM
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
01-23-2013, 04:53 PM
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('mbQAAAHicY2VgYChmYmDIBuIOIE4B4nAgbg eKZwNxFhDPAOISIP7//z/DZ6AcMv4PFJdEw4xAzIKGwQAAXHAM3g==');
MineLadders := DTMFromString('mWAAAAHicY2FgYChlYmCoAuJCJgh7GlBsCh BPAuJuIA434ELBYkAxZMyEhkEAAJKHBs0=');
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
01-24-2013, 07:00 AM
Wow!

Coh3n
01-28-2013, 10:29 PM
Wow!Lol, I'm assuming that means it also works for you?

CynicRus
01-29-2013, 05:24 AM
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
01-30-2013, 03:50 AM
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
02-01-2013, 04:32 PM
Thank you!

Zorgatone
02-02-2013, 01:42 PM
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??

18928 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.


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
02-02-2013, 10:05 PM
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



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
02-03-2013, 06:32 AM
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.


1894918950

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: 1895118952

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
02-03-2013, 08:09 PM
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
02-03-2013, 08:40 PM
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
02-03-2013, 09:06 PM
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
02-03-2013, 09:12 PM
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
02-03-2013, 09:35 PM
http://villavu.com/forum/showthread.php?t=96051

Hopefully that fixes your issue. :)

Zorgatone
02-03-2013, 11:11 PM
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

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