Log in

View Full Version : So, I have a bunch of custom SPS maps...



KeepBotting
08-06-2012, 11:35 PM
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
08-06-2012, 11:51 PM
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:

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
08-06-2012, 11:55 PM
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
08-06-2012, 11:57 PM
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
08-06-2012, 11:58 PM
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
08-06-2012, 11:58 PM
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
08-07-2012, 12:01 AM
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
08-07-2012, 12:02 AM
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
08-07-2012, 12:06 AM
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
08-07-2012, 12:07 AM
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
08-07-2012, 12:20 AM
Help? :D

putonajonny
08-07-2012, 01:17 AM
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
08-07-2012, 02:41 AM
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.