Results 1 to 2 of 2

Thread: Help! I cant get this error to stop!

  1. #1
    Join Date
    Mar 2015
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Angry Help! I cant get this error to stop!

    I have tried several diffrent fail safes but cant get this stupid error to stop coming up:
    Acess Violation, and its on line 104 and 164. Here is the code, and please no smart ass remarks about googling like i get in the IRC xD

    Code:
    program scriptTemplate;
     
    var
     XPGain, LoadsDone, TimeGone, Logs: Integer;
     XPPerHour, LoadsPerHour, LogsPerHour, CurrentXP, OriginalXP: Integer;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    {$I SPS/lib/SPS-RS3.Simba}
     
    //Player Handler/Settings
    procedure declarePlayers();
      begin
      setLength(players, 1);
       with players[0] do
       begin
            loginName := '';
            password := '';
            isActive := true;
            isMember := false;
            world := 8;
       end
      currentPlayer := 0;
    end;
     
    // Proggy stolen from abu
    procedure Proggy();
    begin
    begin
      ClearDebug;
      CurrentXP := chatbox.getxPBar();
      XPGain := (CurrentXP - OriginalXP);  ;
      begin
        Writeln('******************************************************************');
        Writeln('*/////////---------- Googlez Woodcutter @ Well ----------\\\\\\\*');
        Writeln('*/////////----------____________________________----------\\\\\\\*');
        Writeln('******************************************************************');
        Writeln('*/////////We have done: ' + IntToStr(LoadsDone) + ' Loads');
        Writeln('*/////////We have gained: ' + IntToStr(XPGain) + ' xp');
        Writeln('*/////////We have chopped ' + IntToStr(Logs) + ' Logs');
        Writeln('');
      end;
    end;
    end;
     
     
     
     
    procedure walkToTrees();
    var
    treePath: TPointArray;
    begin
        treePath := [Point(323, 156), Point(304, 163), Point(280, 188), Point(270, 202), Point(253, 222), Point(239, 237), Point(231, 239)];
            if SPS.walkPath(treePath) then
            begin
            minimap.waitPlayerMoving();
            end
            else
            begin
            writeLn('Opps, try again.');
            walkToTrees();
            end;
    end;
     
    procedure walkToBank();
    var
    bankPath: TPointArray;
    begin
        bankPath := [Point(231, 239), Point(239, 237), Point(253, 222), Point(270, 202), Point(280, 188), Point(304, 163), Point(323, 156)];
            if SPS.walkPath(bankPath) then
            begin
            minimap.waitPlayerMoving();
            end
            else
            begin
            writeLn('Opps, try again.');
            walkToBank();
            end;
    end;
     
     
    procedure openBank();
        var
      b        : TBox;
      cts,i,h,w: Integer;
      tpa,tpa2 : TPointArray;
      atpa     : T2DPointArray;
    begin
      findColorsTolerance(tpa, 9733948,  mainscreen.getbounds(), 2, colorSetting(2, 0.13, 0.35));
      SplitTPAWrap(tpa, 5, atpa);
      SortATPASize(atpa, true);
                        //minimap.setAngle(180);
      if (Length(tpa) < 1) then
      begin
        Exit;
      end
      else
      begin
     
      smartImage.debugATPA(atpa);
           for i := 0 to high(atpa) do
          begin
      smartImage.clear();
      findColorsTolerance(tpa, 9733948,  mainscreen.getbounds(), 2, colorSetting(2, 0.13, 0.35));
       SplitTPAWrap(tpa, 5, atpa);
      SortATPASize(atpa, true);
      smartImage.debugATPA(atpa);
       if length(atpa)<(i-1) then exit;
            mouse(middleTPA(atpa[i]), MOUSE_MOVE);
            if isMouseOverText(['Donate Well of Goodwill'], 500) then
            fastClick(MOUSE_RIGHT);
            chooseOption.select(['Open Bank Well of Goodwill'],MOUSE_LEFT);
            smartImage.clear();
            wait(RandomRange(3000,4000));
            bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
            wait(RandomRange(3000,4000));
            bankScreen.close();
            Logs:= Logs+28;
            LoadsDone := LoadsDone+1;
                                Proggy();
            end;
          end
     
    end
     
        procedure cutTree();
        var
      b        : TBox;
      cts,i,h,w, trys: Integer;
      tpa,tpa2 : TPointArray;
      atpa     : T2DPointArray;
    begin
     
    if(tabBackpack.isFull)then
    begin
     Exit;
    end
    else
    begin
     
      findColorsTolerance(tpa, 2704728,  mainscreen.getbounds(), 4, colorSetting(2, 0.47, 0.50));
      SplitTPAWrap(tpa, 5, atpa);
      SortATPASize(atpa, true);
                        //minimap.setAngle(180);
      if (Length(tpa) < 1) then
      begin
        Exit;
      end
      else
      begin
     
      smartImage.debugATPA(atpa);
           for i := 0 to high(atpa) do
          begin
     
          if i>3 then begin walkToTrees(); end;
     
      smartImage.clear();
      findColorsTolerance(tpa, 2704728,  mainscreen.getbounds(), 4, colorSetting(2, 0.47, 0.50));
       SplitTPAWrap(tpa, 5, atpa);
      SortATPASize(atpa, true);
      smartImage.debugATPA(atpa);
     
       if length(atpa)<(i-1) then exit;
            mouse(middleTPA(atpa[i]), MOUSE_MOVE);
            if isMouseOverText(['Chop down Tree'], 500) then
     
              begin
                fastClick(MOUSE_LEFT);
            smartImage.clear();
                print('Tree being cut.');
                wait(RandomRange(5000,7000));
                cutTree();
    if(tabBackpack.isFull)then
    begin
    break();
    end;
     
            end
          end
     
     
      end
     
     
           end;
     
     
     
     
        end
     
    begin
     
          SPS.setup('thaiTrees', RUNESCAPE_OTHER);
          smartEnableDrawing := true;
      clearDebug();
      setupSRL();
      declarePlayers();
      if not isLoggedIn() then
      begin
        players[currentPlayer].login(); ;
      end;
      wait(RandomRange(1000,5000));
            Proggy();
        exitTreasure();
      repeat
      begin
      walkToTrees();
      cutTree();
      walkToBank();
      openBank();
      end;
      until 1=2
    end.

  2. #2
    Join Date
    Jun 2014
    Location
    Lithuania
    Posts
    475
    Mentioned
    27 Post(s)
    Quoted
    200 Post(s)

    Default

    Simba Code:
    procedure openBank();
        var
      b        : TBox;
      cts,i,h,w: Integer;
      tpa,tpa2 : TPointArray;
      atpa     : T2DPointArray;
    begin
      findColorsTolerance(tpa, 9733948,  mainscreen.getbounds(), 2, colorSetting(2, 0.13, 0.35));
      SplitTPAWrap(tpa, 5, atpa);
      SortATPASize(atpa, true);
    // found bank already no need to search again
                        //minimap.setAngle(180);
      if (Length(tpa) < 1) then
      begin
        Exit;
      end
      else
      begin
     
      if length(atpa)<1 then exit; //failsafe to prevent further line crashing
      smartImage.debugATPA(atpa);
           for i := 0 to high(atpa) do
          begin
      // no need to search again since you found at top of function, or not :) your mistake causing error was here
       //if length(atpa)<(i-1) then exit;// this line is now redundant can delete
            mouse(middleTPA(atpa[i]), MOUSE_MOVE);
            if isMouseOverText(['Donate Well of Goodwill'], 500) then
            fastClick(MOUSE_RIGHT);
            chooseOption.select(['Open Bank Well of Goodwill'],MOUSE_LEFT);
            smartImage.clear();
            wait(RandomRange(3000,4000));
            bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
            wait(RandomRange(3000,4000));
            bankScreen.close();
            Logs:= Logs+28;
            LoadsDone := LoadsDone+1;
                                Proggy();
            end;
          end

    end


    And similar with second one, You redefine atpa and tpa in your inner loop of for i:=0 to... But use old length of atpa you got before loop, because lengths differ it gets out of bounds.

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
  •