SRL Archive - Help

So, I have a bunch of custom SPS maps...


KeepBotting

2012-08-06 19:35:34

How would I get my script to intelligently detect which SPS map it is standing in, and move to a point? (The points would be different for each SPS map and for the sake of argument let's say the player just appears in the middle of a random map)

edit: would I be able to combine all the small SPS images onto one large canvas (similiar to essence_mine.png or stronghold_of_security.png)?

Nebula

2012-08-06 19:51:07

Just wrote this off the top of my head.


function CurrentMap(maps: TStringArray): String;
var
TempMap: String;
i: Integer
begin
for i := 0 to length(maps-1) do
begin
TempMap := maps[i];
SetupSPS(3, TempMap);
if not(SPS_GetMyPos = Point(-1, -1)) then
begin
result := TempMap;
Exit;
end;
end;
end;

like a boss.

ofc there's probably a compiling error or two in there you'll have to fix.


E:
From: KeepBotting
edit: would I be able to combine all the small SPS images onto one large canvas (similiar to essence_mine.png or stronghold_of_security.png)?


Yes. :( I did all that work for nothing.

KeepBotting

2012-08-06 19:55:13

From: Nebula
Just wrote this off the top of my head.


function CurrentMap(maps: TStringArray): String;
var
TempMap: String;
i: Integer
begin
for i := 0 to length(maps-1) do
begin
TempMap := maps[i];
SetupSPS(3, TempMap);
if not(SPS_GetMyPos = Point(-1, -1)) then
begin
result := TempMap;
Exit;
end;
end;

like a boss.

ofc there's probably a compiling error or two in there you'll have to fix.


E:


Yes. :( I did all that work for nothing.
I'll try both ways, but I'm a bit confused–I can't completely wrap my head around the idea I had about combining them into one canvas.

Nebula

2012-08-06 19:57:30

Just throw them all into one map. Use MS Paint like a boss. just make sure they're far enough apart from eachother so that they don't interfere with eachother.

Footy

2012-08-06 19:58:03

Use photoshop and merge them into one picture. A bit of basic Photoshop knowledge should be enough to do this.
@Nebula
I would put them all into one big picture by using photoshop and carefully placing them in the correct spot. Then it could be used in SPS properly.

KeepBotting

2012-08-06 19:58:22

From: Nebula
Just throw them all into one map. Use MS Paint like a boss. just make sure they're far enough apart from eachother so that they don't interfere with eachother.
Then how do I detect which one I am in? And how would I walk in them if they're all in one image?

Nebula

2012-08-06 20:01:29

Okay yes I can see where you would have issues with that. So What I posted would probably work best. I just fixed it for you. Should compile + work file.


function CurrentMap(maps: TStringArray): String;
var
TempMap: TStringArray;
i: Integer;
begin
for i := 0 to length(maps)-1 do
begin
SetLength(TempMap, 1);
TempMap[0] := maps[i];
SPS_Setup(3, TempMap);
if not(SPS_GetMyPos = Point(-1, -1)) then
begin
result := TempMap[0];
Exit;
end;
end;
end;


KeepBotting

2012-08-06 20:02:21

From: Nebula
Okay yes I can see where you would have issues with that. So What I posted would probably work best. I just fixed it for you. Should compile + work file.


function CurrentMap(maps: TStringArray): String;
var
TempMap: TStringArray;
i: Integer;
begin
for i := 0 to length(maps)-1 do
begin
SetLength(TempMap, 1);
TempMap[1] := maps[i];
SPS_Setup(3, TempMap);
if not(SPS_GetMyPos = Point(-1, -1)) then
begin
result := TempMap[1];
Exit;
end;
end;
end;

I still don't get it <.> what does that do?

EDIT: Sorry, I'm a very visual learner. You have to spoonfeed me once, then I can strike out on my own rather proficiently. I need to understand what that function does, where to put my maps/what params to change, where to put the function itself, and how to call it.

Nebula

2012-08-06 20:06:35

CurrentMap('map1', 'map2', 'map3') would return the map you are currently in. So you could just do SPS_Setup(#, [CurrentMap]) and it would work fine. I hope.

KeepBotting

2012-08-06 20:07:51

From: Nebula
CurrentMap('map1', 'map2', 'map3') would return the map you are currently in. So you could just do SPS_Setup(#, [CurrentMap]) and it would work fine. I hope.
I edited the above post.


So:

function CurrentMap(MY MAPS GO HERE?): String;
var
TempMap: TStringArray;
i: Integer;
begin
for i := 0 to length(maps)-1 do
begin
SetLength(TempMap, 1);
TempMap[1] := maps[i];
SPS_Setup(3, TempMap);
if not(SPS_GetMyPos = Point(-1, -1)) then
begin
result := TempMap[1];
Exit;
end;
end;
end;
Do I change anything else?

KeepBotting

2012-08-06 20:20:52

Help? :D

putonajonny

2012-08-06 21:17:12

function CurrentMap(maps: TStringArray): String;
var
TempMap: TStringArray;
i: Integer;
begin
for i := 0 to length(maps)-1 do
begin
SetLength(TempMap, 1);
TempMap[1] := maps[i];
SPS_Setup(3, TempMap);
if(SPS_GetMyPos <> Point(-1, -1)) then
begin
result := TempMap[1];
Exit;
end;
end;
end;

Put that in your script with the other functions, then when put somewhere in your script:
WriteLn(CurrentMap(['2_3', '4_4', '3_293']));//put whatever maps you are checking

See if it gets the right one

Nebula

2012-08-06 22:41:20

Why did you change around some of the numbers in it KeepBotting?
Just throw this between one of your functions:
function CurrentMap(maps: TStringArray): String;
var
TempMap: TStringArray;
i: Integer;
begin
for i := 0 to length(maps)-1 do
begin
SetLength(TempMap, 1);
TempMap[0] := maps[i];
SPS_Setup(0, TempMap);
if not(SPS_GetMyPos = Point(-1, -1)) then
begin
result := TempMap[0];
Exit;
end;
end;
end;

Then call SPS_Setup(0, [CurrentMap]) in your mainloop and it will detect which map you are in. Then just use SPS_BlindWalk to walk to wherever it is you want to go.