Results 1 to 9 of 9

Thread: First Script pointers needed

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

    First Script pointers needed

    Hi, this si the first script I've wrote, Big Grin but all it does is find a tree and clicks it. Embarrassed

    I'd like to know were to go from here, how do i repeat my procedure 'CutTree' but only get it to start the loop again when i know the other tree has finnished beaing cut???

    Alsoso were would i put in the script +1 the my unused 'TreesCut' variable, so that even if i modified this later to cut, say yews which you can get more than one log from befor the tree goes or no logs atall?

    SCAR Code:
    program WoodCutter;
    {.include SRL\SRL.scar}
     
    Var
      LogsCut: Integer;
     
    //----------------Set up begins--------------\\
    Const
      TreeColor1 = 2908240;
      TreeColor2 = 793110;
      TreeColor3 = 5079160;
    //----------------Setup ends------------------\\
     
    Procedure RealClick(x,y: Integer; Left: Boolean); //Left or Right click mouse (Human like)
    begin
      Wait(400+random(356));
      Holdmouse(x, y, Left);
      Wait(40 + random(31));
      ReleaseMouse(x, y, Left);
      Wait(400 +random(601));
    end;
     
    Procedure CutTree(TColor1, TColor2, TColor3: Integer); //Finds and clicks tree
    begin
        If (FindColorSpiralTolerance(x, y, TColor1, 5, 5, 514, 337, 20))
        or (FindColorSpiralTolerance(x, y, TColor2, 5, 5, 514, 337, 20))
        or (FindColorSpiralTolerance(x, y, TColor3, 5, 5, 514, 337, 20)) Then
          begin
            Wait(900 + random(601));
            MMouse(x, y, 3, 3);
            GetMousePos(x, y);
              If (IsUpText('Chop')) Then
                RealClick(x, y, True);
          end;
    end;
     
    begin
      SetupSRL;
      DisguiseScar('My Documents');
      ActivateClient;
      CutTree(TreeColor1, TreeColor2, TreeColor3);
    end.

    Thanx for any help, any other pointers would also be appriciated.

  2. #2
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    I'm not sure did you meaned this...


    SCAR Code:
    program WoodCutter;
    {.include SRL\SRL.scar}

    Var
      LogsCut: Integer;

    //----------------Set up begins--------------\\
    Const
      TreeColor1 = 2908240;
      TreeColor2 = 793110;
      TreeColor3 = 5079160;
    //----------------Setup ends------------------\\

    Procedure RealClick(x,y: Integer; Left: Boolean); //Left or Right click mouse (Human like)
    begin
      Wait(400+random(356));
      Holdmouse(x, y, Left);
      Wait(40 + random(31));
      ReleaseMouse(x, y, Left);
      Wait(400 +random(601));
    end;

    Procedure CutTree(TColor1, TColor2, TColor3: Integer); //Finds and clicks tree
    begin
        If (FindColorSpiralTolerance(x, y, TColor1, 5, 5, 514, 337, 20))
        or (FindColorSpiralTolerance(x, y, TColor2, 5, 5, 514, 337, 20))
        or (FindColorSpiralTolerance(x, y, TColor3, 5, 5, 514, 337, 20)) Then
          begin
            Wait(900 + random(601));
            MMouse(x, y, 3, 3);
            GetMousePos(x, y);
              If (IsUpText('Chop')) Then
                RealClick(x, y, True);
          end;
    end;

    Procedure Setup;
    Begin
     SetupSRL;
     DisguiseScar('My Documents');
     FindRs;
     ActivateClient;
     End;
     
    begin
      Setup;
      Repeat
      CutTree(TreeColor1, TreeColor2, TreeColor3);
      Until(false)
    end.


  3. #3
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    This is just off the top of my head theory, and wont work with trees that you get more than 1 log from. There are better ways to do what you want but its something to think about while you wait for someone else to post.

    SCAR Code:
    repeat
      cuttree                           //your cuttree proc
      repeat
        wait(10);                      //how often it checks whether tree has been cut
      until(TreeHasBeenCut):    //see below
    until(PutAFailSafeHere);     //when you it to stop

    TreeHasBeenCut would be a function that checks if there are more logs in your inventory than when you started cutting the current tree. This means you would have a global variable to keep track of how many there are by either updating it whenever you drop/burn/fletch/bank and cut/pickup/withdraw any (more useful), or count how many there are in the inventory before and after cutting (easier).

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

    Default

    what i mean is, if i left my woodcutting prcedure inside a loop as it is now, like repeat until(false), it would not finnish cutting a tree befor it found another one and run of to cut that

    i want it to make sure its got a log, plus one to my variable and then check if there is still a tree infront of him??

    would i get the mouse to stay put while cutting and wait until isuptext = false??? or would that be far too detectable

    thanx for the help everyone

  5. #5
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    This is taken directly from Ratz!. IMHO these are good woodcutting (Treecutting) procs.

    I use a FindDeformed method. Observe the Tree Bitmap (8 * 1) It is in fact a tiny "slice" from a tree. I compare this using scar's FindDeformedBitmapToleranceIn. Works smooth. (OpenBankQuiet uses this too...)
    These kind of methods (FindDeformed, FindObjectDeformed) are good for static objects. They avoid wacky mousemovements, albeit they are a little laggy...
    The Treecutting loop also relies on the text messages (Uptext en InChatMulti) to handle treecutting.

    General rule of thumb is to use multiple techniques (Color and Bitmap and Text) to create a good cycle.


    SCAR Code:
    Tree:= BitmapFromString(8, 1, '68783458583D383824' +
           '707834485022687834384822586036');


    function FindTreeDeformed(var ObjX, ObjY :integer; UpText1, UpText2: String; BMP, a, b, c, d: integer): Boolean;
    var
      acc, ref : Extended;
    var
      XT, YT,times,tol : Integer;
    begin
      ref:=0.9; tol:=0;
      for times:=1 to 4 do
      begin
        FindDeformedBitmapToleranceIn(BMP, XT, YT, a, b, c, d, tol, 2, True, acc);
        if (acc >= ref) then
        begin
          MMouse(XT+8,YT,0,0);
          if (IsUpText(UpText1) or IsUpText(UpText2)) then
          begin
            ObjX:=XT;
            ObjY:=YT;
            Result := True;
            Exit;
          end;
        end;
        ref := ref - 0.1;
        tol:=tol+10;
        FTWait(1);
      end;
    end;

    //----------------------------------------------------------------------------//

    function ChopTree : Boolean;
    var CX, CY, RT, ChopTime, StopTime, ChP : Integer;
    begin
      if ( FindTreeDeformed(CX, CY, 'Tre' , 'ree', Tree, MSX1,MSY1,MSX2,MSY2 )) then
      begin
        Mouse ( CX+20, CY, 10, 0, True );
        FindBirdsNest;
        FlagFTWait;
        FTWait(4);
        if not InChatMulti('wing','axe','ree') then
        begin
          Result:=False;
          Exit;
        end;

        MarkTime ( ChopTime );
        repeat
          MarkTime ( StopTime );
          FTWait(5);
           if ( ChopTime+15000 < StopTime  ) then Break;
          ChP:=ChP+1;
          if FawkiDebug then writeln('Chop pass:'+IntToStr(ChP));
          if InChatMulti('adv','atu','ance')  then Exit;
        until ( InChatMulti('get','log','ogs') );
        if InChatMulti('get','log','ogs') then
        begin
          Result := True;
          TreeCount:=TreeCount+1;
        end;
      end;
    end;
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

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

    Default

    Theres alot of info there Fawaki thanx, although it's slightly over my head.

    would someone plz explain the "if not InChatMulti('wing','axe','ree') then..." in a little more depth(maning not so much what it does but more so why it is used here) and why there is a need to search IsUpText for "ree" would solely Tree not do or even 'shop'

    thanx yet again everyone for all the help

    *goes to dry run the script from Fakawi's post and make more sense of it*

  7. #7
    Join Date
    Oct 2006
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It's not good atall, but good for first scripter.

  8. #8
    Join Date
    Feb 2007
    Posts
    62
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    its a good overall script for a first script

  9. #9
    Join Date
    Jan 2007
    Location
    Kansas
    Posts
    3,760
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Lately for my miner I've been thinking about that after it clicks the ore/tree and begins chopping that you wait until it does not find a specific color in a box on the tree. Ive just been thinking about this lately and wondering if it would work.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. c++(pointers) help
    By hackncrack1 in forum C/C++ Help and Tutorials
    Replies: 10
    Last Post: 05-25-2009, 01:38 PM
  2. Pointers?
    By mat_de_b in forum C/C++ Help and Tutorials
    Replies: 8
    Last Post: 11-05-2007, 09:40 PM
  3. My first SRL Script need Pointers
    By Hey321 in forum RS3 Outdated / Broken Scripts
    Replies: 11
    Last Post: 11-12-2006, 07:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •