Results 1 to 14 of 14

Thread: How to Chop a tree! [beginner]

  1. #1
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default How to Chop a tree! [beginner]

    This tutorial was in moparisthebest and it was way outdated. I decided to update it and post it on the forums.It was mine. Enjoy!

    What will this tutorial do?
    It will help you how to chop a tree!

    Ok lets start with the basics,First open up scar in your deskptop or some where.

    Now a window will show up with this in it,
    SCAR Code:
    program New;
    begin
    end.

    now program...
    see how it says new?Well now make that new into anything you want(but put a space after new and put a semi colon after your name with no space)

    ill name it chopatree.
    SCAR Code:
    program chopatree;
    begin
    end.

    Now it should look like that!

    a begin....
    begins a procedure or the mainloop(ill explain it later)

    end.(with period)...
    will end the whole script, but put nothing after that!

    now space it out like this!
    SCAR Code:
    program chopatree;




    begin




    end.

    now put "const" between the begin and program

    it should look like this...
    SCAR Code:
    program chopatree;


    const


    begin




    end.

    constant.....
    This means that this "setting" will stay the same throughout the entire script.(bebes definition, cred goes to her)

    now put something called a
    SCAR Code:
    procedure ;

    after the

    SCAR Code:
    begin

    procedure....
    Procedures are like sections of the
    script that can be called upon for many different reasons.(from bebe and kane,cred goes to both)

    now it should look like something like this!
    SCAR Code:
    program chopatree;


    const


    procedure chop;
    begin




    end.

    now my procedure is like a program, you can name it what ever you want,ill name it chop.

    So put this under program
    SCAR Code:
    {.include srl/srl.scar}

    srl is the main include,you use it in almost every script to include most of the functions of scar

    now your script look something like this....

    SCAR Code:
    program chopatree;
    {.include srl/srl.scar}

    const


    procedure chop;
    begin




    end.

    now in your const put
    SCAR Code:
    treecolor1=;

    now(you dont really need to)
    login to runescape and put scar under so you can see the eyedropper thing
    now click the "eyedropper" and click the tree, any part of it.

    now look in your debug box in scar (the bottom box) there should be

    Color Picked:

    That means youve picked a color!

    now after treecolor1 copy and paste the numbers(not the ones in the close rounds)

    now your gonna make a procedure!

    so your script should look like this now...

    SCAR Code:
    program chopatree;
    {.include srl/srl.scar}

    const
    treecolor1=15123344;

    procedure chop;
    begin
    end;



    end.

    NOTE*that color is a random color dont use it,Not RS

    end;(with semi-colon)...
    ends a procedure.

    now put this in your procedure i will go over it...

    SCAR Code:
    program chopatree;
    {.include srl/srl.scar}

    const
    treecolor1=15123344; //tree color

    procedure chop;
    var x,y :Integer;
    begin
       if(FindColorSpiralTolerance(x,y,treecolor1,msx1,msy1,msx2,msy2,25))then
       MMouse(x,y,3,3);
       if(IsUpText('hop'))then
        begin
          GetMousePos(x,y);
          Mouse(x,y,3,3,true);
        end;
    end;



    end.
    NOTE*for how many begins you have in a procedure, thats how many ends you have after the procedure.

    that
    SCAR Code:
    if(FindColorSpiralTolerance(x,y,treecolor1,msx1,msy1,msx2,msy2,25))then
    lets start with "if" down....
    if means that..
    if it finds something that came up...

    it needs to be there always.

    (FindColorSpiralTolerance)

    will find the color of the tree color and use tolerance.
    x,y, is the co-ordinates you need it as a variable, add it like i did.

    treecolor1, of course your tree color!

    msx1,msy1,msx2,msy2,the co-ordinates for main screen(ms)

    25,the tolerance.

    mouse(x,y,3,3,true),clicks,3 is the pixels,true is the way you want to click...true=left false=right

    Mmouse(x,y,3,3), moves the mouse

    isuptext,finds the text that comes at the top left corner of the screen

    'hop', text taken from the top left words (uptext), no first letter.

    Getmousepos(x,y); gets the current mouse position at x,y

    Now make a procedure like you did last time

    Now in the procedure put
    SCAR Code:
    wait(timetochop)

    Your thinking,where did that timetochop come from....
    Put that in your const and after it put how long it takes to cut a tree!
    but you cant just put 15 or anything you need to put it in milli seconds
    so for ex

    1000 is a second in milli seconds and so forth


    Now go back to that procedure
    Put a end after that wait time to mark the end of the procedure.

    now your whole script should look like this...
    SCAR Code:
    program chopatree;
    {.include srl/srl.scar}

    const
    treecolor1=15123344;
    timetochop=15000;

    procedure chop;
    var x,y :integer;
    begin
      if(FindColorSpiralTolerance(x,y,treecolor1,msx1,msy1,msx2,msy2,25))then
      mmouse(x,y,3,3)
      if(IsUpText('hop'))then
       begin
         GetMousePos(x,y);
         Mouse(x,y,3,3,true)
       end;
    end;

    procedure treewait;
    begin
      Wait(timetochop)
    end;

    end.

    but wait...
    The main loop!

    mainloop....
    the "main brain" of the script!

    put a begin ontop of that end.

    now space it out like this

    begin


    end;


    now put it all like this
    SCAR Code:
    begin
      ClearDebug;
      SetUpSrl;
      ActivateClient;
      repeat
        treewait;
      chop;
      until(false)
    end.

    ill tell you one by one what it means....

    cleardbug;-clears the debugbox(the box at the bottom)
    ActivateClient;-Activates the window you put the crosshair on
    SetUpSRL;-sets up srl

    repeat-repeats the procedure,functions lines ect. you put under it

    treewait; and chop;-your procedures!

    until- breaks out of a loop(repeat) until something happens
    (false)-(goes with until) repeats it forever!

    now your script should look like this!
    SCAR Code:
    program chopatree;
    {.include srl/srl.scar}

    const
    treecolor1=15123344;
    timetochop=15000;

    procedure chop;
    Var x,y :integer;
    begin
      if(FindColorSpiralTolerance(x,y,treecolor1,msx1,msy1,msx2,msy2,25))then
      MMouse(x,y,3,3);
      if(IsUpText('hop'))then
       begin
         GetMousePos(x,y);
         Mouse(x,y,3,3,true)
       end;
    end;

    procedure treewait;
    begin
      Wait(timetochop)
    end;


    begin
     ClearDebug;
     SetUpSrl;
     ActivateClient;
     repeat
       treewait;
       chop;
     until(false)
     end.

    congrats!, you made your first chop-a-tree script!

    any problems? Post here or pm me!
    Last edited by Mr. Doctor; 11-15-2009 at 01:05 PM.

  2. #2
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Okay I guess its good, maybe add more failsafes, even if its beginners i think it still needs fail safes

    Anyways nice tutorial.

  3. #3
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    If the text 'hop' is up, you actually want to get the mouse position and then click at the current position:
    SCAR Code:
    procedure chop;
    Var x,y :integer;
    begin
      if(findcolorspiraltolerance(x,y,treecolor1,msx1,msy1,msx2,msy2,25))then
      mmouse(x,y,3,3);
      if(IsUpText('hop'))then
       begin
         GetMousePos(x,y);
         mouse(x,y,0,0,true)
       end;
    end;



    I think that you explain things way too well. Like you don't need to explain how to open up SCAR...etc., because a beginner tutorial should probably be read before reading any other tutorials anyways.

    Good job though

  4. #4
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks Smart and JAD. Fail safes are really not needed imo in a noobie tutorial that just clicks a tree and waits. This is one that just explains the basics(tolerance,mouse,mmouse, color picking and some essential SCAR functions). But i kinda see your point. And JAD i like my readers to understand how and what im doing. I take that as a compliment actually.

    edit: Added Getmouspos
    Last edited by Mr. Doctor; 09-07-2009 at 06:24 AM.

  5. #5
    Join Date
    Sep 2009
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    cul, this tut helped em a bti with Willow cutter

  6. #6
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    No problem. Anytime.

  7. #7
    Join Date
    Jun 2008
    Location
    Somewhere
    Posts
    117
    Mentioned
    2 Post(s)
    Quoted
    4 Post(s)

    Default

    Good tutorial

    I have to agree failsafes are not really needed in this one, if they want to know about failsafes there are other tutorials on them.

  8. #8
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Glad i could help!

  9. #9
    Join Date
    Nov 2009
    Location
    Slovakia, you do not know huh?
    Posts
    19
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, i do not want to be an ass, but it would be better if you write it with standards. I like the program and how you set, but my eyes hurt when i see everything lowercase. Just a small note.

    Thanks.

  10. #10
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Object Pascal language reserved words and key words shall always be completely lowercase. Never capitalize words that SCAR displays in bold. It's completely unnecessary and looks ugly!

    Official SCAR standards. Nothing about capitalization.

  11. #11
    Join Date
    Nov 2009
    Location
    Slovakia, you do not know huh?
    Posts
    19
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes, i know but you could at least:

    FindColorSpiralTolerance

    Just a small example. Again, i do not blame you, it is just my opinion.

  12. #12
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I needed to waste some time so I added the caps. Thinking about making a intermediate version.

  13. #13
    Join Date
    Sep 2008
    Location
    My House
    Posts
    519
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    good post if I add stuff to it, use it for mining, and give you credit can I use it.

    Great tutorial by the way.

  14. #14
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by death12652 View Post
    good post if I add stuff to it, use it for mining, and give you credit can I use it.

    Great tutorial by the way.
    Sure. Thanks

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
  •