Results 1 to 3 of 3

Thread: Cannot call SetArrayLength, worked fine a few days ago.

  1. #1
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default Cannot call SetArrayLength, worked fine a few days ago.

    Script was running fine until a few days ago, I havent changed anything, now the script cannot call SetArrayLength? I do not have it set to zero, it is called after declare players and even older versions of the script without changes that ran fine will not run..ideas? Did an update come by and I was not aware of it in my sickness? :P




    Simba Code:
    program KingsWaterfiends; //Made by SRLKing V0.5
    {$Define smart8}
    {$i srl/srl.simba}
    {$I SRL/srl/skill/fighting.Simba}
    {$i sps/sps.simba}
    {$i ObjectDTM\ObjDTMInclude.simba}
    {$i 3DProjection.simba}

    type
      MSObject = record
        Col, Tol, TPADist, MinCount: Integer;
        Hue, Sat: Extended;
        Uptext: TStringArray;
        MMDot: string;
      end;

    type
      ProggyVars = record
        CurrentXP, OriginalXP, OriginalCrimson, OriginalBlue, OriginalGreen, OriginalGold, Crimson, Blue, Green, Gold: Integer;
        XPGain, LoadsDone, XPPerHour: array of Integer;
        TimeGone, LoadsPerHour, CharmsPerHour1, CharmsPerHour2, CharmsPerHour3, CharmsPerHour4: array of Integer;
        CrimsonGain, BlueGain, GreenGain, GoldGain: array of Integer;
      end;

    var
      LoadsToDo, GamesNecklace, ROD, BunyipPouch: Integer;
      MonstersKilled, x, y, t, b, InvCounts, CurrentHP: Integer;
      ReplaceGamesNecklace, ReplaceRingofDuelling, ReplaceSummoningPouch, OutOfPotions: Boolean;
      colorsign: string;
      WaterFiend: MSObject;
      Proggy: ProggyVars;
      BreakRounds, TotalBreaks: Integer;

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      with Players[0] do
      begin
        Name := '*********'; //Username to log in
        Pass := '*********'; //Password to log in
        Active := True;    //Will we be using this player?
        Pin := '*********';    //Pin
        Nick := '';   //NickName for progress reports(Will be added)
      end;
    end;

     { with Players[1] do       // Uncomment to add players
      begin
        Name := '*********';
        Pass := '*********';
        Active := True;
        Pin := '*********';
        Nick := '';
      end;
    end;

      with Players[2] do
      begin
        Name := '*********';
        Pass := '*********';
        Active := True;
        Pin := '*********';
        Nick := '';
      end;
    end;

      with Players[3] do
      begin
        Name := '*********';
        Pass := '*********';
        Active := True;
        Pin := '*********';
        Nick := '';
      end;
    end; }


    const
        //-------------------Script Settings-------------------//

      TripsToDo = 5; //Trips to make to the cave and back

      FoodType = 'Shark'; //Exact name of the food being used

      Potions = 'True';//True = Will use False = will not use

      PotionToUse = 'Ranging potion'; //Name of the potion exactly as seen in game

      LevelToPot = 95; //Level to redrink pots at.

      HpToEatAt = 5000; // Hp to eat at

      FoodToBring = 20; // Amount of food to bring

      FoodBound = '-'; //key that is bound to your food slot.

      PotionBoundKey = '0'; //Key that is bound to your ranging potion/overload ect.

      Bunyip    = 'True';//True = use summoning, False = dont use summoning

      RechargeSummoningLevel = 30;// Level to recharge summoning points at

      UseUltimateAbilities = 'False';//True, does not use Threshold and uses ultimate abilities,
                                   //False Uses threshold and not ultimate abilities
      UseFairyRing = 'True';// Teleport using fairy rings and bank in zanaris? Not implemented yet.


     //-------------------Ability Settings-------------------//

     // Use 750 if no wait time is listed (Ex Piercing shot), If a wait time is listed (Rapid Fire, multiply the number of
     // Seconds by a thousand and add 200, that will be the wait time)

     Basic1 = 1; //What slot for basic ability number 1
     UseTimeBasic1 = 750;// Time in miliseconds (1000 = 1 Second) to use the ability

     Basic2 = 2; //What slot for basic ability number 2
     UseTimeBasic2 = 750;// Time in miliseconds (1000 = 1 Second) to use the ability

     Basic3 = 3; //What slot for basic ability number 3
     UseTimeBasic3 = 3200;// Time in miliseconds (1000 = 1 Second) to use the ability

     Basic4 = 4; //What slot for basic ability number 4
     UseTimeBasic4 = 750;// Time in miliseconds (1000 = 1 Second) to use the ability

    ThreshHold1 = 5; //What slot for ThreshHold ability number 1
    UseTimeThreshHold1 = 750;// Time in miliseconds (1000 = 1 Second) to use the ability

    ThreshHold2 = 7; //What slot for ThreshHold ability number 3
    UseTimeThreshHold2 = 6200;// Time in miliseconds (1000 = 1 Second) to use the ability

    Ultimate1 = 8; //What slot for Ultimate ability number 1
    UseTimeUltimate1 = 6200;// Time in miliseconds (1000 = 1 Second) to use the ability

    Ultimate2 = 9; //What slot for Ultimate ability number 2
    UseTimeUltimate2 = 750;// Time in miliseconds (1000 = 1 Second) to use the ability

    //-----------------Break Setting's-------------------------------------------//

    BreakAfter = 24;// When to start our break in minutes

    BreakFor = 30; //How long to break for in minutes

    RandomAddBreak =15;// Time to add to randomize each break in minutes



    procedure LoadFigures;
    begin
      with WaterFiend do
      begin
        Col := 5390364;
        Tol := 9;
        TPADist := 10;
        Hue := 0.31;
        Sat := 1.98;
        UpText := ['ack Water'];
        MMDot := 'yellow';
        MinCount := 40;
      end;
    end;

    function MakeBox(x1, y1, x2, y2: Integer): TBox;
    begin
      Result.X1 := x1;
      Result.Y1 := y1;
      Result.X2 := x2;
      Result.Y2 := y2;
    end;

    function FindMSObjects(var Coords: TPointArray; Obj: MSObject): Boolean;
    var
      cts, Len, i, c: Integer;
      TPA: TPointArray;
      ATPA: TPointArrayArray;
    begin
      cts := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(Obj.Hue, Obj.Sat);
      Result := False;
      c := 0;
      if FindColorsTolerance(TPA, Obj.Col, MSX1, MSY1, MSX2, MSY2, Obj.Tol) then
      begin
        Result := True;
        ATPA := SplitTPA(TPA, Obj.TPADist);
        Len := Length(ATPA);
        SetLength(Coords, Len);
        for i := 0 to Len - 1 do
        begin
          if Length(ATPA[i]) > Obj.MinCount then
          begin
            Coords[c] := MiddleTPA(ATPA[i]);
            Inc(c);
          end;
        end;
      end;
      SetLength(Coords, c) ColorToleranceSpeed(cts);
      SetColorSpeed2Modifiers(0.2, 0.2);
    end;

    function FindRedBar: Boolean;
    var
      RedBarDTM1, RedBarDTM2, RedBarDTM3: Integer;
    begin
      Result := False;
      RedBarDTM1 := DTMFromString('mlwAAAHicY2dgYDBnZmCQBWIZKB0ExQpA3AiUr2OA0C1QDOPvZOBgsGZnwsBdDIwM+AAjHgwFAAvPB5w={mlwAAAHicY2dgYDBnZmCQBWIZKB0ExQpA3AiUr2OA0C1QDOPvZOBgsGZnwsBdDIwM+AAjHgwFAAvPB5w=}');
      RedBarDTM2 := DTMFromString('mlwAAAHicY2dgYDBnZmCQBWIZKB0ExQpA3AiUr2OA0C1QDOPvZOBgsGZnwsBdDIwM+AAjHgwFAAvPB5w={mlwAAAHicY2dgYDBnZmCQBWIZKB0ExQpA3AiUr2OA0C1QDOPvZOBgsGZnwsBdDIwM+AAjHgwFAAvPB5w=}');
      RedBarDTM3 := DTMFromString('mbQAAAHicY2VgYFAHYicg5oay1YCYEwmzATEPEO9k4GCwZmdCwXJAcS40zIgFgwEAz+gDEA==');
      if FindDTM(RedBarDTM1, X, Y, MSX1, MSY1, MSX2, MSY2) or FindDTM(RedBarDTM2, X, Y, MSX1, MSY1, MSX2, MSY2) or FindDTM(RedBarDTM3, X, Y, MSX1, MSY1, MSX2, MSY2) then
      begin
        SMART_DrawBoxEx(false, false, IntToBox(X - 30, Y - 10, X + 30, Y + 10), ClYellow);
        Wait(50);
        SMART_ClearCanvasArea(IntToBox(0, MSY1, 520, MSY2 + 50));
        Result := True;
      end;
      FreeDTM(RedBarDTM1);
      FreeDTM(RedBarDTM2);
      FreeDTM(RedBarDTM3);
    end;

    procedure Looting();
    begin
      wait(RandomRange(500, 600));
      if (FindRedBar) then
      begin
        wait(RandomRange(1100, 1200));
        if (FindRedBar) then
          wait(RandomRange(150, 200));
        MMouse(X + random(1), Y + 21, 0, 0);
        wait(RandomRange(800, 1200));
        ClickMouse2(False);
        WaitOptionMulti(['ake Crims', 'ake Gold c', 'ake Green', 'ake Blue c', 'ake Sea', 'ake Water or', 'ake Snap', 'ake Shar', 'ake Mithril', 'une elm'], 1000);
        wait(RandomRange(400, 600));
        repeat
          wait(RandomRange(200, 400));
        until (not IsMoving)
        repeat
          wait(RandomRange(500, 750));
          MMouse(262, 178, 0, 0);
          ClickMouse2(False);
        until (not (WaitOptionMulti(['ake Crims', 'ake Gold c', 'ake Green', 'ake Blue c', 'ake Sea', 'ake Water or', 'ake Snap', 'ake Shar', 'ake Mithril', 'une elm'], 1000)));
      end
      else
      begin
        exit;
        writeln('No Red Bar Detected');
      end;
    end;

    {******************************************************************************* //Credit to Echo_
    function BreakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean;
    By: Echo_
    Description: Takes brakes according to the minute values entered
    *******************************************************************************}

    function BreakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean;
    var
      w, x, y, z: Integer;
    begin
      if not LoggedIn then Exit;

      w := (BreakIn * 60000);
      x := (BreakFor * 60000);
      y := RandomRange(-randBreakIn * 60000, randBreakIn * 60000);
      z := RandomRange(-randBreakFor * 60000, randBreakFor * 60000);

      if (HowManyPlayers = 1) then
      begin
        if (GetTimeRunning < ((w) + (y) + BreakRounds)) then Exit
        else
          if (GetTimeRunning > ((w) + (y) + BreakRounds)) then
          begin
            Writeln('Taking a break for about ' + IntToStr(BreakFor) + ' minutes.');
            Logout;
            Wait((x) + (z));
            Writeln('Logging in.');
            LoginPlayer;
            Result := LoggedIn;
            FindNormalRandoms;
            IncEx(BreakRounds, (w) + (x));
            IncEx(TotalBreaks, 1);
            Writeln('The next break will occur in about ' + IntToStr(BreakIn) + ' minutes.');
          end;
      end;

      if (HowManyPlayers > 1) then
      begin
        if (GetTimeRunning < ((w) + (y) + BreakRounds)) then Exit
        else
          if (GetTimeRunning > ((w) + (y) + BreakRounds)) then
          begin
          Writeln('Taking a break for about ' + IntToStr(BreakFor) + ' minutes.');
          Logout;
          IncEx(BreakRounds, (w));
          IncEx(TotalBreaks, 1);
          NextPlayer(True);
          Exit;
          while (LoggedIn) do Wait((x) + (z));
          NextPlayer(True);
        end;
      end;
    end;

    function FindMSObjectsByDot(var Coords: TPointArray; Obj: MSObject): Boolean;
    var
      BoxArr: TBoxArray;
      Len, Len2, i, j, c: Integer;
      TPA, TPA2: TPointArray;
    begin
      TPA := GetMMDotsOnMS2(Obj.MMDot, False);
      Len := Length(TPA);
      SetLength(BoxArr, Len);
      for i := 0 to Len - 1 do
        BoxArr[i] := MakeBox(TPA[i].x - 70, TPA[i].y - 70, TPA[i].x + 70, TPA[i].y + 70);
      if FindMSObjects(TPA2, Obj) then
      begin
        Len2 := Length(TPA2);
        SetLength(Coords, Len2);
        c := 0;
        for i := 0 to Len2 - 1 do
          for j := 0 to Len - 1 do
            if PointInBox(TPA2[i], BoxArr[j]) then
            begin
              Coords[c] := TPA2[i];
              Inc(c);
              Break;
            end;
        SetLength(Coords, c);
        Result := (c > 0);
      end;
    end;

    function FindArrow: Boolean;
    var
      tmpCTS: integer;
      ArrowTPA: TPointArray;
    begin
      if not LoggedIn then
        exit;
      tmpCTS := GetToleranceSpeed;
      SetColorToleranceSpeed(2);
      SetToleranceSpeed2Modifiers(1.88, 1.16);
      if FindColorsTolerance(ArrowTPA, 13032391, 706, 230, 730, 247, 16) then
      begin
        SetColorToleranceSpeed(tmpCTS);
        SetToleranceSpeed2Modifiers(0.02, 0.02);
        Result := True;
      end
      else
      begin
        SetColorToleranceSpeed(tmpCTS);
        SetToleranceSpeed2Modifiers(0.02, 0.02);
        Result := False;
      end;
    end;

    function Fighting: Boolean;
    begin
      if not LoggedIn then
        exit;
      if not (GetCurrentTab = tab_Combat) then
      begin
        GameTab(tab_Combat);
        wait(RandomRange(1000, 1200));
      end
      else
        wait(RandomRange(750, 1000));
      if FindArrow then
      begin
        writeln('We still have a target');
        Result := True;
        exit;
      end
      else
      begin
        Result := False;
        writeln('No longer fighting');
        exit;
      end;
    end;

    function FindCaveFloor: Boolean;
    var
      tmpCTS: integer;
      FloorTPA: TPointArray;
    begin
      if not LoggedIn then
        exit;
      tmpCTS := GetToleranceSpeed;
      SetColorToleranceSpeed(2);
      SetToleranceSpeed2Modifiers(0.11, 0.61);
      if FindColorsTolerance(FloorTPA, 4736522, MSX1, MSY1, MSX2, MSY2, 3) then
      begin
        SetColorToleranceSpeed(tmpCTS);
        SetToleranceSpeed2Modifiers(0.02, 0.02);
        Result := True;
      end
      else
      begin
        SetColorToleranceSpeed(tmpCTS);
        SetToleranceSpeed2Modifiers(0.02, 0.02);
        Result := False;
      end;
    end;

    function OpenBankCW: Boolean;
    var
      b, t, FailCount: Integer;
    begin
      if not LoggedIn then
        Exit;
      MarkTime(b);
      repeat
        MarkTime(t);
        writeln('Trying to open the bank');
        OpenBankChestEdge(SRL_BANK_CW);
        repeat
          wait(RandomRange(50, 100));
        until (BankScreen or (TimeFromMark(t) > 5000) or PinScreen);
        if BankScreen or PinScreen then
        begin
          writeln('Opened the Bank');
          if PinScreen then
          begin
            InPin(Players[CurrentPlayer].Pin);
            writeln('Inputting players pin');
          end;
          Result := True;
          exit;
        end;
        if not (PinScreen or BankScreen) then
        begin
          writeln('Failed to find and open the bank');
          Inc(FailCount);
          if FailCount = 10 then
          begin
            Players[CurrentPlayer].Active := False;
            LogOut;
            Exit;
            writeln('Could not open the bank');
            exit;
          end;
        end;
      until ((TimeFromMark(b) >= 25000) or BankScreen);
      exit;
      ClearDebug;
    end;

    function TeleportToCW: Boolean;
    begin
      if not LoggedIn then
        exit;
      if (not GameTab(tab_Equip)) then
      begin
        GameTab(tab_Equip);
      end;
      MouseBox(682, 369, 714, 401, 2);
      WaitUptext('ing of duell', 1000);
      ClickMouse2(mouse_right);
      WaitOption('Castle Wars', 500);
      MarkTime(t);
      repeat
        wait(RandomRange(50, 75));
      until ((FindSymbol(x, y, Symbol_Bank)) or (TimeFromMark(t) >= 25000));
      if FindSymbol(x, y, Symbol_Bank) then
      begin
        result := true;
        writeln('We are at the bank');
        if FindBlackChatMessage('Your ring of duelling crumbles to dust.') then
        begin
          ReplaceRingofDuelling := True;
        end
        else
        begin
          ReplaceRingofDuelling := False;
        end;
        if FindSymbol(x, y, Symbol_Bank) then
        begin
          Mouse(x, y, 2, 2, True);
        end;
        exit;
      end
      else
        result := false;
      writeln('Did not teleport to the bank');
    end;

    function Eating: Boolean;
    begin
      if not LoggedIn then
        exit;
      CurrentHP := GetMMLevels('hp', colorsign);
      wait(RandomRange(50, 150));
      if CurrentHP < HpToEatAt then
      begin
        SendKeys(FoodBound, 50, 5);
        begin
          MarkTime(t);
          repeat
            wait(RandomRange(30, 60));
          until ((CurrentHP < GetMMLevels('hp', colorsign)) or (TimeFromMark(t) >= 6000));
          if GetMMLevels('hp', colorsign) > HpToEatAt then
          begin
            Result := True;
            exit;
          end
          else
          begin
            if (GetMMLevels('hp', colorsign) < 2000) then
            begin
              TeleportToCW;
              writeln('Banking because we are out of food and low on health');
              exit;
            end;
            Result := False;
            exit;
          end;
        end;
      end
      else
    end;

    function CheckPotLevel: Boolean;
    begin
      if not LoggedIn then
      begin
        exit;
      end
      else if (OutOfPotions = true) then
      begin
        exit;
      end
      else if (Potions = 'True') then
      begin
        if (GetSkillInfo('range', true) < LevelToPot) then
        begin
          SendKeys(PotionBoundKey, 50, 20);
          wait(RandomRange(750, 1000));
          if (GetChatBoxText(8, clMessage) = 'You dont have any left!') then
          begin
            OutOfPotions := True;
            exit;
          end
          else if (GetSkillInfo('range', true) > LevelToPot) then
          begin
            result := true;
            exit;
          end
          else
          begin
            result := false;
            exit;
          end;
        end
        else
        begin
          exit;
        end;
      end
      else
      begin
        exit;
      end;
    end;

    procedure ReturnToMainPoint;
    var
      ReturnHome: TPoint;
    begin
      if not LoggedIn then
        exit;
      ReturnHome := Point(165, 165);
      SPS_WalkToPos(ReturnHome);
    end;

    function FindWaterFiend: boolean;
    var
      TPA: TPointArray;
      i, TPAlen, x, y, FailCount: Integer;
    begin
      if not LoggedIn then
        exit;
      if Fighting then
      begin
        writeln('Already in a fight');
        Result := True;
        exit;
      end
      else
        repeat
          if FindMSObjectsByDot(TPA, WaterFiend) then
          begin
            TPAlen := Length(TPA);
            SortTPAFrom(TPA, Point(MMCX, MMCY));
            for i := 0 to TPAlen - 1 do
            begin
              MMouse(TPA[i].x, TPA[i].y, 5, 5);
              if WaitUpTextMulti(WaterFiend.UpText, 150) then
              begin
                GetMousePos(x, y);
                Mouse(x, y, 0, 0, True);
                if DidYellowClick then
                begin
                  WriteLn('Missed the waterfiend');
                  Result := False;
                  Exit;
                end;
                if GetColor(x, y) = 65278 then
                begin
                  FFlag(2);
                  Wait(RandomRange(450, 500));
                end
                else if Fighting then
                begin
                  Result := True;
                  exit;
                end;
              end;
            end;
          end
          else
          begin
            writeln('Did not find waterfiend');
            Inc(FailCount);
          end;
        until (Fighting or (FailCount >= 5));
      if (FailCount >= 5) then
      begin
        ReturnToMainPoint;
        exit;
      end;
    end;

    function TeleportToBarb: Boolean;
    var
      x, y, t, b, Failcount: Integer;
    begin
      if not LoggedIn then
        exit;
      if not (GetCurrentTab = tab_Inv) then
      begin
        GameTab(tab_Inv);
        wait(RandomRange(1000, 1500));
      end
      else
        MarkTime(t);
      Failcount := 0;
      GamesNecklace := DTMFromString('mbQAAAHicY2VgYBAGYgUgVgRiASiWB2JuIJYGYkkgVgViQZE6IMmEguUYMAEjFgwGAIVvAcs=');
      if FindDTM(GamesNecklace, x, y, MIX1, MIY1, MIX2, MIY2) then
      begin
        writeln('Found Necklace');
        MMouse(x, y, 2, 2);
        wait(RandomRange(150, 200));
        if IsUpText('ecklace') then
        begin
          MarkTime(b);
          ClickMouse2(mouse_Right);
          WaitOption('Rub', 500);
          wait(RandomRange(1500, 2500));
          SendKeys('2', 50, 25);
          if FindBlackChatMessage('Your games necklace crumbles to dust.') then
          begin
            ReplaceGamesNecklace := True;
          end;
          wait(RandomRange(5000, 5500));
          repeat
            wait(RandomRange(35, 60))
          until (FindSymbol(x, y, Symbol_Fish) or (TimeFromMark(b) >= 50000));
          result := true;
          writeln('We are at the Barbarian outpost');
          FreeDTM(GamesNecklace);
          exit;
        end
        else
        begin
          result := false;
          writeln('We are not at the Barbarian outpost');
          FreeDTM(GamesNecklace);
          Players[CurrentPlayer].Active := False;
          LogOut;
          exit;
        end;
      end
      else
      begin
        writeln('Cannot find games necklace');
        FreeDTM(GamesNecklace);
        Players[CurrentPlayer].Active := False;
        LogOut;
        exit;
      end;
    end;

    procedure WalkToObelisk;
    begin
      if not LoggedIn then
        exit;
      ObjDTM_WalkPath(['139:58:3:5:7:87:48:1:7:113:135:1:7:67:139', '94:88:4:1:7:116:63:1:7:108:75:1:7:100:101:1:7:125:87'], 0, 100, 5, False, True);
    end;

    function FindObelisk: Boolean;
    var
      tmpCTS, i, l, r, counter: integer;
      ObeliskTPA: TPointArray;
    begin
      if not (loggedin) then
        exit;
      MakeCompass('E');
      tmpCTS := GetToleranceSpeed;
      SetColorToleranceSpeed(2);
      SetToleranceSpeed2Modifiers(0.33, 0.42);
      FindColorsTolerance(ObeliskTPA, 4874597, MSX1, MSY1, MSX2, MSY2, 8);
      SetColorToleranceSpeed(tmpCTS);
      SetToleranceSpeed2Modifiers(0.02, 0.02);
      L := High(ObeliskTPA) marktime(counter);
      for i := 0 to L do
      begin
        r := random(L);
        wait(randomrange(60, 200));
        mmouse(ObeliskTPA[r].x, ObeliskTPA[r].y, 2, 2);
        if waituptext('obelisk', 300) then
          Break;
        if timefrommark(counter) > 3000 then
        begin
          writeln('Failed to find the Obelisk');
          Players[CurrentPlayer].Active := False;
          LogOut;
          exit;
        end;
      end;
      writeln('Found the Obelisk');
      clickmouse2(mouse_right);
      WaitOption('Renew', 500);
    end;

    procedure CheckSummoningPoints;
    begin
      if not LoggedIn then
        exit;
      if (GetMMLevels('summon', colorsign) <= RechargeSummoningLevel) then
      begin
        WalkToObelisk;
        FindObelisk;
      end
      else
      begin
        exit;
      end;
    end;

    function AtDock: Boolean;
    begin
      if not LoggedIn then
        exit;
      Result := ObjDTM_InArea('82:76:5:3:7:86:23:3:7:69:31:5:7:106:104:5:7:98:104:5:7:106:96:4:61:39:63:95:109:98:102:40', True);
    end;

    function WalkToAncientCavern: Boolean;
    begin
      if not LoggedIn then
        exit;
      ObjDTM_WalkPath(['78:134:3:1:7:79:60:1:7:94:110:1:7:75:115:4:44:64:130:67:119:112:53:105', '74:131:4:1:7:75:83:1:7:99:64:3:7:50:99:1:7:83:103', '67:125:5:3:7:31:84:3:7:73:134:1:7:79:87:1:7:67:64:1:7:80:64', '70:140:3:3:7:84:91:3:7:73:119:3:7:66:92'], 0, 100, 5, False, True);
      if FindSymbol(x, y, Symbol_Dungeon) then
      begin
        Mouse(x, y, 2, 2, True);
        wait(RandomRange(3000, 4000));
      end;
      if AtDock then
      begin
        result := True;
        writeln('We are at the dock to the ancient caverns');
        exit;
      end
      else
      begin
        result := False;
        writeln('We did not arrive at the cavern, exiting');
        Players[CurrentPlayer].Active := False;
        LogOut;
        exit;
      end;
    end;

    function DiveIntoPool: Boolean;
    begin
      if not LoggedIn then
        exit;
      if AtDock then
      begin
        MarkTime(t);
        MakeCompass('S');
        SetAngle(SRL_ANGLE_HIGH);
        wait(RandomRange(500, 1000));
        Mouse(241, 135, 5, 5, True);
        repeat
          wait(RandomRange(100, 150));
        until (FindCaveFloor or (TimeFromMark(t) > 25000));
        result := true;
        writeln('Found the cave floor');
        exit;
      end
      else
      begin
        writeln('Not at the dock');
        result := false;
        Players[CurrentPlayer].Active := False;
        LogOut;
        exit;
      end;
    end;

    procedure UseBasicAbility;
    begin
      if not LoggedIn then
        exit;
      if (not Fighting) then
      begin
        exit;
      end
      else
      begin
        case Random(3) of
          0:
            if UseAbility(Basic1) then
            begin
              MarkTime(t)
              repeat
                wait(RandomRange(10, 20));
              until ((TimeFromMark(t) >= UseTimeBasic1) or not Fighting);
              exit;
            end;
          1:
            if UseAbility(Basic2) then
            begin
              MarkTime(t)
              repeat
                wait(RandomRange(10, 20));
              until ((TimeFromMark(t) >= UseTimeBasic2) or not Fighting);
              exit;
            end;
          2:
            if UseAbility(Basic3) then
            begin
              MarkTime(t)
              repeat
                wait(RandomRange(10, 20));
              until ((TimeFromMark(t) >= UseTimeBasic3) or not Fighting);
              exit;
            end;
          3:
            if UseAbility(Basic4) then
            begin
              MarkTime(t)
              repeat
                wait(RandomRange(10, 20));
              until ((TimeFromMark(t) >= UseTimeBasic4) or not Fighting);
              exit;
            end;
        end;
      end;
      exit;
    end;

    procedure UseThreshHoldAbilities;
    begin
      if not LoggedIn then
        exit;
      if (not Fighting) then
      begin
        exit;
      end
      else
      begin
        case Random(1) of
          0:
            if UseAbility(ThreshHold1) then
            begin
              MarkTime(t)
              repeat
                wait(RandomRange(10, 20));
              until ((TimeFromMark(t) >= UseTimeThreshHold1) or not Fighting);
              exit;
            end;
          1:
            if UseAbility(ThreshHold2) then
            begin
              MarkTime(t)
              repeat
                wait(RandomRange(10, 20));
              until ((TimeFromMark(t) >= UseTimeThreshHold2) or not Fighting);
              exit;
            end;
        end;
      end;
      exit;
    end;

    procedure UseUltimateAbility;
    begin
      if not LoggedIn then
        exit;
      if (not Fighting) then
      begin
        exit;
      end
      else
      begin
        case Random(10) of
          0..4:
            if UseAbility(Ultimate1) then
            begin
              MarkTime(t)
              repeat
                wait(RandomRange(10, 20));
              until ((TimeFromMark(t) >= UseTimeUltimate1) or not Fighting);
              exit;
            end;
          5..10:
            if UseAbility(Ultimate2) then
            begin
              MarkTime(t)
              repeat
                wait(RandomRange(10, 20));
              until ((TimeFromMark(t) >= UseTimeUltimate2) or not Fighting);
              exit;
            end;
        end;
      end;
      exit;
    end;

    procedure UseAbilities;
    begin
      if not LoggedIn then
        exit;
      if (not Fighting) then
      begin
        exit;
      end
      else
      begin
        if (GetAdrenalinePercent < 50) then
        begin
          writeln('Using Basic Ability');
          UseBasicAbility;
          exit;
        end
        else if (GetAdrenalinePercent = 100) then
        begin
          writeln('Using Ultimate Ability');
          UseUltimateAbility;
          exit;
        end
        else
        begin
          if (UseUltimateAbilities = 'True') then
          begin
            exit;
          end
          else if (GetAdrenalinePercent >= 50) then
          begin
            writeln('Using ThresholdAbility');
            UseThreshHoldAbilities;
            exit;
          end
          else
            exit;
        end;
      end;
      exit;
    end;

    procedure FightFiends;
    begin
      if not LoggedIn then
        exit;
      CurrentHP := GetMMLevels('hp', colorsign);
      begin
        if (not Fighting) then
        begin
          FindWaterFiend;
          writeln('looking for a waterfiend');
          exit;
        end
        else if Fighting then
        begin
          writeln('In a fight');
          MarkTime(x);
          repeat
            Looting;
            Eating;
            Looting;
            UseAbilities;
            Looting;
          until (not Fighting or (TimeFromMark(x) > 25000000));
          Looting;
          Inc(MonstersKilled);
        end;
      end;
    end;

    procedure ClimbDownStepsCave;
    begin
      if not LoggedIn then
        exit;
      MMouse(69, 194, 5, 5);
      wait(RandomRange(1000, 2000));
      if IsUpText('limb') then
      begin
        ClickMouse2(True);
        MarkTime(b);
        repeat
          wait(RandomRange(50, 70));
        until (IsMoving or (TimeFromMark(b) >= 25000));
        MarkTime(t);
        repeat
          wait(RandomRange(50, 70));
        until (not IsMoving or (TimeFromMark(t) >= 25000));
      end;
    end;

    function CheckFamiliarActive: Boolean;
    begin
      if not LoggedIn then
        exit;
      if FindColorSpiralTolerance(x, y, 9485404, 691, 153, 720, 180, 19) then
      begin
        writeln('We have a bunyip still');
        result := true;
        exit;
      end
      else
      begin
        writeln('We do not have a bunyip');
        result := false;
        exit;
      end;
    end;

    procedure Banking;
    begin
      if not LoggedIn then
        exit;
      BunyipPouch := DTMFromString('mbQAAAHicY2VgYBAAYnkgZgJiQSCWhoqJAbEIVI4LiP18TaCqEFiOARMwYsFgAAB+mwHA');
      GamesNecklace := DTMFromString('mbQAAAHicY2VgYBAGYgUgVgRiASiWB2JuIJYGYkkgVgViQZE6IMmEguUYMAEjFgwGAIVvAcs=');
      if BankScreen then
      begin
        Deposit(2, 24, true);
        repeat
          wait(RandomRange(50, 70));
        until ((InvCount <= 5) or (TimeFromMark(t) > 6500));
        begin
          if ((ReplaceGamesNecklace = true) or (not FindDTM(GamesNecklace, x, y, MIX1, MIY1, MIX2, MIY2))) then
          begin
            InvCounts := InvCount;
            SearchBank('Games necklace');
            wait(randomrange(1000, 2000));
            Withdraw(0, 0, 1);
            MarkTime(t);
            repeat
              wait(randomrange(50, 200));
            until ((InvCounts < InvCount) or (TimeFromMark(t) >= 6500));
            if InvCounts < InvCount then
            end;
            FreeDTM(GamesNecklace);
          end;
          if (ReplaceRingofDuelling = true) then
          begin
            InvCounts := InvCount;
            SearchBank('Ring of duelling');
            wait(randomrange(1000, 2000));
            Withdraw(0, 0, 1);
            MarkTime(t);
            repeat
              wait(randomrange(50, 200));
            until ((InvCounts < InvCount) or (TimeFromMark(t) >= 6500));
            if InvCounts < InvCount then
            end;
            if (CheckFamiliarActive = false) then
            begin
              ReplaceSummoningPouch := true;
            end
            else
            begin
              ReplaceSummoningPouch := False;
            end;
            if (Bunyip = 'True') and (ReplaceSummoningPouch = true) then
            begin
              InvCounts := InvCount;
              SearchBank('Bunyip pouch');
              wait(randomrange(1000, 2000));
              Withdraw(0, 0, 1);
              MarkTime(t);
              repeat
                wait(randomrange(50, 200));
              until ((InvCounts < InvCount) or (TimeFromMark(t) >= 6500));
              if InvCounts < InvCount then
              end;
              FreeDTM(BunyipPouch);
              if (Potions = 'True') then
              begin
                InvCounts := InvCount;
                SearchBank(PotionToUse);
                wait(randomrange(1000, 2000));
                Withdraw(0, 0, 1);
                MarkTime(t);
                repeat
                  wait(randomrange(50, 200));
                until ((InvCounts < InvCount) or (TimeFromMark(t) >= 6500));
                if InvCounts < InvCount then
                end;
                begin
                  InvCounts := InvCount;
                  SearchBank(FoodType);
                  wait(randomrange(1000, 2000));
                  Withdraw(0, 0, FoodToBring);
                  MarkTime(t);
                  repeat
                    wait(randomrange(50, 200));
                  until ((InvCounts < InvCount) or (TimeFromMark(t) >= 6500));
                  if InvCounts < InvCount then
                  end;
                  CloseBank;
                  MarkTime(t);
                  repeat
                    wait(50)
                  until ((not BankScreen) or (TimeFromMark(t) >= 6500));
                  wait(randomrange(500, 1000));
                  exit;
                end;
              end;

    function AtBank: Boolean;
    begin
      if not LoggedIn then
        exit;
      if FindSymbol(x, y, 'bank') then
      begin
        Result := True;
        writeln('We are at the bank');
        exit;
      end
      else
      begin
        writeln('We are not at the bank');
        Result := False;
        exit;
      end;
    end;

    procedure WalkToFiends;
    begin
      if not LoggedIn then
        exit;
      Mouse(667, 50, 5, 5, True);
      MarkTime(b);
      repeat
        wait(RandomRange(50, 70));
      until (IsMoving or (TimeFromMark(b) >= 8000));
      MarkTime(t);
      repeat
        wait(RandomRange(50, 70));
      until (not IsMoving or (TimeFromMark(t) >= 8000));
    end;

    procedure EquipROD;
    begin
      if not LoggedIn then
        exit;
      ROD := DTMFromString('mlwAAAHicY2dgYBAFYh4gFgNibigtAMRcUCwFxBJAzAvEbEAsDsTCIDUVIJIRK5ZjwA2w64BgKAAAtAEBuQ==');
      if FindDTM(ROD, x, y, MIX1, MIY1, MIX2, MIY2) then
      begin
        wait(RandomRange(1000, 2000));
        Mouse(x, y, 5, 5, True);
      end
      else
      begin
        FreeDTM(ROD);
        writeln('We could not find a ROD to equip');
        Players[CurrentPlayer].Active := False;
        LogOut;
        exit;
      end;
      FreeDTM(ROD);
    end;

    procedure Setup;
    begin
      if not LoggedIn then
        exit;
      if (not IsActionBarOpen) then
      begin
        writeln('Opening the action bar');
        ToggleActionBar(True);
      end;
      if (not IsActionBarLocked) then
      begin
        writeln('Locking the action bar');
        ToggleActionBarLock(True);
      end;
      writeln('Done with setup, action bar is showing and locked');
    end;

    procedure SummonBunyip;
    begin
      if not LoggedIn then
        exit;
      BunyipPouch := DTMFromString('mbQAAAHicY2VgYJACYmkglgBidSDmAmJRIGYDYiWouBgQV9SkAkkmFCzHgAkYsWAwAACwEQJz');
      begin
        if not (GetCurrentTab = tab_Inv) then
        begin
          GameTab(tab_inv);
          wait(randomrange(250, 500));
        end;
        if (Bunyip = 'True') then
        begin
          if FindDTM(BunyipPouch, x, y, MIX1, MIY1, MIX2, MIY2) then
          begin
            Mouse(x, y, 0, 0, false);
            WaitOption('Summon', 500);
            wait(randomrange(1000, 1500));
            if (CheckFamiliarActive = True) then
            begin
              writeln('Summoned Bunyip');
              FreeDTM(BunyipPouch);
              exit;
            end
            else
            begin
              writeln('Did not summon bunyip');
              FreeDTM(BunyipPouch);
              exit;
            end;
          end
          else
          begin
            writeln('Could not find the Bunyip pouch, exiting summoning');
            FreeDTM(BunyipPouch);
            exit;
          end;
        end
        else
        begin
          FreeDTM(BunyipPouch);
          exit;
        end;
      end;
    end;

    procedure LoadProggyVariables;
    begin
      proggy.OriginalXP := GetXPBar(1);
      proggy.OriginalCrimson := GetAmountBox(InvBox(25));
      proggy.OriginalBlue := GetAmountBox(InvBox(26));
      proggy.OriginalGreen := GetAmountBox(InvBox(27));
      proggy.OriginalGold := GetAmountBox(InvBox(28));
      Proggy.Crimson := GetAmountBox(InvBox(25));
      Proggy.Blue := GetAmountBox(InvBox(26));
      Proggy.Green := GetAmountBox(InvBox(27));
      Proggy.Gold := GetAmountBox(InvBox(28));
      Proggy.CurrentXP := GetXPBar(1);
    end;

    procedure ProggyReport;
    begin
      Proggy.TimeGone[CurrentPlayer] := (GetTimeRunning / 1000);
      Proggy.CrimsonGain[CurrentPlayer] := (Proggy.Crimson - proggy.OriginalCrimson);
      Proggy.BlueGain[CurrentPlayer] := (Proggy.Blue - proggy.OriginalBlue);
      Proggy.GreenGain[CurrentPlayer] := (Proggy.Green - proggy.OriginalGreen);
      Proggy.GoldGain[CurrentPlayer] := (Proggy.Gold - proggy.OriginalGold);
      Proggy.XPGain[CurrentPlayer] := (proggy.CurrentXP - proggy.OriginalXP);
      Proggy.XPPerhour[CurrentPlayer] := (3600 * (Proggy.XPGain[CurrentPlayer])) / ((Proggy.TimeGone[CurrentPlayer]));
      Proggy.LoadsPerhour[CurrentPlayer] := (3600 * (proggy.LoadsDone[CurrentPlayer])) / ((Proggy.TimeGone[CurrentPlayer]));
      Proggy.CharmsPerHour1[CurrentPlayer] := (3600 * (Proggy.CrimsonGain[CurrentPlayer])) / ((Proggy.TimeGone[CurrentPlayer]));
      Proggy.CharmsPerHour2[CurrentPlayer] := (3600 * (Proggy.BlueGain[CurrentPlayer])) / ((Proggy.TimeGone[CurrentPlayer]));
      Proggy.CharmsPerHour3[CurrentPlayer] := (3600 * (Proggy.GreenGain[CurrentPlayer])) / ((Proggy.TimeGone[CurrentPlayer]));
      Proggy.CharmsPerHour4[CurrentPlayer] := (3600 * (Proggy.GoldGain[CurrentPlayer])) / ((Proggy.TimeGone[CurrentPlayer]));
    end;

    procedure SetArrayLengths;
    begin
      SetArrayLength(proggy, HowManyPlayers);
    end;

    procedure Progressreport;
    var
      i: Integer;
    begin
      if not LoggedIn then
      begin
        exit;
      end;
      GameTab(tab_Inv);
      if Proggy.LoadsDone[CurrentPlayer] mod 5 = 0 then
        ClearDebug;
      ProggyReport;
      LoadProggyVariables;
      begin
        Writeln('******************************************************************');
        Writeln('*/////////-------------- Kings Waterfiends ---------------\\\\\\\*');
        Writeln('*/////////----------____________________________----------\\\\\\\*');
        Writeln('******************************************************************');
        Writeln('');
        for i := 0 to HowManyPlayers - 1 do
        begin
          Writeln('*/////////--------- Progress Report for: ' + Players[i].Nick + ' --------\\\\\\\\\*');
          Writeln('*///////// Loads done: ' + IntToStr(proggy.LoadsDone[i]) + '  ////  ' + IntToStr(Proggy.LoadsPerHour[i]) + ' Loads/Hour');
          Writeln('*///////// XP gained: ' + IntToStr(Proggy.XPGain[i]) + ' //// ' + IntToStr(Proggy.XPPerHour[i]) + ' XP/Hour');
          Writeln('*///////// Crimson charms: ' + IntToStr(Proggy.CrimsonGain[i]) + '//// ' + IntToStr(Proggy.CharmsPerHour1[i]) + ' Crimson Charms/Hour');
          Writeln('*///////// Blue charms: ' + IntToStr(Proggy.BlueGain[i]) + '//// ' + IntToStr(Proggy.CharmsPerHour2[i]) + ' Blue Charms/Hour');
          Writeln('*///////// Green charms: ' + IntToStr(Proggy.GreenGain[i]) + '//// ' + IntToStr(Proggy.CharmsPerHour3[i]) + ' Green Charms/Hour');
          Writeln('*///////// Gold charms: ' + IntToStr(Proggy.GoldGain[i]) + '//// ' + IntToStr(Proggy.CharmsPerHour4[i]) + ' Gold Charms/Hour');
          Writeln('');
        end;
      end;
    end;

    procedure Login;
    begin
      ClearDebug;
      {$IFDEF SMART}
      {$IFDEF SIMBAMAJOR980}
      SMART_SERVER := 6;
      SMART_MEMBERS := TRUE;
      SMART_SIGNED := TRUE;
      SMART_SUPERDETAIL := FALSE;
      {$ELSE}
      SRL_SIXHOURFIX := TRUE;
      SMART_FIXSPEED := TRUE;
      {$ENDIF}
      {$ENDIF}
      DeclarePlayers;
      LoginPlayer;
      MakeCompass('N');
      SetAngle(SRL_ANGLE_HIGH);
    end;
    begin
      SRL_SixHourFix := True;
      SetupSRL;
      ObjDTM_Setup;
      SPS_Setup(RUNESCAPE_OTHER, ['ancient_cavern']);
      DeclarePlayers;
      SetArrayLengths;
      Login;
      LoadFigures;
      Setup;
      repeat
        repeat
          OpenBankCW;
          Banking;
          if (ReplaceRingofDuelling = True) then
          begin
            EquipROD;
          end
          else
            CheckSummoningPoints;
          TeleportToBarb;
          WalkToAncientCavern;
          DiveIntoPool;
          ClimbDownStepsCave;
          WalkToFiends;
          SummonBunyip;
          MakeCompass('N');
          repeat
            FightFiends;
            ProgressReport;
            CheckPotLevel;
            BreakHandler(BreakAfter, BreakFor, RandomAddBreak, RandomAddBreak);
          until (AtBank or (CurrentHP < 2000));
          Inc(LoadsToDo);
          Inc(Proggy.LoadsDone[CurrentPlayer]);
          if not LoggedIn then
            LoginPlayer;
        until ((LoadsToDo = TripsToDo) or not (LoggedIn));
        NextPlayer(Players[CurrentPlayer].Active);
      until (false);
    end.

  2. #2
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    proggy vars is of a single type. To be able to call set array len, you'd have to define your proggy : proggyvars; into a proggy : array of proggy vars (which in turn would give you T2D arrays within your type.

  3. #3
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    Quote Originally Posted by Le Jingle View Post
    proggy vars is of a single type. To be able to call set array len, you'd have to define your proggy : proggyvars; into a proggy : array of proggy vars (which in turn would give you T2D arrays within your type.
    Thankyou! But why would this only surface now? It has always been setup this way, it never did this before a day or two ago.

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
  •