Results 1 to 5 of 5

Thread: my new improved woodcutter :)

  1. #1
    Join Date
    Sep 2006
    Location
    England, Nr Manchester
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    my new improved woodcutter :)

    After all the help i got after posting my first little script i managed to improve alot on it.

    to some extent it can be left woodcutting and will drop all logs after its got a full invent. works anywere that there are a group of trees.

    btw it only has little anti randoms, i would like some help there, so i wouldn't leave it unattended or anything yet cansider it a beta test

    SCAR Code:
    //----------------------------------------------------------------------------//
    //                         Simple WoodCutter                                  //
    //                          By Pupp3tMast3r                                   //
    //----------------------------------------------------------------------------//
    program WoodCutter;

    {.include SRL\SRL.scar}
    {.include SRL\SRL\Extended\xMapWalk.scar}
    {.include SRL\SRL\Skill\Woodcutting.scar}
    Var
      xx, yy, LogsCut: Integer;
    Var
      TreeChk1, TreeChk2: String;

    //-------------------------------:Set up begin:-------------------------------//
    Const
      TreeColor1 = 2908240;
      TreeColor2 = 793110;
      TreeColor3 = 5079160;
    //--------------------------------:Setup end:---------------------------------//

    Procedure AntiIdle; //Avoids idle status
    begin
      Case (Random(7)) of
      0: AntiBan;
      1: RandomRClick;
      2: PickUpMouse;
      3: HoverSkill('WoodCutting', False);
      4: PickUpMouse;
      5: RandomRClick;
      6: BoredHuman;
      7: BoredHuman;
      end;
    end;
    //----------------------------------------------------------------------------//

    Procedure AntiRand; //Basic anti random procedure
    begin
      FindNormalRandoms;
      If (FindFight) Then
      begin
        RunAwayDirection('N');
        Wait2(9000 + Random(2001), True);
        RunBack;
      end;
    end;
    //----------------------------------------------------------------------------//

    Function FindTree(Var xx, yy: Integer; TColor1, TColor2, TColor3: Integer): Boolean; //Finds and checks for tree with increasing tolerance.
    Var
      Tol, Times: Integer;
    begin
      Tol:= 0;
      Times:= 0;
      For Times:= 1 to 4 do
      begin
        If (FindColorSpiralTolerance(xx, yy, TColor1, 5, 5, 514, 337, Tol))
        or (FindColorSpiralTolerance(xx, yy, TColor2, 5, 5, 514, 337, Tol))
        or (FindColorSpiralTolerance(xx, yy, TColor3, 5, 5, 514, 337, Tol)) Then
         begin
            Wait(400 + random(601));
            MMouse(xx, yy, 1, 1);
            If (IsUpText(TreeChk1) or IsUpText(TreeChk2)) Then
            begin
              Result:= True;
              Exit;
            end;
          end;
        Tol:= Tol + 5;
        Times:= Times + 1;
        Wait(300 + Random(301));
      end;
    end;
    //----------------------------------------------------------------------------//

    Function ChopTree: Boolean;
    Var
      StartTime, StopTime: integer;
    begin
      If (FindTree(xx, yy, TreeColor1, TreeColor2, TreeColor3)) Then
      begin

        Mouse(xx, yy, 0, 0, True);
       
        MarkTime(StartTime);
        Repeat
          AntiRand;
          Wait2(1500 + Random(1501), True);
          AntiIdle;
          MarkTime(StopTime);
          If (StartTime + 35000 < StopTime) Then Break;
        Until (InChatMulti('get', 'log', 'ogs'));
       
        If (InChatMulti('get', 'log', 'ogs')) Then
        begin
          Result:= True;
          LogsCut:= LogsCut + 1;
          Writeln('You have cut ' + IntToStr(LogsCut) + ' Logs!');
        end;
      end;
    end;
    //----------------------------------------------------------------------------//

    //-------------------------------Main Loop------------------------------------//
    begin
      SetupSRL;
      DisguiseScar('My Documents');
      ActivateClient;
     
      TreeChk1:= 'tre';
      TreeChk2:= 'ree';
      LogsCut:= 0;
     
      SetChat('off', 1);
      Wait(500 + Random(1001)
      SetChat('friends', 2);
      Wait(500 + Random(1001)
      SetChat('off', 3);
      Wait(500 + Random(1001)
      PerfectNorth;
     
      Repeat
     
        Repeat
        ChopTree;
        until(InventoryFull);
       
      DropAllLogs;
      Until(False);
    end.

    please help with naything you see needs improving on. im going to turn this into a proper SRL script(with logging in and out etc) when i know i have the cutting sorted.

    thanx to any one who helps or who helped me last time

  2. #2
    Join Date
    Sep 2006
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Looks good. Although I wouldn't put set the TreeChk1 and 2 in the main loop. Put it as a constant, and it will automatically be a string.
    SCAR Code:
    const
      TreeChk1 := 'tre'
      TreeChk2 := 'ree'

    I wouldn't set public chat off unless it cant work without it off. Because generally you can have anti-ban measures with chat on.

  3. #3
    Join Date
    Feb 2006
    Location
    L.A, USA
    Posts
    1,632
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You should add this constant

    Code:
    Nick = ''; //3 or 4 Letters of username
    SRL finds many randoms through scanning for part of your name on the screen.

    In the mainloop put.

    Code:
    NickNameBMP := CreateBitmapMaskFromText(Nick, UpChars);
    Therefore a bitmapmask of part of username is created so the anti- randoms can work properly.

    There is also this method.

    Code:
    Procedure DeclarePlayers;
    Begin
         HowManyPlayers  := 1;
         NumberOfPlayers( HowManyplayers );
         CurrentPlayer := 0;
    
         Players[0].Name := 'Usernamse';
         Players[0].Pass := 'pass';
         Players[0].Nick := 'sern';
         players[0].active:=true;
    end;
    In the mainloop have DeclarePlayers; and LoginPlayer; LoginPlayer also creates the bitmapmask.

    Btw, good job. Very clean and organized. Nice little script.

  4. #4
    Join Date
    Sep 2006
    Location
    England, Nr Manchester
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanx alot for your help i'm starting to write a proper script now ill rembers what you said.

    and @whiteShadow - wondered why the antirandoms dind't seem to be working too well thanx

  5. #5
    Join Date
    Feb 2006
    Location
    L.A, USA
    Posts
    1,632
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Pupp3tMast3r View Post
    Thanx alot for your help i'm starting to write a proper script now ill rembers what you said.

    and @whiteShadow - wondered why the antirandoms dind't seem to be working too well thanx
    Yea many people complain about that.. when really the scripter didn't even implement it or, the script user left Nick '' blank, or incorrectly set that up.

    It's nice that you know now!

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
  •