Results 1 to 13 of 13

Thread: SPS Setup Problem

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

    Default SPS Setup Problem

    Hi

    I have this problem that when I call SPS Setup from the following code it does not want to execute. I need to call it from this location as I need to walk over different parts from Runescape.

    Here is the code and how I call it

    Simba Code:
    procedure SelectArea(Choice:Integer);
    Begin
      Case Choice of
        0:  Begin                                    // Rimmington Area Coordinates
              Info := 'Selecting Rimmington For Mining Operations';
              MLocation := 'Rimmington';
              ArBoxLH := Point(98, 393);
              ArBoxRL := Point(160, 447);
              MLocBoxLH := Point(73, 152);
              MLocBoxRL := Point(164, 234);
              GateRoomLH := Point(260, 260);
              GateRoomRL := Point(300, 300);
              DBoxLH := Point(382, 186);
              DBoxRL := Point(427, 210);
              If Debug then
                WriteLn('Setting SPS Map Which Should Be Used');
              SPSMap := ['rimmington'];
              If Debug then
                WriteLn('SPS Custom Map Name = ' + ToStr(SPSMap));
              SPS_Setup(RUNESCAPE_OTHER,['rimmington']);
              If Debug then
                WriteLn('SPS Setup Now Done');
              If Debug then
                WriteLn('Selecting Rimminton Area For Mining operation');
            End;
        End
    End;

    It Retrieves the paths information from this procedure, The problem might also be with the string case selection as I get no debug information from that case. Am I using the string case in the wrong way?

    Simba Code:
    Procedure UniversalWalker(Choice:Integer;Walk:String);
    Begin
      Case Choice of
        0:  Begin                                    // Rimmington Area Coordinates
              If Debug then
                WriteLn('Selecting Rimminton Area For Mining operation');
              Case Walk of
                'arrival': Begin
                            Info := 'Arriving At Port Sarim Gate Room, Walking To Rimmington Mine';
                            If Debug then
                              WriteLn('Selecting Rimminton Mining Path');
                            Path := [Point(277, 287), Point(222, 267), Point(169, 248), Point(115, 247), Point(122, 192)];
                            DTMArea := '80:80:5:5:7:74:105:5:7:82:100:5:7:95:104:5:7:112:83:5:7:69:71:4:130:38:130:130:27:130:27:38';
                            DTMTarget := '80:80:5:5:7:74:105:5:7:82:100:5:7:95:104:5:7:112:83:5:7:69:71:4:130:38:130:130:27:130:27:38';
                            DTMWalk := '80:80:5:5:7:74:105:5:7:82:100:5:7:95:104:5:7:112:83:5:7:69:71:4:130:38:130:130:27:130:27:38';
                           end;
                'depbox': Begin
                            Info := 'Walking To Port Sarim Deposito Box';
                            If Debug then
                              WriteLn('Selecting Port Sarim Deposito Box Path');
                            Path := [Point(286, 277), Point(332, 274), Point(331, 218), Point(378, 205), Point(407, 205)];
                            If Debug then
                              WriteLn('Comming From Gate Room, On Our Way To The Deposito Box');
                          end;
                'mining': Begin
                            Info := 'Walking From Port Sarim Gate Room To Rimmington Mining Area';
                            If Debug then
                              WriteLn('Selecting Rimminton Mining Path');
                            Path := [Point(277, 287), Point(222, 267), Point(169, 248), Point(115, 247), Point(122, 192)];
                            DTMArea := '80:80:5:5:7:74:105:5:7:82:100:5:7:95:104:5:7:112:83:5:7:69:71:4:130:38:130:130:27:130:27:38';
                            DTMTarget := '80:80:5:5:7:74:105:5:7:82:100:5:7:95:104:5:7:112:83:5:7:69:71:4:130:38:130:130:27:130:27:38';
                            DTMWalk := '80:80:5:5:7:74:105:5:7:82:100:5:7:95:104:5:7:112:83:5:7:69:71:4:130:38:130:130:27:130:27:38';
                            If Debug then
                              WriteLn('Walking From Port Sarim Gate Room To Rimmington Mining Area');
                          end;
              End;
            End;
    End;

    I use it Like This:
    Simba Code:
    MarkTime(FailSafeTime);
      If not(InArea(MLocBoxLH,MLocBoxRL))then
      Begin
        SPS_WalkPath(Path);
        While not(InArea(MLocBoxLH,MLocBoxRL)) do
        Begin
          Antiban;
          Wait(1000);
          If TimeFromMark(FailsafeTime) > 50000 then
          Begin
            Break;
          End;
        End;
      End;

    But when I do the SPSSetup from The Declare Players section it works fine, the same code from above except I take out the SPS Setup from that procedure.

    I need some help here to get this to work. I don`t know why it would not do the SPS Setup from that procedure, but from the declare players it works fine
    Last edited by VastlySuperior; 09-13-2012 at 04:14 PM.

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

    Default

    Can anyone give me an idea where I am going wrong with this code and how to overcome the problem?

    It has to do with the way I call SPS Setup, when I call it from Declare Players it works, but when I try to call it from another procedure, it fails.

    Any ideas why that is?

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

    Default

    Do you get an error? Also, in the code you provided, I can't see where you call your SelectArea procedure.

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

    Default

    Quote Originally Posted by Coh3n View Post
    Do you get an error? Also, in the code you provided, I can't see where you call your SelectArea procedure.
    @ Coh3n, thanks for replying, but I have changed a lot of code from the time I have posted this request. I have moved the place where it does the setup for the map to declare players section.

    The problem now for me is that when I call the walking, It does the first part of the walking procedure quite nicely, but when it has to walk to the next stage it just freezes without moving anywhere.

    What I`m attempting to do is to create one function or procedure that will do all the walking, does not matter where you are, as I think it will be much more code efficient to just pass on the TPointArray every time you walk instead of creating a whole new procedure or function for every path you want to do, but now it seams that it is not executing the new path, and I have no clue why not, because if I debug the Global Variable I use for the path, it clearly shows that it does have the new paths TPointArray. It is driving me nuts.

    If you want I can Put the code for the test program here , to see if someone can figure this out for me or just steer me in the right direction of where I should look for the error.

    When the code runs, it does not give any error what so ever, it just freezes on the spot, I do use a custom SPS map for the walking, each piece of the code for the walking walks fine if I just call it on its own, but the moment I try to walk to another place, it does not move.

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

    Default

    Hmm, I don't quite understand you are you trying to is do if atmine then walk to bank if atbox then walk to mine? something like that?

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

    Default

    Quote Originally Posted by Ollybest View Post
    Hmm, I don't quite understand you are you trying to is do if atmine then walk to bank if atbox then walk to mine? something like that?
    Yes, basically, but I want to use only One walk procedure or function and not a lot of different walking functions for each destination, so For SPS_walkpath I only pass on each time a different TPointArray, but it is not working, it only walk the first stage and then when it must walk to the second stage it just stand there doing nothing, and it is not as if it can not walk with sps in that location because if I use a separate walking procedure for each location it walks it perfectly. So all I can think is that somehow it does not receive the new tpointarray, but when I debug the tpointarray, it shows that the correct coordinates has been passed on.

    I got no clue why it does not work, and I have been racking my brains the last couple of days trying to find a way past this, but just don`t seem to know what to fix and how.

  7. #7
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    The standard one I use for my scripts when they use SPS is this:

    Simba Code:
    Function LRCPaths(Which: Integer; Invert: Boolean): TPointArray;
    Var                                                                                  //Method
      BankToLowestGold,BankToHighGold,LowToHighGold: TPointArray;
      Paths: T2DPointArray;
    Begin
      If Debug Then
        FunctionStop:= 'LRCPATHS: Entered';

      CheckStuff;

      If Not WaitLoggedIn(1000) Then
        Exit;

      BankToLowestGold:= [Point(260, -125), Point(275, -121), Point(275, -93), Point(275, -53), Point(299, -17), Point(311, 3),  Point(325, 25)];

      BankToHighGold:= [Point(260, -125), Point(275, -93), Point(267, -73), Point(239, -57), Point(205, -45)];

      LowToHighGold:= [Point(325, 25), Point(295, -20), Point(255, -35), Point(205, -45)];

      Paths:= [BankToLowestGold, BankToHighGold, LowToHighGold];

      Case Which of
        1: Result:= Paths[0];
        2: Result:= Paths[1];
        3: Result:= Paths[2];
        4: Result:= Paths[RandomRange(0, 3)];
      End;

      If Invert Then
      Begin
        InvertTPA(Result);
      End;

      If Debug Then
        FunctionStop:= 'LRCPATHS: Finished';
    End;

    Major creds to brandon

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

    Default

    @VastlySuperior: Call this after you call DeclarePlayers:
    Simba Code:
    SPS_Debug := true;
    That will debug SPS and tell you exactly what's wrong. Also be sure to call SPS_Setup before walking your second path, otherwise it will try to use the map from your previous path.

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

    Default

    Ok, I have found out what the problem is, but I don`t know why and I don`t know what the solution should be.

    I use Mat`s InArea Function to determine if I am at the correct location, now for some reason it does not receive the correct values and thus, it always return a false and that`s why it does not continue onto the next stage.

    So I have decided to include the code here so that you could look at it and tell me what the hell is wrong with the way I assign these values and why it is not passing these values on correctly to this function.

    The problem can be only in 2 places, either in the InArea Function, which I doubt, or it is in the UniversalWalker procedure.

    A third possibility might be the way I declare the Global Constants for these Variables.

    Here Is the code for the test Program I`m using:

    Simba Code:
    program Walker;
      {$DEFINE SMART}
      {$i SRL/srl.simba}
      {$i sps/sps.simba}
      {$I SRL/SRL/Skill/magic.simba}
      {$i ObjectDTM/ObjDTMInclude.simba}
     const
    {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
    {@@@@@@@@@@@@@@@@@@@@@@@@@ Smart Setup Constants @@@@@@@@@@@@@@@@@@@@@@@@@@@}
    {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
      Server            = 34;                 // enter "0" to pick a Random server.
      Members           = False;              // is this player a member
      NumbOfPlayers     = 1;                  // how many players should be active
      StartPlayer       = 0;                  // the player who should be first used
      LoadsToDo         = 73;                 // Set how many repetitions to do of a certain Activity
      PowerMine         = False;              // True Or False For Drop Ore
      Debug             = True;               // Enable or Disable Debug Of Script
    {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
    {@@@@@@@@@@@@@@@@@@@@@@@@@ Script Setup Settings @@@@@@@@@@@@@@@@@@@@@@@@@@@}
    {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
      OreChoice         = 5;                  // Valid Mining Choices
                                              // 0 --- Copper
                                              // 1 --- Clay
                                              // 2 --- Gold
                                              // 3 --- Iron
                                              // 4 --- Tin
                                              // 5 --- Silver
                                              // 6 --- Coal
    {If You Want To Mine COAL, It Can Only Be Done In The Wildy, Make Sure You
    Have Good Armor And A Relatively High Combat Level, Otherwise You Will Die
    A Lot And Loose Your Items. ******* BE WARNED *******                         }

    {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
    {@@@@@@@@@@@@@@@@@@@@@@@@@     Break Settings    @@@@@@@@@@@@@@@@@@@@@@@@@@@}
    {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
      TakeBreaks      = False;                // Take breaks?
      HoursToBreak    = 2;                    // How often to break in minutes
      HoursToPlay     = 18;                   // Added randomness to how often you break
      NumOfBreaks     = 6;                    // How Many Times Should We Break
    {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
    {@@@@@@@@@@@@@@@@@@@@@@@@@   Mining Location     @@@@@@@@@@@@@@@@@@@@@@@@@@@}
    {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
      Location        = 1;                    // Valid Mining Locations
                                              // 0 --- Rimmington
                                              // 1 --- Varrock West
                                              // 2 --- Wildy Scorpions
                                              // 3 --- Wildy Skeletons
                                              // 4 --- Varrock East

    var
      Path:TPointArray;
      OreSpot, ABoxLH, ABoxRL, DP:Tpoint;
      Info:String;
      Start_Time, End_Time, TotalTime, TripStart, TripEnd, TripTotal,TotalLoads, BreakTimes, TotalBTime, TotalPTime,
      DTM_TelePort, DTM_LodeStone,
      DTM_GateRoom: Integer;
      MineFirstRun, LostMyWay:Boolean;

    procedure DeclarePlayers;
       begin
          HowManyPlayers:=1;
          NumberOfPlayers(HowManyPlayers);
          CurrentPlayer:=0;
          with Players[0] do
          begin
             Name:='';
             Pass:='';
             BoxRewards:=['xp','xp','lamp'];
             LampSkill:=SKILL_ATTACK;
             Pin:='';
             Active:=true;
          end;
    end;

    function InArea(Pt1, Pt2:TPoint): Boolean;       // Look If In Specific Area
    var                                               // Credits to Mat's InArea function
    Loc: TPoint;
    Box: TBox;
    Begin
      Loc := SPS_GetMyPos;
      Box := PointToBox(Pt1, Pt2);
      If (PointInBox(Loc, Box)) then
      Begin
        Result := True
      End else
      Begin
        Result := False;
      End;
      If Debug then
        WriteLn(Result);
    End;

    procedure Compass;                                // Set The Compass To North
    Begin
      ClickNorth(SRL_ANGLE_NONE);
    End;

    procedure Antiban;                                        // Antiban Procedure
    Begin
      Case Random(400) of
        20: Begin RandomRClick; End;
        40: Begin Wait(2500 + Random(4500)) End;
        60: Begin PickUpMouse; End;
        80: Begin HoverSkill('Mining', False); End;
        100: Begin Boredhuman; End;
        120: Begin RandomMovement; End;
        140: Begin ExamineInv; End;
        160: Begin HoverSkill('Random', False); End;
      End;
    End;

    procedure LoadDTM(Choice:Integer);               // Load The Dtms According To The Location (Hogs Memory)
    Begin
      Case Choice of
        0:  Begin                                    // Rimmington Area Coordinates
              DTM_TelePort := DTMFromString('mlwAAAHicY2dgYOBhZGCQBNISQHwQyF4ExOVAdi+Qfg2k44F0NpBuAuJoIDsMSIcC8YHJTQwnN81m2LmoC0w/ubiLQUxBlUFcUZXBiAFiJjbMiAdDAQBpJhHL');
              DTM_LodeStone := DTMFromString('m1gAAAHic42JgYLBlYmAwBWIzILYGYjsgdgNidyB2RhKTYGRgEANiKSCWB2IFIJYGYnEgFgBifiDmA2I5GX2Gtjk3CGIuoN3EYEYiMQIAAFl2Fho=');
              DTM_GateRoom := DTMFromString('mrAAAAHic42BgYBBmZGDgBGJZIJYGYi4g5oayQXKaQKwIxcZAbAKVA2EZEJaWYzh55RYYr95xiGHz/hMM8o49DLwmGQzXtnAyiADt4MKDGQlgGAAAh0IPAA==');
              If Debug then
                WriteLn('Selecting Rimminton Area For Mining operation');
            End;
        1:  Begin                                    // Varrock Area Coordinates
              DTM_TelePort := DTMFromString('mlwAAAHicY2dgYOBhZGCQBNISQHwQyF4ExOVAdi+Qfg2k44F0NpBuAuJoIDsMSIcC8YHJTQwnN81m2LmoC0w/ubiLQUxBlUFcUZXBiAFiJjbMiAdDAQBpJhHL');
              DTM_LodeStone := DTMFromString('m1gAAAHic42JgYLBlYmAwBWIzILYGYjsgdgNidyB2RhKTYGRgEANiKSCWB2IFIJYGYnEgFgBifiDmA2I5GX2Gtjk3CGIuoN3EYEYiMQIAAFl2Fho=');
              DTM_GateRoom := DTMFromString('mggAAAHicY2NgYIhkZGDwA+IUIE4C4kAgjgDiJ0C5G1D8BojfAfEXIHZ3c2doiTZlmJtpzjC/2ILhULkZw9m1PgwiQDkuLJgRB4YAAOmlD3U=');
              Path := [Point(196, 221), Point(190, 274), Point(174, 314), Point(174, 375), Point(132, 402), Point(130, 421)];
              If Debug then
                WriteLn('Selecting Varrock Area For Mining operation');
            End;
        4:  Begin                                    // Varrock Area Coordinates
              DTM_TelePort := DTMFromString('mlwAAAHicY2dgYOBhZGCQBNISQHwQyF4ExOVAdi+Qfg2k44F0NpBuAuJoIDsMSIcC8YHJTQwnN81m2LmoC0w/ubiLQUxBlUFcUZXBiAFiJjbMiAdDAQBpJhHL');
              DTM_LodeStone := DTMFromString('m1gAAAHic42JgYLBlYmAwBWIzILYGYjsgdgNidyB2RhKTYGRgEANiKSCWB2IFIJYGYnEgFgBifiDmA2I5GX2Gtjk3CGIuoN3EYEYiMQIAAFl2Fho=');
              DTM_GateRoom := DTMFromString('mggAAAHicY2NgYIhkZGDwA+IUIE4C4kAgjgDiJ0C5G1D8BojfAfEXIHZ3c2doiTZlmJtpzjC/2ILhULkZw9m1PgwiQDkuLJgRB4YAAOmlD3U=');
              Path := [Point(196, 221), Point(190, 274), Point(174, 314), Point(174, 375), Point(132, 402), Point(130, 421)];
              If Debug then
                WriteLn('Selecting Varrock Area For Mining operation');
            End;
      End;
    End;

    procedure ReleaseDTM;                     // Free The Dtms According To The Location (Free Memory)
    Begin
      FreeDTM(DTM_TelePort);
      FreeDTM(DTM_LodeStone);
      FreeDTM(DTM_GateRoom);
      If Debug then
        WriteLn('Freeing DTM`s From The Memory');
    End;

    Procedure UniversalWalker(Choice:Integer;Walk:String);
    Begin
      Case Choice of
        0:  Begin                                    // Rimmington Area Coordinates
              If Debug then
                WriteLn('Selecting Rimminton Area For Mining operation');
              Case LowerCase(Walk) of
                'gateroom':
                  Begin
                    Info := 'Arriving At Port Sarim Gate Room, Walking To Rimmington Mine';
                    If Debug then
                      WriteLn('Selecting Rimminton Mining Path');
                    ABoxLH := Point(260, 260);                   // Left Top Coordinates For TPoint
                    ABoxRL := Point(300, 300);                   // Right Lower Coordinates For TPoint
                  end;
                'bank':
                  Begin
                    Info := 'Walking To Port Sarim Deposito Box';
                    If Debug then
                      WriteLn('Selecting Port Sarim Deposito Box Path');
                    Path := [Point(286, 277), Point(332, 274), Point(331, 218), Point(378, 205), Point(407, 205)];
                    ABoxLH := Point(382, 186);
                    ABoxRL := Point(427, 210);
                    DP := Point(407, 205);                       // Destination Point - Failsafe For SPS Blindwalk
                    If Debug then
                      WriteLn('Comming From Gate Room, On Our Way To The Deposito Box');
                  end;
                'mining':
                  Begin
                    Info := 'Walking From Port Sarim Gate Room To Rimmington Mining Area';
                    If Debug then
                      WriteLn('Selecting Rimminton Mining Path');
                    Path := [Point(277, 287), Point(222, 267), Point(169, 248), Point(115, 247), Point(122, 192)];
                    ABoxLH := Point(73, 152);
                    ABoxRL := Point(164, 234);
                    DP := Point(122, 192);
                    If Debug then
                      WriteLn('Walking From Port Sarim Gate Room To Rimmington Mining Area');
                  end;
              End;
            End;
        1:  Begin                                    // Varrock West Area Coordinates
              If Debug then
                WriteLn('Selecting Varrock West Area For Mining operation');
              Case lowercase(Walk) of
                'gateroom':
                  Begin
                    Info := 'Arriving At Varrock Gate Room, Walking To Varrock West Mine';
                    If Debug then
                      WriteLn('Arriving At Varrock ,Going To The Mining Location Varrock West');
                    ABoxLH := Point(151, 351);
                    ABoxRL := Point(188, 383);
                  end;
                'bank':
                  Begin
                    Info := 'Walking From Varrock West Mine To Varrock East Bank';
                    Path := [Point(43, 413), Point(64, 398), Point(91, 390), Point(117, 382), Point(140, 379), Point(163, 364), Point(170, 338), Point(176, 319), Point(198, 318), Point(219, 317), Point(243, 316), Point(260, 303), Point(264, 280), Point(285, 274), Point(291, 251), Point(294, 229), Point(293, 208), Point(289, 190), Point(292, 170), Point(312, 168), Point(329, 174), Point(329, 197)];
                    WriteLn(Path);
                    ABoxLH := Point(299, 165);
                    ABoxRL := Point(360, 230);
                    DP := Point(329, 197);
                    If Debug then
                      WriteLn('Comming From Varrock West Mine,Making A Deposit At The East Bank');
                  end;
                'mining':
                  Begin
                    Info := 'Walking From Varrock East Bank to Varrock West Mine';
                    Path := [Point(174, 375), Point(123, 383), Point(78, 402), Point(51, 405)];
                    ABoxLH := Point(2, 356);
                    ABoxRL := Point(74, 437);
                    DP := Point(51, 405);
                    If Debug then
                      WriteLn('Comming From Varrock East Bank, On Our Way To Varrock West Mine');
                  end;
              End;
            End;
        4:  Begin                                    // Varrock East Area Coordinates
              Path := [Point(173,378),Point(199,377),Point(224,375),Point(254,377),Point(275,386),Point(303,396),Point(328,403),Point(359,410),Point(387,411),Point(416,406),Point(442,399),Point(460,405),Point(463,427)];
              If Debug then
                WriteLn('Selecting Warrock East Area For Mining operation');
              Case lowercase(Walk) of
                'gateroom':
                  Begin
                    Info := 'Arriving At Varrock Gate Room, Walking To Varrock East Mine';
                    If Debug then
                      WriteLn('Arriving At Varrock ,Going To The Mining Location Varrock East');
                    ABoxLH := Point(151, 351);
                    ABoxRL := Point(188, 283);
                  end;
                'bank':
                  Begin
                    Info := 'Walking From Varrock West Mine To Varrock East Bank';
                    Path := [Point(463, 431), Point(459, 415), Point(473, 403), Point(487, 387), Point(492, 365), Point(491, 343), Point(490, 318), Point(491, 293), Point(493, 268), Point(485, 250), Point(471, 235), Point(471, 213), Point(468, 191), Point(454, 174), Point(433, 165), Point(417, 166), Point(399, 166), Point(373, 167), Point(355, 167), Point(329, 169), Point(329, 199)];
                    ABoxLH := Point(299, 165);
                    ABoxRL := Point(360, 230);
                    DP := Point(329, 199);
                    If Debug then
                      WriteLn('Comming From Varrock West Mine,Making A Deposit At The East Bank');
                  end;
                'mining':
                  Begin
                    Info := 'Walking From The Gate Room To Varrock East Mine';
                    Path := [Point(180, 373), Point(199, 374), Point(221, 369), Point(242, 368), Point(262, 375), Point(282, 386), Point(303, 390), Point(322, 393), Point(345, 396), Point(368, 399), Point(389, 401), Point(410, 401), Point(434, 397), Point(454, 402), Point(462, 429)];
                    ABoxLH := Point(424, 397);
                    ABoxRL := Point(497, 474);
                    DP := Point(462, 429);
                    If Debug then
                      WriteLn('Comming From Varrock East Bank, On Our Way To Varrock East Mine');
                  end;
              End;
            End;
      End;
    End;

    procedure PathWalker;                             // Universal SPS Path Walker
    var
      FailSafeTime: Integer;
    Begin
      If(not(loggedin))then
        Exit;
      Disguise(Info);
      If Debug then
        WriteLn(Info);
      If not FindNormalRandoms then
      Begin
        If Not LoggedIn Then
        Begin
          Writeln('Found unsolvable random');
          NextPlayer(False);
        End;
      End;
      Compass;                                           // Set Compass North For Walking
      FFlag(10);                                         // Flag Distance
      Writeln('going for a walk now');
      writeln(path);
      MarkTime(FailSafeTime);                            // Setting Failsafe Timer
    // First Walk Procedure With First Failsafe from MarkedTime
      If not(InArea(ABoxLH,ABoxRL))then                  // Check If We Are In The Correct Area
      Begin
        SPS_WalkPath(Path);                              // If Not, Walk The Path To The Correct Area
        While not(InArea(ABoxLH,ABoxRL)) do              // Lets Do Something While We Wait To Finish Our Walk
        Begin
          Antiban;                                       // Nice Antiban
          Wait(1000);                                    // Static Timer For Antiban
          If TimeFromMark(FailsafeTime) > 50000 then     // Break Our Of The Infinite Loop If We Are Not At Our Destination Within The Given Time
          Begin
            Break;
          End;
        End;
      End;
    // Second Walk Procedure With Second Failsafe from MarkedTime
      If not(InArea(ABoxLH,ABoxRL)) then                 // Lets Do Our Failsafe Walk If We Are Not In The Correct Area
      Begin
        Wait(1000);
        MarkTime(FailSafeTime);
        SPS_BlindWalk(DP);                               // Lets Go Blindwalking
      End;
      While not(InArea(ABoxLH,ABoxRL)) do
      Begin
        If TimeFromMark(FailsafeTime) > 35000 then       // Break Out Of Loop If We Are Stuck After A Period Of Time
        Begin
          If Debug then
            WriteLn('We Are Lost Time Ran Out,Resetting Bot From Walking From The Gate Room');
          End_Time := GetTimeRunning;
    //      Lost;
          Exit;
        End;
      End;
      End_Time := GetTimeRunning;                        // How Long Did It Take Us
      TotalTime := (End_Time - Start_Time)/1000;
      WriteLn(Info + IntToStr(TotalTime) + ' Seconds To Complete');
     End;

    procedure RimMine;                                  // Walk To Rimmington Mine
    Begin
      UniversalWalker(Location,'mining');               // Get Coordinates Where We Are Supposed To Go
      WriteLn(Path);
      Writeln('Going to Rimmington Mine');
      PathWalker;                                       // Lets Do The Walking
    End;

    procedure RimDepBox;                       // Walk To Port Sarim's Deposito Box
    Begin
      UniversalWalker(Location,'bank');
      WriteLn(Path);
      Writeln('Going to Port Sarim Deposito Box');
      PathWalker;
    End;

    procedure VarWMine;                               // Walk To Varrock East Mine
    Begin
      UniversalWalker(Location,'mining');
      WriteLn(Path);
      Writeln('Going to Varrock West Mine');
      PathWalker;
    End;

    procedure VarEBank;                                // Walk To Varrock East Bank
    Begin
      UniversalWalker(Location,'bank');
      WriteLn(Path);
      Writeln('From Varrock Mine To Bank');
      PathWalker;
    End;

    procedure VarEMine;                               // Walk To Varrock West Mine
    Begin
      UniversalWalker(Location,'mining');
      WriteLn(Path);
      Writeln('Going to Varrock East Mine');
      PathWalker;
    End;

    procedure GateRoom;                                   // Off World Activities
    var
      x, y, TempTime:Integer;
    Begin
      Disguise('Going To The Gate Room');
      Start_Time := GetTimeRunning;
      UniversalWalker(Location,'gateroom');
      LoadDTM(Location);
      If not(InArea(ABoxLH,ABoxRL))then
      Begin
        FTab(tab_Magic);
        While not(FindDTM(DTM_TelePort, x, y, MSX1, MSY1, MSX2, MSY2)) do
        Begin
          If FindDTM(DTM_LodeStone, x, y, MIX1, MIY1, MIX2, MIY2) then
          Begin
            Mouse(x, y, 1, 1, mouse_left);
            Wait(Randomrange(700, 1000));
          End;
        End;
        While FindDTM(DTM_TelePort, x, y, MSX1, MSY1, MSX2, MSY2) do
        Begin
          If FindDTM(DTM_GateRoom, x, y, MSX1, MSY1, MSX2, MSY2) then
          Begin
            Mouse(x, y, 1, 1, mouse_left);
            Wait(Randomrange(700, 1000));
          End;
        End;
        ReleaseDTM;
      End;
      While Not(InArea(ABoxLH,ABoxRL)) do
      Begin
        Wait(100);
        If (TimeFromMark(TempTime) > 50000) Then
        Begin
          If FindSymbol(x, y, 'portal') then
          Begin
            Exit;
          end else
          Begin
    //        Lost;
            Exit;
          End;
        End;
      End;
    End;

    procedure MainLoop;                          // Here Is Where It All Are Called Into The Light
    var
      I: Integer;
      Param: TVariantArray;
      ArrayOfActivity: TStringArray;
      ArrayOfChoices: TVariantArray;
    Begin
      Case Location of
        0:  Begin                                                     // Rimmington
              ArrayOfActivity := ['RimMine', 'GateRoom', 'RimDepBox', 'GateRoom'];
              If Debug then
                WriteLn('Excecuting Rimmington Mining operation');
            End;
        1:  Begin                                                   // Varrock West
              ArrayOfActivity := ['VarWMine', 'VarEBank', 'GateRoom'];
              If Debug then
                WriteLn('Excecuting Varrock Mining operation');
            End;
        4:  Begin                                                   // Varrock East
              ArrayOfActivity := ['VarEMine', 'VarEBank', 'GateRoom'];
              If Debug then
                WriteLn('Excecuting Varrock East Mining operation');
            End;
      End;
      SetLength(ArrayOfChoices, Length(ArrayOfActivity));         // Load Procedures
      If (TotalLoads = LoadsToDo) Then                            // Check If We Have Reached Our Target
      Begin
        If not FindNormalRandoms then
        Begin
          If Not LoggedIn Then
          Begin
            If Debug then
              Writeln('Found unsolvable random');
            NextPlayer(False);                                    // If Target Reached Exit Script
          End;
        End;
        GateRoom;
        LogOut;
        TerminateScript;
      End else
        Begin
          TripStart := GetTimeRunning;
          For I := 0 To High(ArrayOfActivity) Do                  // Call Each Procedure That Must Be Done From The Proc Array
          Begin
            If LostMyWay then                                     // If We Are Lost, Break Out Of The Loop
            Begin
              TripEnd := GetTimeRunning;
              TripTotal := (TripEnd - TripStart);
              If Debug then
                WriteLn('Mining Ore And Banking It Took ' + IntToStr(TripTotal) + ' To Complete');
              Exit;
            End;
            ArrayOfChoices[I] := CallProc(ArrayOfActivity[I], Param); // Lets Call The Procedure
          End;
          TripEnd := GetTimeRunning;
          TripTotal := (TripEnd - TripStart);
          If Debug then
            WriteLn('Mining Ore And Banking It Took ' + IntToStr(TripTotal) + ' To Complete');
        End;
    End;

    procedure SetupClient;                                // Setup Client For Run
    Begin
      If Debug then
        WriteLn('Start Bot Client');
      SRL_SIXHOURFIX := True;
      SMART_FIXSPEED := True;
      Setupsrl;
      SRL_EnableNavBar;
      Objdtm_Setup;
      DeclarePlayers;
      If not (loggedin) then
      Begin
        LoginPlayertoLob;
        OpenWorldScreen;
        SelectWorld(Server);
        LoginPlayer;
        Wait(4000+Random(400));
      End;
      Case Location of                               // Which Map Should We Use To Walk?
        0:  Begin                                    // Rimmington Area Coordinates
              SPS_Setup(RUNESCAPE_OTHER,['rimmington']);
              If Debug then
                WriteLn('Selecting Rimminton Area For Mining operation');
            End;
        1:  Begin                                    // Varrock West Area Coordinates
              SPS_Setup(RUNESCAPE_OTHER,['varrockmining']);
              If Debug then
                WriteLn('Selecting Varrock Area For Mining operation');
            End;
        4:  Begin                                    // Varrock East Area Coordinates
              SPS_Setup(RUNESCAPE_OTHER,['varrockmining']);
              If Debug then
                WriteLn('Selecting Varrock Area For Mining operation');
            End;
      End;
    End;

    Begin                                                       // Begin Main Loop
      SetupClient;
      Compass;
      SetAngle(srl_angle_high);
      TotalBTime := (HoursToBreak * 60000);                     // Set Timers For Breaks
      TotalPTime := (HoursToPlay * 60000);
      BreakTimes := TotalPTime / (HoursToBreak * 60000);
      WriteLn(BreakTimes);
      ToggleXPBar(True);
      MineFirstRun := True;                                     // This Is The First Run For The Mining
      GateRoom;                                                 // Teleport In To Mining Area
      Repeat
        LostMyWay := False;                           // Set Failsafe Lost As False
        MainLoop;                                     // Main Loop
      Until allplayersinactive;
    End.



    I`m only going to include the custom map for the varrock area.

    If you could take a look at this and tell me where to look for the problem and what the problem is. I`ll appreciate that. Thanks

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

    Default

    I only took a quick look, but nothing jumps out at me. Can you post some debug? That would probably help more. Make sure you set SPS_Debug to true at the beginning of your script.

    Also, have you tried using the SPS areas in SPS rather than custom ones?

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

    Default

    Quote Originally Posted by Coh3n View Post
    I only took a quick look, but nothing jumps out at me. Can you post some debug? That would probably help more. Make sure you set SPS_Debug to true at the beginning of your script.

    Also, have you tried using the SPS areas in SPS rather than custom ones?
    I have found what the problem is, but I can not explain why or fathom why it should be a problem. It is the InArea function that is the problem. When I use it in Rimmington, it works like a charm as it is supposed to, but the moment I shift to varrock, it does not work and always return a false result, therefore it keeps thinking it has not reached the destination and don`t execute the next procedure, when the failsafe for a time out is reached, it execute the lost procedure with he same results as I use that function also there to make sure I`m in the right area.

    So it seems I will have to redo the walking procedures. I will look into the area function of SPS, maybe it is a better way to go.

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

    Default

    Quote Originally Posted by Coh3n View Post
    I only took a quick look, but nothing jumps out at me. Can you post some debug? That would probably help more. Make sure you set SPS_Debug to true at the beginning of your script.

    Also, have you tried using the SPS areas in SPS rather than custom ones?
    @ Coh3n, where can I find how to use sps area functions?

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

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
  •