[Tut] Basic SCAR Commands [/Tut]

Discussion in 'Code Snippets and Tutorials' started by 3garrett3, May 29, 2007.

  1. 3garrett3

    3garrett3 Newbie

    Joined:
    May 28, 2007
    Messages:
    3
    Likes Received:
    0
    Location:
    Windsor Nova Scotia, Canada
    Ok, my second post. But i know lots of scar. I come from villu-reborn. I know how to make lots of runescape scripts. I will tell you about a few easy procedures that you can use to make your script do things.

    The first thing that you need to start scripting, is to install scar. Im sure that all of you have. Now you need to open scar. You will see something that looks like this.

    Code (Text):
    1.  
    2. program New;
    3. begin
    4. end.
    5.  
    This is basic SCAR syntax. The program, the beggining, and the end.

    Here are a few basic commands that you can use to make your script do things:

    Clicking:

    Code (Text):
    1.  
    2. ClickMouse(x,y: integer; Left: boolean);
    3.  
    Now, I will explain things here. x and y are programmed variables. You need to declare them. You should already know variables when you come to this tutorial. Left : Boolean simply means "do you want to left click or right click" the simple answer would be "yes" or "no". But SCAR doesnt understand yes or no. It uses "true" or "false". True, is yes, and False, is no. So you could use this:

    Code (Text):
    1.  
    2. ClickMouse(123,321,True);
    3.  
    and it would click at the coordonates 123,321. You can pick the coordinates by using the SCAR color picker.


    Color Finding

    Code (Text):
    1.  
    2. FindColor(var x,y: Integer; color, xs, ys, xe, ye: Integer): Boolean;
    3. AND:
    4. FindColorTolerance(var x,y: Integer; color, xs, ys, xe, ye: Integer; Tolerance: Integer): Boolean
    5.  
    This is more confusing, but i will explain here. x and y, are variables, as explained in another tut by someone else. The color, is the color that you are looking for. xs,ys,xe,ye are the coordinates to a box. This is the box that you are looking for the colors in. Just pick the top left corner of the box, and the bottom right corner of the box, and post them there. Here is an example:

    Code (Text):
    1.  
    2. FindcolorTolerance(x,y,123456,123,321,345,543,5);
    3.  
    x and y are my variables. 123456 is my color. 123,321,345,543 are the coordinates for my box, and 5 is the tolerance. This just lets the script know if the color isnt exact, and it will still find it. Anywhere between 1-10 is a good tolerance.

    Mouse Moving

    Here are some ways to move the mouse.

    Code (Text):
    1.  
    2. MoveMouseSmooth(x,y: integer)
    3. OR
    4. MoveMouse(x,y: integer);
    5.  
    Movemousesmooth, "simulates human movement". Really, it makes the mouse look drunk, but it is the best SCAR has, without using certain things. It is good enough though. MoveMouse is not recommended. It moves the mouse, without moving the mouse. It moves it there, but does not simulate the actual mouse moving. MoveMouseSmooth simply needs the x and y variables, just like clickmouse.

    Code (Text):
    1.  
    2. MoveMouseSmooth(123,321);
    3.  
    Putting it together!

    Here is an example of putting these things together.

    Code (Text):
    1.  
    2. if findcolor(x,y,123456,123,321,456,654) then
    3. begin
    4. MoveMouseSmooth(x,y);
    5. Wait(10)
    6. ClickMouse(x,y)
    7. end;
    8.  
    here we use findcolor, to find the color, and store the coordinates of this color, at x and y. Then we use movemousesmooth to move the mouse there, wait 10 miliseconds, to let SCAR keep up, and then click on the color.

    Feel free to ask for clarification or anything else.
     
  2. usalyslow

    usalyslow Newbie

    Joined:
    May 29, 2007
    Messages:
    21
    Likes Received:
    0
    thanx helpfull for a beginner like me
     
  3. 3garrett3

    3garrett3 Newbie

    Joined:
    May 28, 2007
    Messages:
    3
    Likes Received:
    0
    Location:
    Windsor Nova Scotia, Canada
    plus rep? :p i dont know what it is for, but it is always nice to get more rep from people:) makes me feel good.