Page 1 of 3 123 LastLast
Results 1 to 25 of 51

Thread: Custom map switching

  1. #1
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default Custom map switching

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

    Simba Code:
    //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:
    Simba Code:
    //***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:
    Simba Code:
    ToGuild#Time Running:36 Seconds
    Im in point: (275, 287)
    ToMine#Time Running:52 Seconds
    (155, 275)
    Successfully executed.

    Simba Code:
    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.
    Last edited by CynicRus; 11-08-2012 at 03:53 PM.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  2. #2
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

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

  3. #3
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    Something like that, only SPS_Setup when loaded map may not always switch to another. I rewrote it a few for this purpose.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  4. #4
    Join Date
    Jun 2012
    Posts
    219
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

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

  5. #5
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    I do not understand for what.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  6. #6
    Join Date
    Feb 2012
    Location
    UK
    Posts
    909
    Mentioned
    10 Post(s)
    Quoted
    191 Post(s)

    Default

    Quote Originally Posted by VastlySuperior View Post
    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.
    Solar from RiD.

  7. #7
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    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
    Simba Code:
    if (surface = RUNESCAPE_OTHER) then

    to

    Simba Code:
    if (surface = RUNESCAPE_OTHER) or (surface - RUNESCAPE_SURFACE) then
    Last edited by CynicRus; 09-14-2012 at 04:08 PM.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  8. #8
    Join Date
    Jun 2012
    Posts
    219
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    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.

  9. #9
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    Well, the reason I used a modified implementation of this.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  10. #10
    Join Date
    Jun 2012
    Posts
    219
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

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

  11. #11
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    I think if anyone is interested, it will include in the SPS. If not, anyone in need can use it independently.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  12. #12
    Join Date
    Jan 2012
    Posts
    369
    Mentioned
    6 Post(s)
    Quoted
    91 Post(s)

    Default

    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.

  13. #13
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by speedster View Post
    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?

  14. #14
    Join Date
    Jan 2012
    Posts
    369
    Mentioned
    6 Post(s)
    Quoted
    91 Post(s)

    Default

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

  15. #15
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by speedster View Post
    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.

  16. #16
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    *fixed* now that should be work correctly
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  17. #17
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    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:
    Simba Code:
    SPS_Setup(RUNESCAPE_SURFACE, ['10_3']);
    walkToLadders();
    SPS_Setup(RUNESCAPE_OTHER, ['dwarven_mine']);
    walkToCenter();

  18. #18
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    I tried, but it did not work.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  19. #19
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by CynicRus View Post
    I tried, but it did not work.
    Well, what happened? Lol.

  20. #20
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    The memory remains the first loaded map only
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  21. #21
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Can you show me how you're using it? It works just fine for me.
    Simba Code:
    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.
    Progress Report:
    ['10_3']
    ['dwarven_mine']
    Successfully executed.

  22. #22
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default

    Yep, I tried to do the same, and area switched , but in the memory we have old area map.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  23. #23
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Can you show me how you're using it? It works just fine for me.
    Simba Code:
    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.
    Progress Report:
    ['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


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  24. #24
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by CynicRus View Post
    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.

    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.
    Last edited by Coh3n; 01-20-2013 at 06:03 AM.

  25. #25
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    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
    Last edited by DannyRS; 01-20-2013 at 06:09 AM.


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •