Page 1 of 2 12 LastLast
Results 1 to 25 of 35

Thread: Getting used to Commands

  1. #1
    Join Date
    Oct 2006
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default Getting used to Commands

    .: Getting Prepared for SCAR/SRL :.
    -A Sebo Thread.

    IF YOU VOTE NO, EXPLAIN WHY, OR I WILL COUNT IT AS SPAM

    Note: Please post suggestions on what to do better, or what to add. It will make this tutorial even better.

    Note: this is a pretty big tutorial, and it involves ALOT of reading, but donot give up! Of course, I cannot teach you every command, because there are sooooo many, but, the more the merrier, and hopefully, when you finish reading this, you will have a good understanding of how things work.

    Please, go easy on me as this is my first tutorial, I might miss a few things, and if my spelling/grammer is off, it's because I came from Poland, and was in America for only a few years.

    I got a question for some people out there...
    How many people think it is intimidating to see how the "uber long cool Scripts"
    are made?


    *a few people raise their hands*

    Well thats pretty much the way I felt when I started scripting, but the truth is, don't be, because soon, when you make great scripts, other people will look at your script and say. "Dang, that is so hard, I'm never going to attempt scripting." and maybe even, you can help them out by reading this Tutorial.

    I am going to teach you the basics, so you can get a feel on how things work.

    Chapter One-


    The Very Basics:

    What you are going to learn in this Chapter:

    -Adding an Include.
    -How to find a Color.
    -Moving and clicking the mouse.
    -Understanding Constants.
    -Understanding Variables.
    -Using Constants + Variables.
    -Using Repeats.
    -Using Procedures.


    These are the basic commands at SRL, they are used in every/almost every script, and you will need to learn how they work.

    Includes:

    Includes are what fuels SCAR, without it, SCAR is basically going nowhere.

    You need Includes at the very beginning of your script:

    SCAR Code:
    program new;
    {.include SRL/SRL.scar}
    begin
    end.

    what this does: it tells SCAR to use the file SRL.scar from your includes file, so you can have different procedures/functions etc.

    remember: once you add this include you need to put SetupSRL; in your Main loop.
    that simply calls it to setup everything in SRL for your script.

    FindColor/FindColorTolerance:

    SCAR Code:
    FindColorTolerance(x, y, color, xs, ys, xe, ye, Tolerance);
    whoa, what does all that mean?

    • x, y : when you drag your crosshair onto the screen, that is where it is going to look for.
    • color : That is the color it will look for. eg. 352633
    • xs, ys, xe, ye : This is the Coordinates of the screen. Where is will look for the colors.
    • Tolerance : This will look for similar colors, eg. black is 0, if I put tolerance for 10, it will look for similar colors to black like 63445.


    Same thing goes for FindColor, except it's without the tolerance.

    Mouse:

    Mouse was very weird for me when I first began, I didn't understand it with all the RandX stuff. but thats why im here to teach you!

    SCAR Code:
    Mouse(mousex, mousey, ranx, rany, left);
    wut?

    Ok, here is what all this means:

    • mousex : The x coordinate to click.
    • mousey : the y coordinate to click.
    • ranx & rany : how many pixels it will randomly move when moving the mouse.
    • left : True or False, True means Left Click, False means Right Click.


    Pretty simple right? and you thought it looked confusing..

    const:

    ahh.... constants, one of my favorite things in SCAR.
    these are so simple! I don't know how, but I had errors putting them in my script.

    SCAR Code:
    const
    Username = 'monkey';

    Const means Constant, this will stay the same throughout the whole script. You always have to put this before any procedure, but after a Variable.

    these can be used to type things, for example, usernames and passwords.
    like this:
    SCAR Code:
    TypeSend(Username);

    pretty simple eh?

    Var:

    Var = Variable

    A variable is something that Varies, eg. thats where the name comes from.
    Variable usually never stay the same. Like numbers going up.

    SCAR Code:
    Var
      howmanytimesamigoingtodothis : integer;

    now, howmanytimesamigoingtodothis is my variable. It will change throughout the script.

    I can use it for lots of things, for example, keeping track on how many times I did something, hence the name of the variable : howmanytimesamigoingtodothis. but don't get me wrong, variable can do much more, just I'm not going to be able to explain everything to you.

    this is how I would use it in a script: (My variable name is Chopped.)

    SCAR Code:
    begin
    choptree;
    Chopped := Chopped + 1;
    end.

    it is telling SCAR, that I chopped the tree 1 more time.

    now lets move on to something more complicated like repeats...

    Repeats:

    Repeats are what most scripts need, ortherwise, they would do 1 thing and the script would be done. This is where Constants and Variables also come in handy, because you don't want to repeat something forever, or do you...?

    SCAR Code:
    Var
      thismanytimes : Integer;

    Const

       Sayit = 5;

    begin
    repeat
    writeln('test');
    wait(100);
    thismanytimes := thismanytimes + 1;
    until(sayit = thismanytimes);
    end.

    this is telling SCAR to repeat itself _ times from the const.

    wow! if you made it this far, you are doing GREAT! congratulate yourself.

    Procedures:

    Procedures are what break up scripts into sections, so it is easier to read, and if you put important procedures on top of normal ones, you can call that procedure into the not so important procedure. (May seem confusing, but read it carefully.)

    Ex.

    SCAR Code:
    procedure ImportantProcedure;
    begin //you need begin, other wise it wont tell the procedure to begin.
    DoImportantStuff; //this is not a actual command, but I use it for an ex.
    end.

    procedure SomeotherProcedure;
    begin
    Dothis;
    ImportantProcedure; //I called the procedure from earlier on in the script, so I can use it.
    end.

    see? Easy.

    ok, so we know the basics, we learned how to:

    • Find a color.
    • Move and Click the Mouse.
    • Learned what constants are.
    • Learned what Variable's are
    • Learned how to repeat correctly.
    • Learned to add includes.
    • Learned how to use procedures.


    wow, so much stuff in so little time!
    see, scripting isn't as hard as it looks.

    "but what about things like findcolortolerancespiral?"

    well, those things are simple, just take them apart, and work with it step by step.

    Chapter 2-


    Making a simple script:

    Ok, now that you understand some of the basics, we can use this knowledge to put together a simple script.

    So open up SCAR, and you should see this.

    SCAR Code:
    program new;
    begin
    end.

    Make the program name Tutorial or something like that. Or you can completely delete it, if you want.

    Ok, now what you want to do is add some spaces between program and begin, so you can add some "beef" to the script.

    SCAR Code:
    program Tut;


    begin
    end.

    Ok, before you do anything. Add {.include SRL/SRL.scar} under program
    and in your main loop(the one at the very bottom) add SetupSRL;
    As we know, this calls to use SRL in our script.


    Now that we have spaces, we can add some Consts, and Variables.
    I will be making a woodcutting script for an example.

    Ok, lets add our constants, lets make it for tree colors.
    make the constants like TreeCol1 = 54365954; TreeCol2 etc...

    So now our script should look like this...

    SCAR Code:
    program TuT;

    {.include SRL/SRL.scar}

    Var
    x, y : integer;  //These are our Variables. x, y : for Colors.

    const  //this calls our Constant.

       TreeCol1 = 5500; //One Tree Color (Not real)
       TreeCol2 = 5655; //Another Tree Color (Not real)
       Loads = 5; //how many loads should the script do (will use later on.)

    begin //our main loop.
    SetupSRL; //we setup SRL in the main loop, before anything else.
    end. // end of the script.

    So we added some constants and a Variable x, y which is for colors. Since SCAR sometimes will give an error when not adding it to a constant.

    Ok, lets add a variable to Total Loads done, we can add it as TLoads.
    and we can make room for adding the woodcutting procedure.

    Quick Tut with if's and then's, If and Thens are really important.
    You can use them like if (FindColor(Colorstuff)) then. pretty simple, it is really straight forward.

    So our script should look somewhat like this.

    SCAR Code:
    program TuT;

    {.include SRL/SRL.scar}

    Var
    x, y, TLoads : integer;  //We added TLoads, where x, y, is because it is a Variable.
                                    //it will be called later on the script.
    const

       TreeCol1 = 5500;
       TreeCol2 = 5655;
       Loads = 5;

    Procedure LookForColors; //Our new procedure.
    begin
      if not LoggedIn then Exit; // A simple FailSafe. I will explain a bit later. EDIT: forgot not :D
        repeat //We are going to repeat this, as it is the most important procedure.
        if (FindColorTolerance(x, y, TreeCol1, MSX1, MSY1, MSX2, MSY2, 5)) then //notice, we used our constant. I will explain MS stuff.
        Mouse(x, y, 2, 3, True); //Ok, it tells SCAR, if it found the color, then it will move the mouse to those coordinates.
        Wait(3000);
      Until InvFull; or (TLoads = Loads)  //Telling it to repeat itself, until the inventory is full. or until The total loads = The Loads you set in the constants.
    If InvFull Then
    TLoads := TLoads + 1; //Telling SCAR that it did 1 load.
      DropTo(2, 28); //Tells SCAR to drop the logs from inventory spots 2-28.
    end; //we need a semicolon, because it tells the script, it's ending a PROCEDURE.


    begin
    SetupSRL;
    LookForColors;
    end.

    Ok, as I said I will explain some stuff in the script.

    Failsafes:

    These are really important, without them, your script might be doing what you dont want it to do endlessly, and JaGeX will catch on, and your account would be dead.

    The most simple one is If not LoggedIn then Exit;
    It is telling the script, if you are already LoggedIn, then it will log you out.

    This is needed for MultiPlayer, but since I'm not going through that, it is not needed for this script.

    MSX1, MSY1 etc :

    This is really simple, it is telling SCAR to look for things in a certain place, instead of using all these coordinates, you can use some stuff built in SRL.

    MS = MainScreen
    So, the X1, is the First X coordinate

    Here is the list that I know on the MS stuff

    MS = MainScreen
    MM = MiniMap
    MC = MainChat
    MI = MainInventory

    Congratulations! You have created your First basic Script! Dang!, now you only need multiplayer, and antirandoms, and your on your way to amazing things in life.

  2. #2
    Join Date
    Dec 2006
    Location
    Boss central
    Posts
    811
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default thanks

    thanks,
    i learnt heaps man
    very easly explained
    and your grammer was fine lol
    this will help heaps of people including me
    lol
    this has made me 1 step closer to be a pro lol
    any way keep up the good work
    and keep writing tuts
    Being A Boss

  3. #3
    Join Date
    Oct 2006
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Thanks, I appriciate (spelling) comments like that , I will be writing more tutorials for sure.

  4. #4
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    Wow. Wow. Wow.

    You got me to say wow.

    Its so nice, If I had a cookie I would give it too you. (*munch*)
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  5. #5
    Join Date
    Oct 2006
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Lol Thanks mr. Roboto :P

  6. #6
    Join Date
    Nov 2007
    Location
    USA, Michigan
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default



    Good script tut with good use of fails...you may have wanted to put a else statement in just to round out the if...then...else progression, and then the "no need" statement for the else. A good habbit for beginners to get into.

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

    Default

    Yeah, I'm thinking of more things to put in, Because way back when(probably is changing now) I saw people applying with scripts like

    SCAR Code:
    program Autominer;

    begin
    repeat
    FindColor(x, y, noob, noob, noob, noob, noob);
    ClickMouse(x, y, True);
    wait(300); //WTH?!?!
    until false //OMG.
    end;

  8. #8
    Join Date
    Nov 2007
    Location
    Norway
    Posts
    178
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Nice tut

    Now i see why i always get that damn annyoing "unexpected ending"

    End. and End;

  9. #9
    Join Date
    Aug 2006
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    really helpful!

  10. #10
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Very nice! But, you should use some more standards..
    Verrekte Koekwous

  11. #11
    Join Date
    Oct 2006
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Yeah, So people get into the habit of doing it in the beggining.

    I know what you mean

  12. #12
    Join Date
    Dec 2006
    Location
    SC
    Posts
    692
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    All you need to do is tidy up your syntax standards. Use a pattern while writing scripts. Other than that, good tutorial.

  13. #13
    Join Date
    Nov 2007
    Location
    USA
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for the tut i learned a lot. Explained very well.This tutorial will help lots of people including me. This explanation has made me 1 step closer to becoming an expert script writer.

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

    Default

    Your all very welcome, My next tutorial will be.... lol I don't know. Anyone got suggestions?

  15. #15
    Join Date
    Jul 2007
    Posts
    1,055
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea, its cool. I learned MC and MI . Otherwise you could work on the depth of your tut's. A lot of people need deep explantions.

    Also don't double post. You made a tut to teach people. Now you teach the double posting, even as an srl member =/.

  16. #16
    Join Date
    Dec 2006
    Location
    Program TEXAS home of AUTOERS
    Posts
    7,934
    Mentioned
    26 Post(s)
    Quoted
    237 Post(s)

    Default

    LOOKS GOOD! good for those beginners i reccommend this tut =D

  17. #17
    Join Date
    Oct 2006
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Thanks for the good comment p1nky, but people keep pressing the no, but doesn't explain why.. so i'm ignoring those.

  18. #18
    Join Date
    Dec 2007
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks sebo!

  19. #19
    Join Date
    Oct 2006
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    No problem , enjoy your stay at SRL btw

  20. #20
    Join Date
    Dec 2007
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Sweet, this tutorial helped me get moving along my way with some basic knowledge, thank you.

  21. #21
    Join Date
    Dec 2007
    Posts
    97
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you very much, I've been reading a lot of these other,

    ULTIMATE GUIDES FOR NOOBS!

    and they really were good reads but did not help with the transition to actual applying and making scripts. This is really helping me make my first script, since I'm trying to transition this into an AutoMiner and trying to add a Progy Report, and some simple Anti-Ban, Randomness, and Anti-Random.

    I've gotten stuck though, for some reason I get this,

    Line 35: [Error] (15707:1): Unknown identifier 'DropTo' in script C:\Program Files\SCAR 3.13\Scripts\PowerMiner.scar

    It is not recognizing your DropTo command on my Computer, I know its a real nooby question, with probably a real easy solution. But can you help?

    The only thing I can possibly think of is, my SLR Library on SCAR is not loaded right or out of date, is this it?

    Again I have about 2 days experience so sorry if this ticks you off or something...

  22. #22
    Join Date
    Oct 2006
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Can you post the script, I will explain what you did wrong.

  23. #23
    Join Date
    Dec 2007
    Posts
    97
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Sorry I don't know how to do the fancy inserted script list, but here it is ugly way.

    program HurgysPowerMiner;
    {.include SRL/SRL.scar}
    {.include SRL/SRL/Skill/Mining.scar}

    var
    x,y, TLoads: Integer;

    const
    RockColor1 = 4813212;//Select Color From Rock Your Using
    Loads = 2;//Loads you want to do
    WaitTime = 5000;//WaitTimeBetweenRocks (3000-10000 MS)

    Procedure SearchRock;
    begin
    if not LoggedIn then Exit;
    repeat
    if (FindColorTolerance(x, y, RockColor1, MSX1, MSY1, MSX2, MSY2, 10)) then
    Mouse(x, y, 3, 3, True);
    Wait(WaitTime+random(1000));
    until InvFull;
    if InvFull Then
    TLoads := TLoads + 1;
    DropTo(2,28)
    end;


    begin
    SetupSRL;
    SearchRock
    end.

  24. #24
    Join Date
    Dec 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    very helpful thank you so much

  25. #25
    Join Date
    Oct 2006
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    @ hurgym your problem is that I think they change/renamed Dropto to something else, and since I really never needed it, I just did DropAll;

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Need some help with commands
    By godspower55 in forum OSR Help
    Replies: 3
    Last Post: 10-16-2008, 12:29 AM
  2. All SRL commands
    By Gala in forum OSR Help
    Replies: 5
    Last Post: 10-10-2007, 01:37 PM
  3. Replies: 5
    Last Post: 09-18-2007, 01:21 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
  •