Results 1 to 7 of 7

Thread: Draynor normal tree cutter and banker

  1. #1
    Join Date
    Dec 2011
    Posts
    41
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default Draynor normal tree cutter and banker

    This Script cuts normal trees in draynor village and banks them. Start script at Draynor bank. Script may walk far from bank, but it should walk back to bank when inventory is full. If you have high woodcutting level, you can change line 123 wait option to lower number, like 1000, so it cuts trees faster. enjoy and post if any bugs in script
    DraynorNormalTrees.simba

  2. #2
    Join Date
    Feb 2012
    Location
    Canada
    Posts
    1,164
    Mentioned
    26 Post(s)
    Quoted
    433 Post(s)

  3. #3
    Join Date
    Sep 2012
    Location
    Australia.
    Posts
    839
    Mentioned
    16 Post(s)
    Quoted
    225 Post(s)

    Default

    Had a read through, there's some weird waits in there that don't need to be that long which is potentially slowing the script down.

    Also, I ran the script through the parser. Here's a standardised version:

    Simba Code:
    program DraynorTreeCutter;
    {$DEFINE SMART}
    {$I SRL/SRL.simba}
    {$i sps/sps.simba}
    (******************************************************************************
    Simple Draynor Tree Cutter by wayiyi.
    Script cuts trees at Draynor Village and banks at Draynor.
    Start at Draynor bank or at trees.
    ******************************************************************************)

    var
      x, y, TooLong: Integer;

    procedure DeclarePlayers;
    var
      i: integer;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      begin
        Players[0].Name := '';
        Players[0].Pass := '';
        Players[0].Nick := '';
        Players[0].Active := True;
      end;
    end;

    procedure Login;
    begin
      SRL_SixHourFix := true;
      Smart_FixSpeed := True;
      ClearDebug;
      SetupSRL;
      DeclarePlayers;
      LoginPlayer;
      wait(5000);
    end;

    procedure StatsGuise(wat: string);
    begin
      Status(wat);
      Disguise(wat);
    end;

    procedure Antiban;
    begin
      case Random(250) of
        0:
          begin
            StatsGuise('AntiBan') GameTab(tab_stats) Hoverskill('Mining', False) GameTab(28)
          end;
        1:
          begin
            StatsGuise('AntiBan') SleepAndMoveMouse(7000 + Random(500));
          end;
        2:
          begin
            StatsGuise('AntiBan') GameTab(tab_Inv) ExamineInv;
            GameTab(28);
          end;
        3:
          begin
            StatsGuise('AntiBan') GameTab(Tab_Stats);
            Wait(3000 + Random(500));
            GameTab(28);
          end;
        4:
          begin
            StatsGuise('AntiBan') GameTab(tab_Stats) HoverSkill('random', False);
            GameTab(28);
          end;
      end;
    end;

    procedure FailSafe(Reason: string);
    begin
      Players[CurrentPlayer].Loc := Reason;
      Logout;
      Stats_Commit;
      Writeln(Reason);
      TerminateScript;
    end;

    procedure WalkToTrees;
    var
      myPath: TPointArray;
    begin
      FindNormalRandoms;
      MakeCompass('N');
      SPS_Setup(runescape_surface, ['10_8']);
      myPath := [Point(4164, 3610), Point(4141, 3605), Point(4124, 3583), Point(4114, 3561), Point(4113, 3541)];
      SPS_WalkPath(myPath);
      Wait(RandomRange(650, 1000));
    end;

    function treeColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.10, 1.01);
      if not (FindColorsTolerance(arP, 3492438, MSX1, MSY1, MSX2, MSY2, 5)) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
      for i := 0 to arL do
      begin
        Result := arC[i];
        Writeln('AutoColor = ' + IntToStr(arC[i]));
        Break;
      end;
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    procedure Tree;
    var
      x, y: integer;
    begin
      MakeCompass('N');
      SetAngle(SRL_ANGLE_HIGH);
      repeat
        if (not (LoggedIn)) then
          Exit;
        wait(700 + random(500));
        FindNormalRandoms;
        if FindObj(x, y, 'ree', TreeColor, 5) then
        begin
          Mouse(x, y, 2, 2, false);
          ChooseOption('hop down');
          wait(6760 + random(1000));
        end;
        repeat
          AntiBan;
          wait(476 + random(1000));
        until not IsUpText('ree') or (InvFull);
      until (InvFull);
    end;

    procedure WalkToBanker;
    var
      myPath: TPointArray;
    begin
      SPS_Setup(RUNESCAPE_SURFACE, ['10_8']);
      myPath := [Point(4357, 3266), Point(4357, 3273), Point(4354, 3293), Point(4332, 3323), Point(4304, 3321), Point(4287, 3314), Point(4302, 3361), Point(4306, 3390), Point(4269, 3364), Point(4260, 3332), Point(4237, 3314), Point(4192, 3314), Point(4152, 3313), Point(4121, 3312), Point(4148, 3351), Point(4185, 3352), Point(4217, 3369), Point(4169, 3396), Point(4143, 3401), Point(4126, 3416), Point(4132, 3460), Point(4119, 3490), Point(4117, 3515), Point(4127, 3536), Point(4111, 3562), Point(4124, 3587), Point(4136, 3604), Point(4161, 3615), Point(4165, 3629)];
      SPS_WalkPath(myPath);
      wait(2000 + random(1500));
    end;

    procedure BankToGo;
    var
      x, y: integer;
    begin
      MakeCompass('W');
      if FindObj(x, y, 'ank', 5661539, 5) then
      begin
        Mouse(x, y, 2, 2, True);
        ChooseOption('ank');
        wait(8000 + random(1500));
      end;
    end;

    procedure Banking;
    var
      i: Integer;
    begin
      FindNormalRandoms;
      begin
        InvMouse(10, Mouse_right);
        Wait(RandomRange(999, 200));
        ChooseOption('ll');
        Wait(RandomRange(999, 200));
        CloseBank;
        Wait(randomRange(1000, 200));
      end;
    end;

    procedure MainLoop;
    begin
      WalkToTrees;
      TreeColor;
      Tree;
      WalkToBanker;
      Banktogo;
      Banking;
    end;

    begin
      SRL_SixHourFix := True;
      Smart_FixSpeed := True;
      SetupSRL;
      DeclarePlayers;
      LoginPlayer;
      repeat
        WalkToTrees;
        TreeColor;
        Tree;
        WalkToBanker;
        Banktogo;
        Banking;
      until (false);
    end.

  4. #4
    Join Date
    Feb 2012
    Location
    Canada
    Posts
    1,164
    Mentioned
    26 Post(s)
    Quoted
    433 Post(s)

    Default

    Yeah. The reading was a bit difficult, but Chris' post and how he added the indents, used multiple lines, and fixed a bit of the waits are all useful for you. One thing to really do is look at other scripts and see how they make it appealing to the eyes.

    It should be an easy read! XD

    So, I took a quick glance through it and noticed a few things...


    I didnt see any place where you used your FailSafe procedure. Do you plan on it or did I miss something?

    Same with your MainLoop. I only see the procedure written out and not used.

    Also, another pointer. What you could do is take your paths for SPS and put them into a single procedure. So something like this:

    Simba Code:
    procedure Paths;
    begin
      ToTrees := [Point(4164, 3610), Point(4141, 3605), Point(4124, 3583), Point(4114, 3561), Point(4113, 3541)];
      ToBanker := [Point(4357, 3266), Point(4357, 3273), Point(4354, 3293), Point(4332, 3323), Point(4304, 3321), Point(4287, 3314), Point(4302, 3361), Point(4306, 3390), Point(4269, 3364), Point(4260, 3332), Point(4237, 3314), Point(4192, 3314), Point(4152, 3313), Point(4121, 3312), Point(4148, 3351), Point(4185, 3352), Point(4217, 3369), Point(4169, 3396), Point(4143, 3401), Point(4126, 3416), Point(4132, 3460), Point(4119, 3490), Point(4117, 3515), Point(4127, 3536), Point(4111, 3562), Point(4124, 3587), Point(4136, 3604), Point(4161, 3615), Point(4165, 3629)];                                
    end;

    Or

    If you wanted, you could add a walking failsafe which could include SPS_BlindWalk. It walks to a close area and all you need is a map image and the a single point. XD


    Other than those, it looks pretty good! Is this your first script?

  5. #5
    Join Date
    Dec 2011
    Posts
    41
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    I dont have much experience of scripting so script may not be perfect. And this is my third public script after powerminer and oak chopper

  6. #6
    Join Date
    Feb 2012
    Location
    Canada
    Posts
    1,164
    Mentioned
    26 Post(s)
    Quoted
    433 Post(s)

    Default

    Quote Originally Posted by wayiyi View Post
    I dont have much experience of scripting so script may not be perfect. And this is my third public script after powerminer and oak chopper
    That is perfectly O.K. You can always keep learning!

  7. #7
    Join Date
    Jun 2013
    Posts
    29
    Mentioned
    0 Post(s)
    Quoted
    19 Post(s)

    Default

    could you make this script turn the screen so it can locate the trees better? it keep getting stuck between 2 oak trees and cant find anymore regular trees to cut, doesnt happen all the time but this would be great to fix. it seems to only turn the screen while banking.

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
  •