Page 2 of 2 FirstFirst 12
Results 26 to 46 of 46

Thread: [Simba] Forest Exterminator

  1. #26
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, thanks for the information and link, will update script in a bit with it

    Edit: New version is up.

    Now includes Breaking
    Waking tweaks
    Added TerminateScript Procedure
    Last edited by Bobzilla69; 09-28-2010 at 11:23 AM.

  2. #27
    Join Date
    Sep 2010
    Location
    Oxford, Michigan
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by bobzilla69 View Post
    thats interesting.

    the only dtm i use is in line 720 (there abouts) for my banking, and it does get freed.

    the AddToReport is in SRL so must be a problem in there, will have to look into that.

    have you managed to get a load done or does it produce the error quickly?

    edit: small update, adding FreeSRLBitmaps after doing findnormalrandom, i looked through the code and it didnt seem to free them after use. hopefully will help with script problem (i have yet to experiences the error)
    I have gotten up to 12 loads done before and it randomly displays that error other times I only get halfway through a load. Could this be a problem with my computer not the script?

    Also I have not tried the latest updates I will probably try them later tonight I just don't have time right down. I will give an update later for you and Bobzilla. Thank you for the help.

    Edit: The actual problem causing the script to stop is that occasional it takes more than 4 attempts to find that bank. Thats what logs me out then I get the error I posted earlier afterwards.

    eg:
    Finding bank took longer that 4 attempts, logging out
    Player not logged in Switching to next
    Choosing Next Player

    [============================================]
    [ Forest Exterminator 1.20 ]
    [ by Bobzilla69 ]
    [============================================]
    [ TimeRunning : 44 Minutes And 14 Seconds ]
    [ Active Players : 0 ]
    [============================================]
    [ Forest Exterminator 1.20 ]
    [============================================]
    [================================================== =======]
    [ Nick | Active | Worked | Banked | Rand | Tree Cutting ]
    [================================================== =======]
    [ tyr3 | False | 01:26:18 | 7 | | Willow ]
    [================================================== =======]

    Please post bugs and report at http://villavu.com/forum/showthread.php?p=739347

    Exception in Script: The given DTM Index[0] doesn't exist
    File[C:\Simba\Includes\SRL/logs/SRL log 28-09-10 3.txt] has not been freed in the script, freeing it now.
    Last edited by dhandley12; 09-29-2010 at 02:59 AM.

  3. #28
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by dhandley12 View Post
    I have gotten up to 12 loads done before and it randomly displays that error other times I only get halfway through a load. Could this be a problem with my computer not the script?

    Also I have not tried the latest updates I will probably try them later tonight I just don't have time right down. I will give an update later for you and Bobzilla. Thank you for the help.

    Edit: The actual problem causing the script to stop is that occasional it takes more than 4 attempts to find that bank. Thats what logs me out then I get the error I posted earlier afterwards.

    eg:
    Finding bank took longer that 4 attempts, logging out
    Player not logged in Switching to next
    Choosing Next Player

    [============================================]
    [ Forest Exterminator 1.20 ]
    [ by Bobzilla69 ]
    [============================================]
    [ TimeRunning : 44 Minutes And 14 Seconds ]
    [ Active Players : 0 ]
    [============================================]
    [ Forest Exterminator 1.20 ]
    [============================================]
    [================================================== =======]
    [ Nick | Active | Worked | Banked | Rand | Tree Cutting ]
    [================================================== =======]
    [ tyr3 | False | 01:26:18 | 7 | | Willow ]
    [================================================== =======]

    Please post bugs and report at http://villavu.com/forum/showthread.php?p=739347

    Exception in Script: The given DTM Index[0] doesn't exist
    File[C:\Simba\Includes\SRL/logs/SRL log 28-09-10 3.txt] has not been freed in the script, freeing it now.
    ok, thanks for all that.

    i will check the banking and make some changes to it.

    where you in the bank when it was looking for the bank booths?

    Edit: New version out.

    Increases bank searching to 5 attempts
    Added SRL Banking Fail-safe (if my banking fails 5 times tries SRL OpenBank();
    Last edited by Bobzilla69; 09-29-2010 at 08:50 AM.

  4. #29
    Join Date
    Sep 2010
    Location
    Northern Kentuckeh
    Posts
    759
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    When you say yews in draynor are they the ones between draynor and lumby or the one thats west above port sarim?

  5. #30
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by doublex8 View Post
    When you say yews in draynor are they the ones between draynor and lumby or the one thats west above port sarim?
    Its the single yew west, just pass the fence above the 4 willows

  6. #31
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Fixed Standards and Some Changes
    Simba Code:
    program ForestExterminator;
    {$DEFINE SMART}
    {$I SRL\SRL.scar}
    {$I SRL\SRL\misc\Reports.scar}
    {$I SRL\SRL\misc\Debug.scar}

    {=========================================================================]
    [                                                                         ]
    [                                                                         ]
    [           NAME        : Forest Exterminator                             ]
    [           WRITER      : Bobzilla69                                      ]
    [           CATEGORY    : Woodcutting                                     ]
    [           DESCRIPTION : Cuts Trees/Oaks/Willows and Yews                ]
    [           USAGE       : Start in Draynor Bank,                          ]
    [                         with axe in inventory or equiped                ]
    [           NOTES       : There can be a problem with all trees being     ]
    [                         cut so it will log out due to not finding tree  ]
    [           CONTACT     : PM me on SRL-Forums or post in thread           ]
    [           THANKS      : I would like to Thank R!ch!e for exsplaining    ]
    [                         his MineOre procedure from M!ne used in my      ]
    [                         FindTreeTPA  and CutTreeprocedure and           ]
    [                         all other help R!ch!e provided.                 ]
    [                         Thanks to NCDS for helping me by suggesting     ]
    [                         a TPA walking method                            ]
    [                         Thanks to BobboHobbo for giving me an idea      ]
    [                         from your Draynor Willow cutter banker, used    ]
    [                         Changed ischopping to suite me.                 ]
    [                                                                         ]
    [=========================================================================]
    [                              Instructions                               ]
    [=========================================================================]
    [ 1. Have character in Draynor bank with axe equiped or in inventory      ]
    [ 2. Fill out DeclarePlayers.                                             ]
    [ (For further instructions on how to fill it out, visit this thread:     ]
    [   [url]http://www.villavu.com/forum/showthread.php?t=5410[/url])                   ]
    [ 3. Designed to be used with SMART and Simba                             ]
    [ 4. Start script and enjoy, dont forget to post a proggy!                ]
    [=========================================================================}


    var
      DebugTheTPA, DebugReport: boolean;


    procedure DeclarePlayers;
    var
      I: integer;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      DebugTheTPA := False;   //True if you want to see TPA debug
      DebugReport := False;   //This will include Debugs taken from script and incldude into proggress report(extending report alot)  not recommended for long runs, only for 1-3 loads

      with Players[0] do
      begin
        Name := '';           //Username
        Pass := '';           //Password
        Nick := '';           //3-4 non uppercase, number, or space characters on your username
        Pin := '';            //Bank Pin (Blank if none)
        Active := True;       //Player Active?
        Strings[0] := '';     //Tree that will be chopped (If blank will be AutoDetected)
        Integers[0] := 1;     //Loads to do
        Booleans[0] := False; //Do Breaks?
        Booleans[1] := False; //Rerun after Loads?
        Integers[1] := 0;     //Woodcutting Level (Use this if autodetection doesn't work!)
      end;

      {with Players[1] do
      begin
        Name := '';           //Username
        Pass := '';           //Password
        Nick := '';           //3-4 non uppercase, number, or space characters on your username
        Pin := '';            //Bank Pin (Blank if none)
        Active := True;       //Player Active?
        Strings[0] := '';     //Tree that will be chopped (If blank will be AutoDetected)
        Integers[0] := 1;     //Loads to do
        Booleans[0] := False; //Do Breaks?
        Booleans[1] := False; //Rerun after Loads?
        Integers[1] := 0;     //Woodcutting Level (Use this if autodetection doesn't work!)
      end;}


      for I := 0 to HowManyPlayers - 1 do
        with Players[I] do
        begin
          BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
          Strings[1] := '';
          Banked := 0;
          Worked := 0;
        end;
    end;

    {------------------------------------end of setup------------------------------}

    type
      TTree = record
        Col, Tol, Cut, Light: Integer;
        HMod, SMod: Extended;
        UpText: TStringArray;
        Tree: string;
    end;

    var
      Working: integer;
      x, y: integer;
      LoadsDone: boolean;

    //auto colors a selection of items
    function MyFindColor(What: string; Where:boolean): integer;   //on minimap(true) or main screen (false)
    var
      I, J, TheColor, Red, Green, Blue, color,
      bL, bH, gL, gH, rL, rH, colTol: integer;
      colorArray: TPointArray;
    begin
      case lowercase(What) of
        'bank': begin
            color := 5533565;
            bL := 77;
            bH := 91;
            gL := 104;
            gH := 117;
            rL := 118;
            rH := 131;
            colTol:= 11;    //use to alter tollerance
          end;
        'stall': begin
            color := 6184290;
            bL := 89;
            bH := 98;
            gL := 89;
            gH := 97;
            rL := 93;
            rH := 102;
            colTol:= 7;    //use to alter tollerance
          end;
        'water': begin
            color := 10983825;
            bL := 162;
            bH := 171;
            gL := 148;
            gH := 158;
            rL := 140;
            rH := 149;
            colTol:= 7;    //use to alter tollerance
          end;
        'road': begin
            color := 7237234;
            bL := 105;
            bH := 115;
            gL := 106;
            gH := 113;
            rL := 109;
            rH := 118;
            colTol:= 7;
          end;
        'rock': begin
            color := 5855833;
            bL := 85;
            bH := 93;
            gL := 86;
            gH := 94;
            rL := 85;
            rH := 93;
            colTol:= 6;
          end;
      end;
      Result := 0;

      if Where then
        FindColorsTolerance(colorArray, color, MMX1, MMY1, MMX2, MMY2, colTol)
      else
        FindColorsTolerance(colorArray, color, MSX1, MSY1, MSX2, MSY2, colTol);

      J := High(colorArray);
      for I := 0 to J do
        if ((rs_OnMinimap(colorArray[I].x, colorArray[I].y)) or (not (Where))) then
        begin
          TheColor := GetColor(colorArray[i].x, colorArray[i].y);
          ColorToRGB(TheColor, Red, Green, Blue);
          if (InRange(Blue, bL, bH) and InRange(Green, gL, gH) and InRange(Red, rL, rH)) then
          begin
            Result := TheColor;
            WriteLn(What + ' Colour Found: ' + IntToStr(TheColor));
            Exit;
          end;
        end;
    end;

    procedure Write(WhatsHappening: string); //idea from M!ne by R!ch!e
    begin
      Writeln(WhatsHappening);
      Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + WhatsHappening + #13#10;
    end;

    procedure LogoutWhy(Why: string);  //idea from BobboHobbo script
    begin
      Write(Why);
      //Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + Why + #13#10;
      Players[CurrentPlayer].Active := False; //Set player inactive
      Logout;
    end;

    function SetupTree: TTree;
    begin
      case Lowercase(Players[CurrentPlayer].Strings[0]) of
        'tree': begin
            with Result do         //Loads tree into Result: TTree;
            begin
              Col := 4025442;      //Colour
              Tol := 5;            //Tolerance
              Cut := 8000;         //Cut Time (This should not be here.... Use a function to detect cutting)
              Light := 8000;       //Light Time (Nether should this... Same as above)
              HMod := 0.04;        //Hue
              SMod := 1.57;        //Saturation
              UpText := ['hop down Tree', 'own Tree', 'ree']; //Uptext
              Tree := 'Tree';      //Name of Tree
            end;
          end;
        'oak': begin
            with Result do
            begin
              Col := 6202005;
              Tol := 5;
              Cut := 15000;
              Light := 8000;
              HMod := 0.10;
              SMod := 1.58;
              UpText := ['hop down Oak', 'own Oak', 'ak'];
              Tree := 'Oak';
            end;
          end;
        'willow': begin
            with Result do
            begin
              Col := 4088154;
              Tol := 4;
              Cut := 20000;
              Light := 8000;
              HMod := 0.25;
              SMod := 1.57;
              UpText := ['hop down Willow', 'own Willow', 'illow'];
              Tree := 'Willow';
            end;
          end;
        'yew': begin
            with Result do
            begin
              Col := 6070418;
              Tol := 10;
              Cut := 30000;
              Light := 8000;
              HMod := 0.13;
              SMod := 0.12;
              UpText := ['hop down Yew', 'own Yew', 'ew'];
              Tree := 'Yew';
            end;
          end;
      end;
    end;

    function LoadDTM(What: string): string;
    begin
      case LowerCase(What) of
        'log':   Result := 'mggAAAHicY2NgYBCEYhkglgBiNijmhdIcQCwOleMB4gQPLSDJhIFTGLADRhwYAgCmhgIF';                     //logs (max tolerance)
        'braxe': Result := 'mbQAAAHicY2VgYNBkYWBQBmIDINYFYnUgnsPIwDAbiOcB8SIgng/E9gYyQNVMKJiLARMwYsFgAABuXQSn';         //bronze axe
        'iaxe':  Result := 'mggAAAHicY2NgYLBjYmBwAGIXIHYGYmsgNgfit0C5V0D8Bog/APF7IH4NxJbm5kCSCQOzMmAHjDgwBAAA6D8H0w=='; //iron axe
        'blaxe': Result := 'mggAAAHicdcrbCgAQFETRQy6hk1Lk/7/ULt6wa83TBBFpKOiYGKgI8HCI55Ogqqy9ZHlnPnYLVU8A4Q==';         //black axe
        'saxe':  Result := 'mggAAAHicY2NgYNAGYl0gNgRiPSBWB2IVII4F4igonQTE8UAcDcThIcFAkgkDczFgB4w4MAQAAJOfBFE=';         //steel axe
        'maxe':  Result := 'mggAAAHicY2NgYFgOxAuAeBUQr4XSS4CYDYhZgZgFiNmBmAeIOYHY0NATSDJhYC4G7IARB4YAABIJBOM=';         //mithril axe
        'aaxe':  Result := 'mggAAAHicY2NgYDABYh0gNgdiSyhtAMRsQMwKxCxAzA7E3EDMCZK3B6lgwsAgtdgAIw4MAQDXOwIq';             //adamant axe
        'raxe':  Result := 'mggAAAHicY2NgYDgFxIeB+BwQXwDis0B8HIjZgJgViFmAmAOIeYCYE4itPfyAJBMG5mLADhhxYAgAAH10Bd0=';     //rune axe
      end;
    end;

    procedure ProgressReport;
    var
      I :integer;
    begin
      Writeln(#13#10);
      SRLProgressReport(ResultDebugBox, 'Forest Exterminator', 'Bobzilla69', '1.25',
                        ['TimeRunning', 'Active Players'],
                        [TimeRunning, PlayersActive]);
      SRLPlayerReport(ResultDebugBox, 0, false, [True, True, false, false, false, true], ['Tree Cutting'], [], [], [0], [] );
      Writeln(#13#10'Please post bugs and report at [url]http://villavu.com/forum/showthread.php?p=739347'#13#10);[/url]
      if (DebugReport) then
      begin
        for I := 0 to (HowManyPlayers - 1) do
        begin
          if (not (Players[I].Strings[1] = '')) then
          begin
            WriteLn(Players[I].Nick + #13#10'Debug of what happened'#13#10);
            WriteLn(Players[I].Strings[1]);
          end;
        end;
      end
    end;

    procedure ScriptTerminate;
    begin
      FreeSRLBitmaps;
      ProgressReport;
    end;

    procedure CheckLevels;
    begin
      Wait(200);
      if (not (LoggedIn)) then
        Exit;

      if (Players[CurrentPlayer].Integers[1] = 0) then
        Players[CurrentPlayer].Integers[1] := GetSkillInfo('woodcutting', True);

      case (Players[CurrentPlayer].Integers[1]) of
        1..14: Players[CurrentPlayer].Strings[0] := 'Tree';
        15..29: Players[CurrentPlayer].Strings[0] := 'Oak';
        30..59: Players[CurrentPlayer].Strings[0] := 'Willow';
        60..99: Players[CurrentPlayer].Strings[0] := 'Yew';
      end;
      Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + Players[CurrentPlayer].Strings[0] +' was auto detected to be trained on.'#13#10;
    end;

    procedure CheckLogged;
    var
      breakFor: integer;
    begin
      if (PlayersActive >= 1) then
      begin
        if (Players[CurrentPlayer].Integers[1] = 0) then
          Exit;
        Logout;
        if (Players[CurrentPlayer].Booleans[0]) then
        begin
          breakFor := 240000 + RandomRange(90000, 150000);
          Write('Taking Break for: ' + MsToTime(breakFor, Time_Short));
          Wait(breakFor);
        end;
      end;

      if (LoadsDone) then
      begin
        LoadsDone := False;
        Exit;
      end;

      if (not (LoggedIn)) then
      begin
        Write('Player not logged in Switching to next');
        Write('Choosing Next Player');
        Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + 'Player Failed, Please Post Proggress report and location logged out'#13#10;
        Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + TimeFromMark(working);
        Players[CurrentPlayer].Active := False;
        Logout;
      end;
    end;

    procedure AntiBan;
    var
      MousePos: TPoint;
    begin
      FindNormalRandoms;
      GetMousePos(MousePos.x, MousePos.y);

      case random(100) of //30% chance something will happen
        0..5: PickupMouse;
        10..15: HoverSkill('random', False);
        20..25: GameTab(RandomRange(tab_Combat, tab_Notes));
        30..35: Wait(500 + Random(1500));
        40..45: RandomAngle(1);
        50..55: BoredHuman;
      end;

      GameTab(Tab_Inv);
      MMouse(MousePos.x, MousePos.y, 2, 2);
    end;

    procedure WalkToBank;
    var
      MiddleOfTPA: TPoint;
      TPA: TPointArray;
      ATPA:  T2DPointArray;
      TreeSetup: TTree;
    begin
      if (not (LoggedIn)) then
        Exit;
      TreeSetup := SetupTree;
      Write('Walking to Bank from: ' + TreeSetup.Tree + '.');
      case LowerCase(TreeSetup.Tree) of
        'tree': begin
            //at trees, loking for rock at top right hand side. shoudl walk to above pen
            if FindColorsPie(TPA, MyFindColor('rock', True), 15, 0, 360, 5, 45, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              if (DebugTheTPA) then
                DebugTPA(TPA, '');
              Mouse(MiddleOfTPA.x - 10 , MiddleOfTPA.y + 55, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;

            //try to use stalls to place you near bank
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, 140, 240, 40, 70, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY) then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              if (DebugTheTPA) then
                DebugTPA(TPA, '');
              Mouse(MiddleOfTPA.x + 5, MiddleOfTPA.y + 8, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 2 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 2,  Logging out...');
              Exit;
            end;

            //should place in bank, using bankers as refrence
            if FindColorsPie(TPA, 1179390, 15, 90, 210, 35, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              if (DebugTheTPA) then
                DebugTPA(TPA, '');
              Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -3, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 3 Complete');
              FFlag(5);
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 3,  Logging out...');
              Exit;
            end;
          end;
        'oak': begin
            MakeCompass('N');
            //use rocks and offsetting to end up near pen
            if FindColorsTolerance(TPA, MyFindColor('rock', True), MMCX, MMY1, MMX2, MMCY, 15)then
            begin
              ATPA := SplitTPAEx(TPA, 8, 8);
              SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
              MiddleTPAEx(ATPA[0], x , y);
              Mouse(x + 30, y + 46, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
              Wait(3000);
              Flag;
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;

            //Stalls Middle to bank
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, 90, 230, 5, 55, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x + 5, MiddleOfTPA.y + 8, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 2 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 2,  Logging out...');
              Exit;
            end;

            //should place in bank, using bankers as refrence
            if FindColorsPie(TPA, 1179390, 15, 90, 210, 40, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -5, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 3 Complete');
              FFlag(5);
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 3,  Logging out...');
              Exit;
            end;
          end;
        'willow': begin
            MakeCompass('N');
            if FindColorsPie(TPA, 1179390, 15, 0, 60, 30, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -3, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
              FFlag(5);
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;
          end;
        'yew': begin
          MakeCompass('N');
          if FindColorsPie(TPA, MyFindColor('rock', True), 15, 60, 180, 30, 60, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
          begin
            MiddleOfTPA:= MiddleTPA(TPA);
            Mouse(MiddleOfTPA.x - 15, MiddleOfTPA.y , 5, 5, True);
            Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
            Flag;
          end else
          begin
            LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
            Exit;
          end;

          //use rocks and offsetting to end up near pen
          if FindColorsTolerance(TPA, MyFindColor('rock', True), mmcx, mmy1, mmx2, mmcy, 15)then
          begin
            ATPA := SplitTPAEx(TPA, 8, 8);
            SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
            MiddleTPAEx(ATPA[0], x , y);
            Mouse(x + 30, y + 46, 5, 5, True);
            Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 2 Complete');
            Wait(3000);  //in case flag go off map
            Flag;
          end else
          begin
            LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 2,  Logging out...');
            Exit;
          end;

          //Stalls Middle to bank
          if FindColorsPie(TPA, MyFindColor('stall', True), 15, 90, 230, 5, 55, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
          begin
            MiddleOfTPA := MiddleTPA(TPA);
            Mouse(MiddleOfTPA.x + 5, MiddleOfTPA.y + 8, 5, 5, True);
            Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 3 Complete');
            Flag;
          end else
          begin
            LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 3,  Logging out...');
            Exit;
          end;

          //should place in bank, using bankers as refrence
          if FindColorsPie(TPA, 1179390, 15, 90, 210, 40, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
          begin
            MiddleOfTPA := MiddleTPA(TPA);
            Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -5, 5, 5, True);
            Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 4 Complete');
            FFlag(5);
          end else
          begin
            LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 4,  Logging out...');
            Exit;
          end;
        end;
      end;
      Wait(500 + Random(500)); //screen settle
      Write('Walking to bank from: ' + TreeSetup.Tree + ' Complete.');
    end;

    procedure WalkToTrees;
    var
      MiddleOfTPA: TPoint;
      TPA: TPointArray;
      ATPA:  T2DPointArray;
      TreeSetup: TTree;
    begin
      if (not (LoggedIn)) then
        Exit;

      TreeSetup := SetupTree;
      Write('Walking to tree: ' + TreeSetup.Tree);
      case Lowercase(TreeSetup.Tree) of
        'tree': begin
            MakeCompass('N');
            //from bank to middle of stalls
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, -130, -25, 5, 70, mmx1, mmy1, mmcx, mmcy, mmcx, mmcy) then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 5, MiddleOfTPA.y , 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;

            //at stalls uses middle of stalls and offset to walk behind to pen
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, 0, 360, 5, 30, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA:= MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 10, MiddleOfTPA.y - 52, 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 2 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 2,  Logging out...');
              Exit;
            end;
          end;
        'oak': begin
            MakeCompass('N');
            //from bank to middle of stalls
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, -130, -25, 5, 70, mmx1, mmy1, mmcx, mmcy, mmcx, mmcy) then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 5, MiddleOfTPA.y , 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;

            //at stalls uses middle of stalls and offset to walk behind to pen
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, 0, 360, 5, 30, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA:= MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 10, MiddleOfTPA.y - 52, 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 2 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 2,  Logging out...');
              Exit;
            end;

            //rock near oak's to walk to oak's
            if FindColorsTolerance(TPA, MyFindColor('rock', True), MMX1, MMY1, MMCX, MMCY, 15)then
            begin
              ATPA := SplitTPAEx(TPA, 8, 8);
              SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
              MiddleTPAEx(ATPA[0], x , y);
              Mouse(x - 22, y + 24, 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 3 Complete');
              Wait(3000); //in case flag go off map
              Flag;
              Write('Walking Complete');
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 3,  Logging out...');
              Exit;
            end;
          end;
        'willow': begin
            MakeCompass('S');
            if FindColorsPie(TPA, MyFindColor('rock', True), 15, 0, 60, 50, 80, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY) then
            begin
              MiddleOfTPA:= MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 25, MiddleOfTPA.y + 15, 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;
          end;
        'yew': begin
            MakeCompass('N');
            //from bank to middle of stalls
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, -130, -25, 5, 70, mmx1, mmy1, mmcx, mmcy, mmcx, mmcy) then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 5, MiddleOfTPA.y , 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;

            //at stalls uses middle of stalls and offset to walk behind to pen
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, 0, 360, 5, 30, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA:= MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 10, MiddleOfTPA.y - 52, 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 2 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 2,  Logging out...');
              Exit;
            end;

            //rock near oak's to walk to oak's
            if FindColorsTolerance(TPA, MyFindColor('rock', True), MMX1, MMY1, MMCX, MMCY, 15)then
            begin
              ATPA := SplitTPAEx(TPA, 8, 8);
              SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
              MiddleTPAEx(ATPA[0], x , y);
              Mouse(x - 22, y + 24, 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 3 Complete');
              Wait(3000); //in case flag go off map
              Flag;
              Write('Walking Complete');
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 3,  Logging out...');
              Exit;
            end;
          end;
        end;
        Wait(500 + Random(500));
        Write('Walking to tree: ' + TreeSetup.Tree + ' Complete.');
    end;

    Function MyOpenBank: boolean;
    var
      TPA: TPointArray;
      ATPA:  T2DPointArray;
      I, J: integer;
    begin
      Result := BankScreen;
      if (Result) then
        Exit;
      MakeCompass('W');
      Wait(300);
      FindColorsTolerance(TPA, MyFindColor('bank', False), MSX1, MSY1, MSX2, MSCY, 5);
      ATPA := SplitTPAEx(TPA, 10, 10);
      SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
      J := High(ATPA);
      for I := 0 to J do  //from 0 first entry in array to highest entry in ATPA
      begin
        MiddleTPAEx(ATPA[I], x, y); //find middle of array entry
        MMouse(x, y, 2, 2);
        if WaitUpTextMulti(['ooth', 'ank booth'], 400) then
        begin
          Mouse(x, y, 0, 0, False);
          Wait(200);
          WaitOption('uickl', 400);
          Flag;
          Wait(2000 + Random(800));

          if (PinScreen) then
          begin
            InPin(Players[CurrentPlayer].Pin);
            Wait(100);
          end;

          Result := BankScreen;
        end;
      end;
    end;

    procedure BankIt;
    var
      BankLoop, DTM: integer;
    begin
      if (not (LoggedIn)) then
        Exit;

      BankLoop := 0;
      repeat
        Wait(300);
        Inc(BankLoop);
      until((BankLoop > 5) or (MyOpenBank))

      if (not (BankScreen)) then
        OpenBank('db', True, False);

      if ((BankLoop >= 5) or (not (BankScreen))) then
      begin
        LogoutWhy('Finding bank took more that 5 attempts, logging out');
        Exit;
      end;

      DTM := DTMFromString(LoadDTM('log'));
      try
        if FindDTM(DTM, x, y, MIX1, MIY1, MIX2, MIY2) then
        begin
          Mouse(x, y, 3, 3, False);
          ChooseOption('All'); //ChooseOption('All '+TreeSetup.Tree);
          Wait(1500 + Random(500)); //incase of lagg
        end else
          LogoutWhy('Logs not found in inventory logging out');
      finally
        FreeDTM(DTM);
      end;

      Inc(Players[CurrentPlayer].Banked);
      CloseBank;
      MakeCompass('N');
      SetAngle(True);
    end;

    procedure WeStillChopping;   //idea from BH - Draynor Willow Cutter
    var
      T, CutTime, ChopX, ChopY: integer;
      TreeSetup: TTree;
    begin
      Flag;
      Wait(200 +Random(200)); //allows player more time to reach tree after flag disapears
      GetMousePos(ChopX, ChopY);

      if ((not (LoggedIn)) or (Invfull)) then
        Exit;

      TreeSetup := SetupTree;
      T := GetSystemTime;
      CutTime := TreeSetup.Cut + Random(10000); //how long to cut for
      MMouse(ChopX, ChopY, 2, 2);
      Write('Chopping Tree started');
      repeat
        if (not (FindBlackChatMessage('swing your hatchet'))) then   //if not this the w cut logs, so we do uptext check
          if (not (IsUpTextMultiCustom(TreeSetup.UpText))) then //if no uptext then we might have cut tree
            Break;

        Wait(500 + random(200));

        if (Invfull) then
          Break;

        Antiban;
      until ((GetSystemTime - T > CutTime) or (not LoggedIn))   //exit repeat if we reach cut time

      FindNormalRandoms;

      if (GetSystemTime - T > CutTime) then
        Writeln('Took longer then ' + IntToStr(CutTime) + ' to chop down the tree.');

      if (not (LoggedIn)) then
        Writeln('Player not logged in');

      if (Invfull) then
        WriteLn('Invfull starting banking');
    end;

    function CutTreesTPA: Boolean;       //Thanks to R!ch!e for explaining this. This is a mix of R!ch!e's M!ne MineOre Procedure and BH Draynor Willow Cutter FindWillowTPA
    var
      I, J: Integer;
      TreeTPA: TPointArray;
      TreeATPA: T2dPointArray;
      TreeSetup: TTree;
    begin
      if (not (LoggedIn)) then
        Exit;

      TreeSetup := SetupTree;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(TreeSetup.HMod, TreeSetup.SMod);

      try
        Write('Attempting to Find ' + TreeSetup.Tree);
        FindColorsSpiralTolerance(MSCX, MSCY, TreeTPA, TreeSetup.Col, MSX1, MSY1, MSX2, MSY2, TreeSetup.Tol);
        TreeATPA := SplitTPAEx(TreeTPA, 12, 12);    //TPAtoATPAex( 20, 20)
        if (DebugTheTPA) then
        begin
          DebugATPABounds(TreeATPA);
          Wait(2000);
        end;

        if (Length(TreeATPA) = 0) then
          Exit;

        SortATPAFromFirstPoint(TreeATPA, Point(MSCX, MSCY)); //sort TPA acording to main screen center point

        if (DebugTheTPA) then
        begin
          Write('ATPA After Sort');
          DebugATPA(TreeATPA, '');
        end;

        J := High(TreeATPA);
        for I := 0 to J do  //from 0 first entry in array to J highest entry
        begin
          MiddleTPAEx(TreeATPA[I], x, y);//find middle of array entry
          MMouse(x, y, 3, 3);
          Wait(300);
          if WaitUpTextMulti(TreeSetup.UpText, 400) then
          begin
            Mouse(x, y, 0, 0, True);
            Flag;
            Result := True;
            Exit;
            Wait(500 + Random(1500));
          end;
        end;
        FindNormalRandoms;
      finally
        SetColorSpeed2Modifiers(0.2, 0.2); // Sets the modifiers back to default, (0.2, 0.2).
        ColorToleranceSpeed(1);            // Sets the CTS back to the default, 1.
      end;
    end;

    procedure CutTrees;       //Thanks to R!ch!e for explaining procedure.
    var
      Fail: Integer;
      TreeSetup: TTree;
    begin
      if (not (LoggedIn)) then
        Exit;
      TreeSetup := SetupTree;
      Write('Attempting to Cut ' + TreeSetup.Tree);
      repeat
        if (not (CutTreesTPA)) then
        begin
          Write('Could not find tree Trying Failsafe Finder');
          if FindObj(x, y, TreeSetup.Tree, TreeSetup.Col, TreeSetup.Tol) then //use normal find object function as failsafe
          begin
            Write('Found ' + TreeSetup.Tree + ' using FindObj');
            Mouse(x, y, 0, 0, True);
          end else
          begin
            Write('Could not find ' + TreeSetup.Tree + ' using Colour or FindObj ');
            Inc(Fail);      //failsafe so ther is no infinate loop, after 15 fails script terminates
            Wait(1500 + Random(500)) //incase all trees are cut down ,otherwise its instant failsafe activation (increase if hight population of cutters)
            if (Fail > 15) then
            begin
              Write('Script failed to find ' + TreeSetup.Tree);
              Write('Even after 15 attempts');
              Fail := 0; //Resetting for next player
              LogoutWhy('Could not find tree');
            end;
          end;
        end;
        WeStillChopping;
      until((InvFull) or (not LoggedIn));

      if InvFull then
        Write('Inventory Full Banking');
    end;

    procedure TreeCutting;
    begin
      if (not (LoggedIn)) then
        Exit;

      repeat
        WalkToTrees;
        CutTrees;
        WalkToBank;
        BankIt;
      until (Players[CurrentPlayer].Banked >= (Players[CurrentPlayer].Integers[0])) or (not (LoggedIn));

      if (Players[CurrentPlayer].Banked >= Players[CurrentPlayer].Integers[0]) then
      begin
        LoadsDone := True;
        Write(Players[CurrentPlayer].Name + ' has finished: ' + IntToStr(Players[CurrentPlayer].Integers[0]) + ' Loads');
      end;
    end;

    procedure PlayerDone;
    begin
      if (not (LoggedIn)) then
        Exit;

      if (LoadsDone) then
      begin
        Write('All Logs have been cut Switching Players.');
        Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + TimeFromMark(Working);
        //ProgressReport;
        if (not (Players[CurrentPlayer].Booleans[1])) then
        begin
          Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + 'Player not set to attempt a re-run logging out'#13#10;
          Players[CurrentPlayer].Active := False;
          Logout;
        end else
          Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1]+'Re-Run set to true, will attempt another run'#13#10;
        Write('Progress Report');
        ProgressReport;
      end;
    end;

    procedure Main;
    begin
      repeat
        LoginPlayer;
        Wait(500);
        MarkTime(Working);
        CheckLevels;
        WriteLn('Woodcutting Level: ' + IntToStr(Players[CurrentPlayer].Integers[1]));
        WriteLn('Recommended training is ' + Players[CurrentPlayer].Strings[0]);
        SetupTree;
        Wait(500);
        SetAngle(True);
        TreeCutting;
        PlayerDone;
        CheckLogged;
      until(AllPlayersInactive)
    end;

    procedure Setup;
    begin
      SetUpSRL;
      DeclarePlayers;
    end;

    begin
      Setup;
      Wait(1000);
      Main;
      ProgressReport;
    end.
    Last edited by Dgby714; 10-01-2010 at 01:19 PM.

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  7. #32
    Join Date
    Sep 2010
    Location
    Northern Kentuckeh
    Posts
    759
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by bobzilla69 View Post
    Its the single yew west, just pass the fence above the 4 willows
    Is it a big no-no to use the ones to the east? I can't seem to find a WC script that supports those.

  8. #33
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Dgby714 View Post
    Fixed Standards and Some Changes
    Simba Code:
    program ForestExterminator;
    {$DEFINE SMART}
    {$I SRL\SRL.scar}
    {$I SRL\SRL\misc\Reports.scar}
    {$I SRL\SRL\misc\Debug.scar}

    {=========================================================================]
    [                                                                         ]
    [                                                                         ]
    [           NAME        : Forest Exterminator                             ]
    [           WRITER      : Bobzilla69                                      ]
    [           CATEGORY    : Woodcutting                                     ]
    [           DESCRIPTION : Cuts Trees/Oaks/Willows and Yews                ]
    [           USAGE       : Start in Draynor Bank,                          ]
    [                         with axe in inventory or equiped                ]
    [           NOTES       : There can be a problem with all trees being     ]
    [                         cut so it will log out due to not finding tree  ]
    [           CONTACT     : PM me on SRL-Forums or post in thread           ]
    [           THANKS      : I would like to Thank R!ch!e for exsplaining    ]
    [                         his MineOre procedure from M!ne used in my      ]
    [                         FindTreeTPA  and CutTreeprocedure and           ]
    [                         all other help R!ch!e provided.                 ]
    [                         Thanks to NCDS for helping me by suggesting     ]
    [                         a TPA walking method                            ]
    [                         Thanks to BobboHobbo for giving me an idea      ]
    [                         from your Draynor Willow cutter banker, used    ]
    [                         Changed ischopping to suite me.                 ]
    [                                                                         ]
    [=========================================================================]
    [                              Instructions                               ]
    [=========================================================================]
    [ 1. Have character in Draynor bank with axe equiped or in inventory      ]
    [ 2. Fill out DeclarePlayers.                                             ]
    [ (For further instructions on how to fill it out, visit this thread:     ]
    [   [url]http://www.villavu.com/forum/showthread.php?t=5410[/url])                   ]
    [ 3. Designed to be used with SMART and Simba                             ]
    [ 4. Start script and enjoy, dont forget to post a proggy!                ]
    [=========================================================================}


    var
      DebugTheTPA, DebugReport: boolean;


    procedure DeclarePlayers;
    var
      I: integer;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      DebugTheTPA := False;   //True if you want to see TPA debug
      DebugReport := False;   //This will include Debugs taken from script and incldude into proggress report(extending report alot)  not recommended for long runs, only for 1-3 loads

      with Players[0] do
      begin
        Name := '';           //Username
        Pass := '';           //Password
        Nick := '';           //3-4 non uppercase, number, or space characters on your username
        Pin := '';            //Bank Pin (Blank if none)
        Active := True;       //Player Active?
        Strings[0] := '';     //Tree that will be chopped (If blank will be AutoDetected)
        Integers[0] := 1;     //Loads to do
        Booleans[0] := False; //Do Breaks?
        Booleans[1] := False; //Rerun after Loads?
        Integers[1] := 0;     //Woodcutting Level (Use this if autodetection doesn't work!)
      end;

      {with Players[1] do
      begin
        Name := '';           //Username
        Pass := '';           //Password
        Nick := '';           //3-4 non uppercase, number, or space characters on your username
        Pin := '';            //Bank Pin (Blank if none)
        Active := True;       //Player Active?
        Strings[0] := '';     //Tree that will be chopped (If blank will be AutoDetected)
        Integers[0] := 1;     //Loads to do
        Booleans[0] := False; //Do Breaks?
        Booleans[1] := False; //Rerun after Loads?
        Integers[1] := 0;     //Woodcutting Level (Use this if autodetection doesn't work!)
      end;}


      for I := 0 to HowManyPlayers - 1 do
        with Players[I] do
        begin
          BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
          Strings[1] := '';
          Banked := 0;
          Worked := 0;
        end;
    end;

    {------------------------------------end of setup------------------------------}

    type
      TTree = record
        Col, Tol, Cut, Light: Integer;
        HMod, SMod: Extended;
        UpText: TStringArray;
        Tree: string;
    end;

    var
      Working: integer;
      x, y: integer;
      LoadsDone: boolean;

    //auto colors a selection of items
    function MyFindColor(What: string; Where:boolean): integer;   //on minimap(true) or main screen (false)
    var
      I, J, TheColor, Red, Green, Blue, color,
      bL, bH, gL, gH, rL, rH, colTol: integer;
      colorArray: TPointArray;
    begin
      case lowercase(What) of
        'bank': begin
            color := 5533565;
            bL := 77;
            bH := 91;
            gL := 104;
            gH := 117;
            rL := 118;
            rH := 131;
            colTol:= 11;    //use to alter tollerance
          end;
        'stall': begin
            color := 6184290;
            bL := 89;
            bH := 98;
            gL := 89;
            gH := 97;
            rL := 93;
            rH := 102;
            colTol:= 7;    //use to alter tollerance
          end;
        'water': begin
            color := 10983825;
            bL := 162;
            bH := 171;
            gL := 148;
            gH := 158;
            rL := 140;
            rH := 149;
            colTol:= 7;    //use to alter tollerance
          end;
        'road': begin
            color := 7237234;
            bL := 105;
            bH := 115;
            gL := 106;
            gH := 113;
            rL := 109;
            rH := 118;
            colTol:= 7;
          end;
        'rock': begin
            color := 5855833;
            bL := 85;
            bH := 93;
            gL := 86;
            gH := 94;
            rL := 85;
            rH := 93;
            colTol:= 6;
          end;
      end;
      Result := 0;

      if Where then
        FindColorsTolerance(colorArray, color, MMX1, MMY1, MMX2, MMY2, colTol)
      else
        FindColorsTolerance(colorArray, color, MSX1, MSY1, MSX2, MSY2, colTol);

      J := High(colorArray);
      for I := 0 to J do
        if ((rs_OnMinimap(colorArray[I].x, colorArray[I].y)) or (not (Where))) then
        begin
          TheColor := GetColor(colorArray[i].x, colorArray[i].y);
          ColorToRGB(TheColor, Red, Green, Blue);
          if (InRange(Blue, bL, bH) and InRange(Green, gL, gH) and InRange(Red, rL, rH)) then
          begin
            Result := TheColor;
            WriteLn(What + ' Colour Found: ' + IntToStr(TheColor));
            Exit;
          end;
        end;
    end;

    procedure Write(WhatsHappening: string); //idea from M!ne by R!ch!e
    begin
      Writeln(WhatsHappening);
      Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + WhatsHappening + #13#10;
    end;

    procedure LogoutWhy(Why: string);  //idea from BobboHobbo script
    begin
      Write(Why);
      //Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + Why + #13#10;
      Players[CurrentPlayer].Active := False; //Set player inactive
      Logout;
    end;

    function SetupTree: TTree;
    begin
      case Lowercase(Players[CurrentPlayer].Strings[0]) of
        'tree': begin
            with Result do         //Loads tree into Result: TTree;
            begin
              Col := 4025442;      //Colour
              Tol := 5;            //Tolerance
              Cut := 8000;         //Cut Time (This should not be here.... Use a function to detect cutting)
              Light := 8000;       //Light Time (Nether should this... Same as above)
              HMod := 0.04;        //Hue
              SMod := 1.57;        //Saturation
              UpText := ['hop down Tree', 'own Tree', 'ree']; //Uptext
              Tree := 'Tree';      //Name of Tree
            end;
          end;
        'oak': begin
            with Result do
            begin
              Col := 6202005;
              Tol := 5;
              Cut := 15000;
              Light := 8000;
              HMod := 0.10;
              SMod := 1.58;
              UpText := ['hop down Oak', 'own Oak', 'ak'];
              Tree := 'Oak';
            end;
          end;
        'willow': begin
            with Result do
            begin
              Col := 4088154;
              Tol := 4;
              Cut := 20000;
              Light := 8000;
              HMod := 0.25;
              SMod := 1.57;
              UpText := ['hop down Willow', 'own Willow', 'illow'];
              Tree := 'Willow';
            end;
          end;
        'yew': begin
            with Result do
            begin
              Col := 6070418;
              Tol := 10;
              Cut := 30000;
              Light := 8000;
              HMod := 0.13;
              SMod := 0.12;
              UpText := ['hop down Yew', 'own Yew', 'ew'];
              Tree := 'Yew';
            end;
          end;
      end;
    end;

    function LoadDTM(What: string): string;
    begin
      case LowerCase(What) of
        'log':   Result := 'mggAAAHicY2NgYBCEYhkglgBiNijmhdIcQCwOleMB4gQPLSDJhIFTGLADRhwYAgCmhgIF';                     //logs (max tolerance)
        'braxe': Result := 'mbQAAAHicY2VgYNBkYWBQBmIDINYFYnUgnsPIwDAbiOcB8SIgng/E9gYyQNVMKJiLARMwYsFgAABuXQSn';         //bronze axe
        'iaxe':  Result := 'mggAAAHicY2NgYLBjYmBwAGIXIHYGYmsgNgfit0C5V0D8Bog/APF7IH4NxJbm5kCSCQOzMmAHjDgwBAAA6D8H0w=='; //iron axe
        'blaxe': Result := 'mggAAAHicdcrbCgAQFETRQy6hk1Lk/7/ULt6wa83TBBFpKOiYGKgI8HCI55Ogqqy9ZHlnPnYLVU8A4Q==';         //black axe
        'saxe':  Result := 'mggAAAHicY2NgYNAGYl0gNgRiPSBWB2IVII4F4igonQTE8UAcDcThIcFAkgkDczFgB4w4MAQAAJOfBFE=';         //steel axe
        'maxe':  Result := 'mggAAAHicY2NgYFgOxAuAeBUQr4XSS4CYDYhZgZgFiNmBmAeIOYHY0NATSDJhYC4G7IARB4YAABIJBOM=';         //mithril axe
        'aaxe':  Result := 'mggAAAHicY2NgYDABYh0gNgdiSyhtAMRsQMwKxCxAzA7E3EDMCZK3B6lgwsAgtdgAIw4MAQDXOwIq';             //adamant axe
        'raxe':  Result := 'mggAAAHicY2NgYDgFxIeB+BwQXwDis0B8HIjZgJgViFmAmAOIeYCYE4itPfyAJBMG5mLADhhxYAgAAH10Bd0=';     //rune axe
      end;
    end;

    procedure ProgressReport;
    var
      I :integer;
    begin
      Writeln(#13#10);
      SRLProgressReport(ResultDebugBox, 'Forest Exterminator', 'Bobzilla69', '1.25',
                        ['TimeRunning', 'Active Players'],
                        [TimeRunning, PlayersActive]);
      SRLPlayerReport(ResultDebugBox, 0, false, [True, True, false, false, false, true], ['Tree Cutting'], [], [], [0], [] );
      Writeln(#13#10'Please post bugs and report at [url]http://villavu.com/forum/showthread.php?p=739347'#13#10);[/url]
      if (DebugReport) then
      begin
        for I := 0 to (HowManyPlayers - 1) do
        begin
          if (not (Players[I].Strings[1] = '')) then
          begin
            WriteLn(Players[I].Nick + #13#10'Debug of what happened'#13#10);
            WriteLn(Players[I].Strings[1]);
          end;
        end;
      end
    end;

    procedure ScriptTerminate;
    begin
      FreeSRLBitmaps;
      ProgressReport;
    end;

    procedure CheckLevels;
    begin
      Wait(200);
      if (not (LoggedIn)) then
        Exit;

      if (Players[CurrentPlayer].Integers[1] = 0) then
        Players[CurrentPlayer].Integers[1] := GetSkillInfo('woodcutting', True);

      case (Players[CurrentPlayer].Integers[1]) of
        1..14: Players[CurrentPlayer].Strings[0] := 'Tree';
        15..29: Players[CurrentPlayer].Strings[0] := 'Oak';
        30..59: Players[CurrentPlayer].Strings[0] := 'Willow';
        60..99: Players[CurrentPlayer].Strings[0] := 'Yew';
      end;
      Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + Players[CurrentPlayer].Strings[0] +' was auto detected to be trained on.'#13#10;
    end;

    procedure CheckLogged;
    var
      breakFor: integer;
    begin
      if (PlayersActive >= 1) then
      begin
        if (Players[CurrentPlayer].Integers[1] = 0) then
          Exit;
        Logout;
        if (Players[CurrentPlayer].Booleans[0]) then
        begin
          breakFor := 240000 + RandomRange(90000, 150000);
          Write('Taking Break for: ' + MsToTime(breakFor, Time_Short));
          Wait(breakFor);
        end;
      end;

      if (LoadsDone) then
      begin
        LoadsDone := False;
        Exit;
      end;

      if (not (LoggedIn)) then
      begin
        Write('Player not logged in Switching to next');
        Write('Choosing Next Player');
        Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + 'Player Failed, Please Post Proggress report and location logged out'#13#10;
        Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + TimeFromMark(working);
        Players[CurrentPlayer].Active := False;
        Logout;
      end;
    end;

    procedure AntiBan;
    var
      MousePos: TPoint;
    begin
      FindNormalRandoms;
      GetMousePos(MousePos.x, MousePos.y);

      case random(100) of //30% chance something will happen
        0..5: PickupMouse;
        10..15: HoverSkill('random', False);
        20..25: GameTab(RandomRange(tab_Combat, tab_Notes));
        30..35: Wait(500 + Random(1500));
        40..45: RandomAngle(1);
        50..55: BoredHuman;
      end;

      GameTab(Tab_Inv);
      MMouse(MousePos.x, MousePos.y, 2, 2);
    end;

    procedure WalkToBank;
    var
      MiddleOfTPA: TPoint;
      TPA: TPointArray;
      ATPA:  T2DPointArray;
      TreeSetup: TTree;
    begin
      if (not (LoggedIn)) then
        Exit;
      TreeSetup := SetupTree;
      Write('Walking to Bank from: ' + TreeSetup.Tree + '.');
      case LowerCase(TreeSetup.Tree) of
        'tree': begin
            //at trees, loking for rock at top right hand side. shoudl walk to above pen
            if FindColorsPie(TPA, MyFindColor('rock', True), 15, 0, 360, 5, 45, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              if (DebugTheTPA) then
                DebugTPA(TPA, '');
              Mouse(MiddleOfTPA.x - 10 , MiddleOfTPA.y + 55, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;

            //try to use stalls to place you near bank
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, 140, 240, 40, 70, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY) then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              if (DebugTheTPA) then
                DebugTPA(TPA, '');
              Mouse(MiddleOfTPA.x + 5, MiddleOfTPA.y + 8, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 2 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 2,  Logging out...');
              Exit;
            end;

            //should place in bank, using bankers as refrence
            if FindColorsPie(TPA, 1179390, 15, 90, 210, 35, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              if (DebugTheTPA) then
                DebugTPA(TPA, '');
              Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -3, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 3 Complete');
              FFlag(5);
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 3,  Logging out...');
              Exit;
            end;
          end;
        'oak': begin
            MakeCompass('N');
            //use rocks and offsetting to end up near pen
            if FindColorsTolerance(TPA, MyFindColor('rock', True), MMCX, MMY1, MMX2, MMCY, 15)then
            begin
              ATPA := SplitTPAEx(TPA, 8, 8);
              SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
              MiddleTPAEx(ATPA[0], x , y);
              Mouse(x + 30, y + 46, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
              Wait(3000);
              Flag;
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;

            //Stalls Middle to bank
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, 90, 230, 5, 55, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x + 5, MiddleOfTPA.y + 8, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 2 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 2,  Logging out...');
              Exit;
            end;

            //should place in bank, using bankers as refrence
            if FindColorsPie(TPA, 1179390, 15, 90, 210, 40, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -5, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 3 Complete');
              FFlag(5);
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 3,  Logging out...');
              Exit;
            end;
          end;
        'willow': begin
            MakeCompass('N');
            if FindColorsPie(TPA, 1179390, 15, 0, 60, 30, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -3, 5, 5, True);
              Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
              FFlag(5);
            end else
            begin
              LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;
          end;
        'yew': begin
          MakeCompass('N');
          if FindColorsPie(TPA, MyFindColor('rock', True), 15, 60, 180, 30, 60, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
          begin
            MiddleOfTPA:= MiddleTPA(TPA);
            Mouse(MiddleOfTPA.x - 15, MiddleOfTPA.y , 5, 5, True);
            Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 1 Complete');
            Flag;
          end else
          begin
            LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
            Exit;
          end;

          //use rocks and offsetting to end up near pen
          if FindColorsTolerance(TPA, MyFindColor('rock', True), mmcx, mmy1, mmx2, mmcy, 15)then
          begin
            ATPA := SplitTPAEx(TPA, 8, 8);
            SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
            MiddleTPAEx(ATPA[0], x , y);
            Mouse(x + 30, y + 46, 5, 5, True);
            Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 2 Complete');
            Wait(3000);  //in case flag go off map
            Flag;
          end else
          begin
            LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 2,  Logging out...');
            Exit;
          end;

          //Stalls Middle to bank
          if FindColorsPie(TPA, MyFindColor('stall', True), 15, 90, 230, 5, 55, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
          begin
            MiddleOfTPA := MiddleTPA(TPA);
            Mouse(MiddleOfTPA.x + 5, MiddleOfTPA.y + 8, 5, 5, True);
            Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 3 Complete');
            Flag;
          end else
          begin
            LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 3,  Logging out...');
            Exit;
          end;

          //should place in bank, using bankers as refrence
          if FindColorsPie(TPA, 1179390, 15, 90, 210, 40, 85, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
          begin
            MiddleOfTPA := MiddleTPA(TPA);
            Mouse(MiddleOfTPA.x + 8, MiddleOfTPA.y -5, 5, 5, True);
            Write('Walking to Bank from: ' + TreeSetup.Tree + '. Step 4 Complete');
            FFlag(5);
          end else
          begin
            LogoutWhy('Walking to bank from: ' + TreeSetup.Tree + '. Failed during Step 4,  Logging out...');
            Exit;
          end;
        end;
      end;
      Wait(500 + Random(500)); //screen settle
      Write('Walking to bank from: ' + TreeSetup.Tree + ' Complete.');
    end;

    procedure WalkToTrees;
    var
      MiddleOfTPA: TPoint;
      TPA: TPointArray;
      ATPA:  T2DPointArray;
      TreeSetup: TTree;
    begin
      if (not (LoggedIn)) then
        Exit;

      TreeSetup := SetupTree;
      Write('Walking to tree: ' + TreeSetup.Tree);
      case Lowercase(TreeSetup.Tree) of
        'tree': begin
            MakeCompass('N');
            //from bank to middle of stalls
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, -130, -25, 5, 70, mmx1, mmy1, mmcx, mmcy, mmcx, mmcy) then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 5, MiddleOfTPA.y , 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;

            //at stalls uses middle of stalls and offset to walk behind to pen
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, 0, 360, 5, 30, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA:= MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 10, MiddleOfTPA.y - 52, 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 2 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 2,  Logging out...');
              Exit;
            end;
          end;
        'oak': begin
            MakeCompass('N');
            //from bank to middle of stalls
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, -130, -25, 5, 70, mmx1, mmy1, mmcx, mmcy, mmcx, mmcy) then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 5, MiddleOfTPA.y , 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;

            //at stalls uses middle of stalls and offset to walk behind to pen
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, 0, 360, 5, 30, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA:= MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 10, MiddleOfTPA.y - 52, 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 2 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 2,  Logging out...');
              Exit;
            end;

            //rock near oak's to walk to oak's
            if FindColorsTolerance(TPA, MyFindColor('rock', True), MMX1, MMY1, MMCX, MMCY, 15)then
            begin
              ATPA := SplitTPAEx(TPA, 8, 8);
              SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
              MiddleTPAEx(ATPA[0], x , y);
              Mouse(x - 22, y + 24, 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 3 Complete');
              Wait(3000); //in case flag go off map
              Flag;
              Write('Walking Complete');
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 3,  Logging out...');
              Exit;
            end;
          end;
        'willow': begin
            MakeCompass('S');
            if FindColorsPie(TPA, MyFindColor('rock', True), 15, 0, 60, 50, 80, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY) then
            begin
              MiddleOfTPA:= MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 25, MiddleOfTPA.y + 15, 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;
          end;
        'yew': begin
            MakeCompass('N');
            //from bank to middle of stalls
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, -130, -25, 5, 70, mmx1, mmy1, mmcx, mmcy, mmcx, mmcy) then
            begin
              MiddleOfTPA := MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 5, MiddleOfTPA.y , 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 1 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 1,  Logging out...');
              Exit;
            end;

            //at stalls uses middle of stalls and offset to walk behind to pen
            if FindColorsPie(TPA, MyFindColor('stall', True), 15, 0, 360, 5, 30, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY)then
            begin
              MiddleOfTPA:= MiddleTPA(TPA);
              Mouse(MiddleOfTPA.x - 10, MiddleOfTPA.y - 52, 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 2 Complete');
              Flag;
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 2,  Logging out...');
              Exit;
            end;

            //rock near oak's to walk to oak's
            if FindColorsTolerance(TPA, MyFindColor('rock', True), MMX1, MMY1, MMCX, MMCY, 15)then
            begin
              ATPA := SplitTPAEx(TPA, 8, 8);
              SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));
              MiddleTPAEx(ATPA[0], x , y);
              Mouse(x - 22, y + 24, 5, 5, True);
              Write('Walking to Tree: ' + TreeSetup.Tree + '. Step 3 Complete');
              Wait(3000); //in case flag go off map
              Flag;
              Write('Walking Complete');
            end else
            begin
              LogoutWhy('Walking to Tree: ' + TreeSetup.Tree + '. Failed during Step 3,  Logging out...');
              Exit;
            end;
          end;
        end;
        Wait(500 + Random(500));
        Write('Walking to tree: ' + TreeSetup.Tree + ' Complete.');
    end;

    Function MyOpenBank: boolean;
    var
      TPA: TPointArray;
      ATPA:  T2DPointArray;
      I, J: integer;
    begin
      Result := BankScreen;
      if (Result) then
        Exit;
      MakeCompass('W');
      Wait(300);
      FindColorsTolerance(TPA, MyFindColor('bank', False), MSX1, MSY1, MSX2, MSCY, 5);
      ATPA := SplitTPAEx(TPA, 10, 10);
      SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
      J := High(ATPA);
      for I := 0 to J do  //from 0 first entry in array to highest entry in ATPA
      begin
        MiddleTPAEx(ATPA[I], x, y); //find middle of array entry
        MMouse(x, y, 2, 2);
        if WaitUpTextMulti(['ooth', 'ank booth'], 400) then
        begin
          Mouse(x, y, 0, 0, False);
          Wait(200);
          WaitOption('uickl', 400);
          Flag;
          Wait(2000 + Random(800));

          if (PinScreen) then
          begin
            InPin(Players[CurrentPlayer].Pin);
            Wait(100);
          end;

          Result := BankScreen;
        end;
      end;
    end;

    procedure BankIt;
    var
      BankLoop, DTM: integer;
    begin
      if (not (LoggedIn)) then
        Exit;

      BankLoop := 0;
      repeat
        Wait(300);
        Inc(BankLoop);
      until((BankLoop > 5) or (MyOpenBank))

      if (not (BankScreen)) then
        OpenBank('db', True, False);

      if ((BankLoop >= 5) or (not (BankScreen))) then
      begin
        LogoutWhy('Finding bank took more that 5 attempts, logging out');
        Exit;
      end;

      DTM := DTMFromString(LoadDTM('log'));
      try
        if FindDTM(DTM, x, y, MIX1, MIY1, MIX2, MIY2) then
        begin
          Mouse(x, y, 3, 3, False);
          ChooseOption('All'); //ChooseOption('All '+TreeSetup.Tree);
          Wait(1500 + Random(500)); //incase of lagg
        end else
          LogoutWhy('Logs not found in inventory logging out');
      finally
        FreeDTM(DTM);
      end;

      Inc(Players[CurrentPlayer].Banked);
      CloseBank;
      MakeCompass('N');
      SetAngle(True);
    end;

    procedure WeStillChopping;   //idea from BH - Draynor Willow Cutter
    var
      T, CutTime, ChopX, ChopY: integer;
      TreeSetup: TTree;
    begin
      Flag;
      Wait(200 +Random(200)); //allows player more time to reach tree after flag disapears
      GetMousePos(ChopX, ChopY);

      if ((not (LoggedIn)) or (Invfull)) then
        Exit;

      TreeSetup := SetupTree;
      T := GetSystemTime;
      CutTime := TreeSetup.Cut + Random(10000); //how long to cut for
      MMouse(ChopX, ChopY, 2, 2);
      Write('Chopping Tree started');
      repeat
        if (not (FindBlackChatMessage('swing your hatchet'))) then   //if not this the w cut logs, so we do uptext check
          if (not (IsUpTextMultiCustom(TreeSetup.UpText))) then //if no uptext then we might have cut tree
            Break;

        Wait(500 + random(200));

        if (Invfull) then
          Break;

        Antiban;
      until ((GetSystemTime - T > CutTime) or (not LoggedIn))   //exit repeat if we reach cut time

      FindNormalRandoms;

      if (GetSystemTime - T > CutTime) then
        Writeln('Took longer then ' + IntToStr(CutTime) + ' to chop down the tree.');

      if (not (LoggedIn)) then
        Writeln('Player not logged in');

      if (Invfull) then
        WriteLn('Invfull starting banking');
    end;

    function CutTreesTPA: Boolean;       //Thanks to R!ch!e for explaining this. This is a mix of R!ch!e's M!ne MineOre Procedure and BH Draynor Willow Cutter FindWillowTPA
    var
      I, J: Integer;
      TreeTPA: TPointArray;
      TreeATPA: T2dPointArray;
      TreeSetup: TTree;
    begin
      if (not (LoggedIn)) then
        Exit;

      TreeSetup := SetupTree;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(TreeSetup.HMod, TreeSetup.SMod);

      try
        Write('Attempting to Find ' + TreeSetup.Tree);
        FindColorsSpiralTolerance(MSCX, MSCY, TreeTPA, TreeSetup.Col, MSX1, MSY1, MSX2, MSY2, TreeSetup.Tol);
        TreeATPA := SplitTPAEx(TreeTPA, 12, 12);    //TPAtoATPAex( 20, 20)
        if (DebugTheTPA) then
        begin
          DebugATPABounds(TreeATPA);
          Wait(2000);
        end;

        if (Length(TreeATPA) = 0) then
          Exit;

        SortATPAFromFirstPoint(TreeATPA, Point(MSCX, MSCY)); //sort TPA acording to main screen center point

        if (DebugTheTPA) then
        begin
          Write('ATPA After Sort');
          DebugATPA(TreeATPA, '');
        end;

        J := High(TreeATPA);
        for I := 0 to J do  //from 0 first entry in array to J highest entry
        begin
          MiddleTPAEx(TreeATPA[I], x, y);//find middle of array entry
          MMouse(x, y, 3, 3);
          Wait(300);
          if WaitUpTextMulti(TreeSetup.UpText, 400) then
          begin
            Mouse(x, y, 0, 0, True);
            Flag;
            Result := True;
            Exit;
            Wait(500 + Random(1500));
          end;
        end;
        FindNormalRandoms;
      finally
        SetColorSpeed2Modifiers(0.2, 0.2); // Sets the modifiers back to default, (0.2, 0.2).
        ColorToleranceSpeed(1);            // Sets the CTS back to the default, 1.
      end;
    end;

    procedure CutTrees;       //Thanks to R!ch!e for explaining procedure.
    var
      Fail: Integer;
      TreeSetup: TTree;
    begin
      if (not (LoggedIn)) then
        Exit;
      TreeSetup := SetupTree;
      Write('Attempting to Cut ' + TreeSetup.Tree);
      repeat
        if (not (CutTreesTPA)) then
        begin
          Write('Could not find tree Trying Failsafe Finder');
          if FindObj(x, y, TreeSetup.Tree, TreeSetup.Col, TreeSetup.Tol) then //use normal find object function as failsafe
          begin
            Write('Found ' + TreeSetup.Tree + ' using FindObj');
            Mouse(x, y, 0, 0, True);
          end else
          begin
            Write('Could not find ' + TreeSetup.Tree + ' using Colour or FindObj ');
            Inc(Fail);      //failsafe so ther is no infinate loop, after 15 fails script terminates
            Wait(1500 + Random(500)) //incase all trees are cut down ,otherwise its instant failsafe activation (increase if hight population of cutters)
            if (Fail > 15) then
            begin
              Write('Script failed to find ' + TreeSetup.Tree);
              Write('Even after 15 attempts');
              Fail := 0; //Resetting for next player
              LogoutWhy('Could not find tree');
            end;
          end;
        end;
        WeStillChopping;
      until((InvFull) or (not LoggedIn));

      if InvFull then
        Write('Inventory Full Banking');
    end;

    procedure TreeCutting;
    begin
      if (not (LoggedIn)) then
        Exit;

      repeat
        WalkToTrees;
        CutTrees;
        WalkToBank;
        BankIt;
      until (Players[CurrentPlayer].Banked >= (Players[CurrentPlayer].Integers[0])) or (not (LoggedIn));

      if (Players[CurrentPlayer].Banked >= Players[CurrentPlayer].Integers[0]) then
      begin
        LoadsDone := True;
        Write(Players[CurrentPlayer].Name + ' has finished: ' + IntToStr(Players[CurrentPlayer].Integers[0]) + ' Loads');
      end;
    end;

    procedure PlayerDone;
    begin
      if (not (LoggedIn)) then
        Exit;

      if (LoadsDone) then
      begin
        Write('All Logs have been cut Switching Players.');
        Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + TimeFromMark(Working);
        //ProgressReport;
        if (not (Players[CurrentPlayer].Booleans[1])) then
        begin
          Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1] + 'Player not set to attempt a re-run logging out'#13#10;
          Players[CurrentPlayer].Active := False;
          Logout;
        end else
          Players[CurrentPlayer].Strings[1] := Players[CurrentPlayer].Strings[1]+'Re-Run set to true, will attempt another run'#13#10;
        Write('Progress Report');
        ProgressReport;
      end;
    end;

    procedure Main;
    begin
      repeat
        LoginPlayer;
        Wait(500);
        MarkTime(Working);
        CheckLevels;
        WriteLn('Woodcutting Level: ' + IntToStr(Players[CurrentPlayer].Integers[1]));
        WriteLn('Recommended training is ' + Players[CurrentPlayer].Strings[0]);
        SetupTree;
        Wait(500);
        SetAngle(True);
        TreeCutting;
        PlayerDone;
        CheckLogged;
      until(AllPlayersInactive)
    end;

    procedure Setup;
    begin
      SetUpSRL;
      DeclarePlayers;
    end;

    begin
      Setup;
      Wait(1000);
      Main;
      ProgressReport;
    end.
    Cheers for that, it looks nice.

    as for the
    Simba Code:
    Cut := 8000;         //Cut Time (This should not be here.... Use a function to detect cutting)

    that is used as a timer so that it has a added failsafe.

    i have kinda stopped working on this seeing as there are no progress reports and not many downloads.

    i will take what you have done in here though as extra training.

    and again thanks for taking your time to read through and make changes

    Edit: Also blame Minecraft for my lack of doing anything productive

  9. #34
    Join Date
    Sep 2010
    Location
    Oxford, Michigan
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lol minecraft is very very addicting and sorry I haven't been on lately to test the script I have been trying to get over the flu and haven't had much energy to do anything other than my schoolwork.

  10. #35
    Join Date
    Aug 2010
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Whenever I use this it will randomly stop and a new tab will open up in simba that says antirandom. I just close that tab and start it again but it happens like every 20 minutes. How can i fix this??

  11. #36
    Join Date
    Sep 2010
    Location
    Oxford, Michigan
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Peek XD View Post
    Whenever I use this it will randomly stop and a new tab will open up in simba that says antirandom. I just close that tab and start it again but it happens like every 20 minutes. How can i fix this??
    This is the same problem I have been having lately just to let you know bobzilla.

  12. #37
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Peek XD View Post
    Whenever I use this it will randomly stop and a new tab will open up in simba that says antirandom. I just close that tab and start it again but it happens like every 20 minutes. How can i fix this??
    Quote Originally Posted by dhandley12 View Post
    This is the same problem I have been having lately just to let you know bobzilla.
    when it opens the new tab, it will stop the script and also write an error, this would be helpful to have so see whats wrong.

    i sounds like there is a problem with antirandoms, but need more info

  13. #38
    Join Date
    Aug 2010
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This is the error message that comes up.

    Error: Exception: The given DTM Index[0] doesn't exist at line 330
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
    File[C:\Simba\Includes\SRL/logs/SRL log 02-10-10 15.txt] has not been freed in the script, freeing it now.

  14. #39
    Join Date
    Aug 2007
    Location
    USA
    Posts
    370
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    such an amazing script. using now with SMART love it, will post proggie!
    It must have been the ganja?

  15. #40
    Join Date
    Sep 2010
    Location
    Oxford, Michigan
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It says:

    Error: Exception: The given DTM Index[0] doesn't exist at line 330
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
    File[C:\Simba\Includes\SRL/logs/SRL log 02-10-10 0.txt] has not been freed in the script, freeing it now.

    It also highlights line 330 of the Anti randoms tab.

  16. #41
    Join Date
    Oct 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hey i dont get this i tried downloading but it says i have to find it first but i hit find and nothing happend so if u can help plz do i need a wc bot

  17. #42
    Join Date
    Oct 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default how can i download files i open them and it says i have to find the file help?

    hi well im new and i need help plz help me

  18. #43
    Join Date
    Nov 2008
    Posts
    258
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by ballerz View Post
    hey i dont get this i tried downloading but it says i have to find it first but i hit find and nothing happend so if u can help plz do i need a wc bot
    It's not really clear what your asking, so I'm just going to assume that you probably haven't set up simba/srl/reflection properly, why don't you check out some other threads on proper set up

    If you're still having trouble again later!

  19. #44
    Join Date
    Nov 2010
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice script!
    Testing it out now. Will post soon.

    Edit: A couple banks into the script I got the same error as dhandley. :\
    Last edited by Kehmist; 11-06-2010 at 08:53 AM.

  20. #45
    Join Date
    Nov 2010
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Geting error , its cuting about 300-400 logs and geting error

  21. #46
    Join Date
    Oct 2008
    Posts
    34
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    Walking to Yews is messed up, it falls short. Walks to just above the pigs and doesn't find the rocks. I've been messing with it to get it walk a little better and it works most times now but not always. Also, it logs out because yews take so long to re-spawn. Other than that, pretty good script. I've been tweaking it, but you managed to take me from level 10 to level 67 in a fairly short period of time.

    Code:
    Script failed to find Yew
    Even after 15 attempts
    Could not find tree
    Player not logged in Switching to next
    Choosing Next Player
    
    
    [==========================================]
    [ Forest Exterminator 1.25                 ]
    [              by Bobzilla69               ]
    [==========================================]
    [ TimeRunning    : 6 Minutes And 4 Seconds ]
    [ Active Players : 0                       ]
    [==========================================]
    [         Forest Exterminator 1.25         ]
    [==========================================]
    [=========================================================]
    [ Nick | Active | Worked   | Banked | Rand | Tree Cutting ]
    [=========================================================]
    [ ake  | False  | 00:12:05 | 0      |      | Yew          ]
    [=========================================================]

Page 2 of 2 FirstFirst 12

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
  •