Page 1 of 16 12311 ... LastLast
Results 1 to 25 of 392

Thread: All in one beginner tutorial

  1. #1
    Join Date
    Feb 2006
    Location
    Pennsylvania
    Posts
    1,524
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default All in one beginner tutorial [OUTDATED]

    I appreciate that I could help so many people on their path towards learning to use/script with SCAR but I have sadly not been able to keep updated with the current trends withing the SRL community.

    Thier has been a fundimental shift towards a new macro Simba. I implore everybody to have a look at Coh3n's THE Beginner's Simba Tutorial as he has been able to provide a more current `All In One`.

    Thank you for the support.






    All in one beginner tutorial By Bebemycat2 [OUTDATED]

    What is this going to cover?:
    • Where to get SCAR
    • How to create your first script
    • How to make and use Functions
    • Bitmaps


    What you will need:
    • Willingness to learn
    • Common sense


    Where to get SCAR:
    You can download SCAR Divi from the official site here: Freddy1990.com
    You can also download it from the official Mirror sites:
    Dylock.net - Outdated
    Moparisthebest.com - Outdated

    ONLY DOWNLOAD FROM THESE SITES! You should never have to pay for SCAR, if you have, then you have been scammed.

    How to create you first script:
    Ok to begin I will ask you to open up SCAR. Now all you should see is this:
    SCAR Code:
    program New;
    begin
    end.
    Well I want you to space all of those out a bit like this:
    SCAR Code:
    program New;



    begin


    end.
    This will give us some space to code in. This is just the basic elements. program New; This is your programs name, Change "New" to whatever name you want your program to be. Always add a semicolon ( ; ) after the name to tell the script that that is the end of your scripts name. begin Tells the compiler that the script has just began, the coding of your script goes between "begin" and "end." end. Tells the compiler that you have ended the script, Make sure to always put a full stop. If you are making a procedure/function then you end it with a semicolon ( ; ), that will be explained later in the tutorial.

    Next thing we are going to do is this:
    SCAR Code:
    program script;



    procedure;
    begin




    end.
    You will notice that I have added something called a Procedure. Well a "procedure" is basically this:
    Quote Originally Posted by XxKanexX
    Procedures are like sections of the
    script that can be called upon for many different reasons.
    This procedure is where we will create the "body" or the majority of our script, from there is can be called upon later in the "main line" this I will explain more about later.

    You also have to have a name for your procedure, so lets name it "Hello" and add a semi-colon after it so it looks like this:
    SCAR Code:
    program script;



    procedure;
    begin




    end.
    You name the procedure so that you can "call" upon it later in the script. You can name it anything but I am going to use "Hello" for this script.

    Now what we are going to do now is add somthing called a "const" or a constant. This means that this "setting" will stay the same throughout the entire script.

    To make a const you simply need to do this with your script:
    SCAR Code:
    program script;

    const

    procedure hello;
    begin




    end.
    Now we have to make something a const, so let make it this:
    SCAR Code:
    program script;

    const
    Message1='Hello world!';

    procedure hello;
    begin




    end.
    Now you will notice that I have "Message1=" this is because with SCAR you have to always tell it what the "Message1" equals, that’s the reason for the "=". Now for the ' ' marks. These are what SCAR uses to identify when a String begins and when it ends. A string is a word / phrase. You will notice that it has a pinkish color to it, that is the "Syntax highlighting" that SCAR creates so that scripting can be much simpler.

    Now that we have a "const" we need it to do something.

    Ok, now if you haven't already found the help file included with SCAR, then I think you should know. To access the help file go to "Help"-->"Help" and you should be presented with the Scar help file. Alternatively you can can simply hit "F1" with Scar open and selected as your active window.
    The thing that makes this help file so handy is that it has all or most of SCAR's many functions/procedures plus other helpful content. This file should be your best friend when you are just starting out scripting, and even when you become more advanced.

    Ok, now that you know about the help file, lets get back to the tutorial.

    Now scroll down the list until you come to a procedure called:
    Writeln(s: string);
    Now as I explained before a procedure is:
    Quote Originally Posted by XxKanexX
    Procedures are like sections of the
    script that can be called upon for many different reasons.
    And a string is: A string is a word / phrase.

    This procedure:
    Code:
    procedure Writeln(s: string);
    just means that the "S" is a string, so therefore that is where we would enter what we wanted to type.

    So I want you to make your Script look like this now:
    SCAR Code:
    program script;

    const
    Message1='Hello world!';

    procedure hello;
    begin
    Writeln();




    End.
    You will notice that I have "Writeln();" after the begin, that is because you have to begin the script before you can do anything.

    Also "Writeln" is a typing "command", it tells SCAR to type the keys that you specify. The Text will show up in something called the "Debug" box that is this area of SCAR:



    Now we will do this:
    SCAR Code:
    program script;

    const
    Message1='Hello world!';

    procedure hello;
    begin
    Writeln(Message1);




    End.
    Now normally we would have to use the ' ' identifiers around "Message1" but in this case, since it is already in the "const" there is no need to and this will tell SCAR to type what you have filled out in the "const" "Message1".

    Now we have to tell SCAR that we want to end the current procedure for this we will add "end;" like so:
    SCAR Code:
    program script;

    const
    Message1='Hello world!';

    procedure hello;
    begin
    Writeln(Message1);
    end;




    end.
    This is simply to tell SCAR to end the procedure, you will do the same with a function.
    "End;" is different from "end." because "end." tells SCAR to end the whole script while "end;" tells it that you are done with a procedure/function.

    Now we have to make SCAR actually type our "message" and use our procedure that we have just created. to do this we have to create the "main line" I mentioned before. This is done much like a procedure but has a few differences that I will explain.

    So to start off your "main line" you will need to have a "begin" like so:
    SCAR Code:
    program script;

    const
    Message1='Hello world!';

    procedure hello;
    begin
    Writeln(Message1);
    end;


    begin

    end.
    You will notice the begin is there, this is just telling SCAR this is where your main line shall begin. Simple, no?

    So now we are going to make SCAR repeat something. The command to make SCAR repeat is "repeat". This will go after the being in the "main line". So you should now have code that looks like this:
    SCAR Code:
    program script;

    const
    Message1='Hello world!';

    procedure Hello;
    begin
    Writeln(Message1);
    end;


    begin
    repeat

    end.
    This basically telling SCAR to begin the "main line" and repeat something. Now we have to tell it what it needs to repeat. For this we will take our procedures name (Hello) and add it under our repeat command. So it should look like this:
    SCAR Code:
    program script;

    const
    Message1='Hello world!';

    procedure Hello;
    begin
    Writeln(Message1);
    end;


    begin
    repeat
    hello;

    end.
    This will tell SCAR to repeat our "Hello procedure". But we have to tell it how long it has to repeat it for, so we will need the command "until". like so:
    SCAR Code:
    program script;

    const
    Message1='Hello world!';

    procedure Hello;
    begin
    Writeln(Message1);
    end;


    begin
    repeat
    hello;
    until(false)
    end.
    ]Now you will notice that I have "until(false)" when I only told you to add "until". Well until needs some sort of "time marker" to tell it when to repeat until, and "(false)" tells it to repeat forever, this will make it an infinite "loop". With "until(false)" this script will repeat our procedure "Hello" forever, never stopping until the user stop SCAR manually.

    Now hit: "script" -----> "Compile" and you should get this message in the "debug" box that says "Successfully compiled" this means that you coded the script right. Now to test it.

    With your "crosshair"() select your debug box and hit "run script". You will notice that it keeps typing it over and over really fast. So now we need to slow it down a bit. for this we will use a procedure called "wait". Wait tells the script to wait a designated amount of miliseconds before it's next action. To add wait what we do is this:
    SCAR Code:
    program script;

    const
    Message1='Hello world!';

    procedure Hello;
    begin
      wait(1000)
      Writeln(Message1);
    end;


    begin
     repeat
       hello;
     until(false)
    end.
    You will notice the "1000)" this is the amount of milliseconds you want to wait, now if you paid attention in math(s) (Depending on if your American or not you call it math or maths) you will know that 1000 milliseconds is 1 second. So we are basically saying that when SCAR reads the "main line" and does our procedure "Hello" that it should wait 1 second before it repeats. Simple, no?
    Now run it.

    You will see that it types at a much more controlled rate now.


    CONGRATULATIONS! You have just made your very first script!
    Last edited by Bebe; 02-07-2012 at 02:32 AM.

  2. #2
    Join Date
    Feb 2006
    Location
    Pennsylvania
    Posts
    1,524
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Functions:

    What are they?
    Functions are the same as procedures but they return a value.

    What are the "values" it can return?
    String - Text, string of characters
    Integer - Whole numbers, positive and negative (i.e. 1, 3, -7)
    Extended - Real numbers, positive and negative (i.e. 1.5, -2.6)
    Boolean - True or False

    And a few more, but these are the basic four variables used in most functions.

    How do you make a function?
    Well lets start of with a basic example. Say I wanted to convert American miles to metric kilometers.
    To do this we need to find the conversion formula, in this case being miles * 1.609 = kilometers

    So lets start out by making a function and naming it "MilesToKilometers" like so:
    Code:
    program New;
    
    function MilesToKilometers
    
    
    begin
    end.
    But now we have to add a variable so the use can input how many miles need to be converted, so we add this:
    Code:
    (miles:extended)
    To get it to like like this:
    Code:
    program New;
    
    function MilesToKilometers(miles:extended)
    
    
    begin
    end.
    But wait that won't compile because we have to add the type of variable the function will return in the same line also. For this function you would want it to return an extended because when you are multiplying the miles by 1.609 you are not always going to get a "nice" number (whole number).

    So we have to add ":extended;" to the end, like this:
    Code:
    program New;
    
    function MilesToKilometers(miles:extended):extended;
    
    
    begin
    end.
    Now lets add our "begin" and "end;", so we get it to look like this:
    Code:
    program New;
    
    function MilesToKilometers(miles:extended):extended;
    begin
    end;
    
    
    begin
    end.
    If you try to compile now then you will get an error like this:
    Line 3: [Hint] (3:10): Variable 'Result' never used in script
    Now you may be thinking to yourself "But I never defined a variable named Result", well SCAR did. Once you create a function, SCAR creates a local variable named Result.

    What is Result? Well it is the result of your function that can be used by other areas in your script. It is also the part of that function that will be returned. Like in the case of our "MilestoKilometers" function, we are returning the amount of kilometers.

    So lets get back to our script.

    Sow now we have to add result in. So we type "Result:=" and then add our formula "miles * 1.609;"
    "Miles" is out variable that was previously defined in the Function "title"
    The "*" stands for multiplication.
    1.609 is the amount of kilometers in each mile.

    So you should have something like this:
    Code:
    program New;
    
    function MilesToKilometers(miles:extended):extended;
    begin
      result:= miles * 1.609;
    end;
    
    
    begin
    end.
    Successfully compiled

    You just created your first function!

    To test our function we can use this script:
    Code:
    program New;
    
    function MilesToKilometers(miles:extended):extended;
    begin
      result:= miles * 1.609;
    end;
    
    procedure WriteFunction;
    begin
     writeln('1 mile is equal to '+floattostr(MilesToKilometers(1.0))+' kilometers');
    end;
    
    begin
      WriteFunction;
    end.
    1 mile is equal to 1.609kilometers
    *Note* floattostr converts floating point number to string. So a number with a decimal is converted to a string so it can be outputted by functions like writeln.

    It works.

  3. #3
    Join Date
    Feb 2006
    Location
    Pennsylvania
    Posts
    1,524
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Bitmaps:

    What are Bitmaps?:
    A set of bits that represents a graphic image, with each bit or group of bits corresponding to a pixel in the image.

    To sum that all up, a bitmap is a image with a high quality, which makes it idle for SCAR's built in image searching functions/procedures.

    How do you capture the image?
    If you don't have image capturing software, you can simply use the "Prnt Scrn" button, usually located in the upper right of your keyboard.
    If you only want to capture the currently selected window, then you can hit Alt + Prnt Scrn, this reduces the amount of cropping/editing you will have to do later.

    Ok, now that you know how to capture an image, lets get an example to use for this tutorial, which in this case will be a willow log from RuneScape 2.
    So open up RuneScape and capture an image similar to this one:


    I would recommend that for the sack of following along with this tutorial you use the above image also, you may notice that it is a .png instead of a .bmp, well that is because imageshack.us automatically converts a .bmp to a .png. But none the less, it will work.

    Anyway, open the Inventory image up in paint or your favorite image editing software (I chose paint because this part is very quick, and you don't need any resource intensive software like PhotoShop to do it.
    Anyway, open Paint up and select one of the willow logs, like so:


    And then copy or cut it onto your "clipboard", and open up a new Paint, and paste the willow log there. Now make sure the paint pallet is as small as possible, so there is no added white space to your image, as this will increases the size of your bitmap and cause more lag and memory usage, which isn't good at all.

    Ok so now you should have a Paint open that looks like so:


    Now it is time to make it ready for SCAR. Now a little knowledge for you...
    SCAR doesn't register black in it's bitmaps, it ignores black. So lets make it happen.

    You see how there is a bunch of extra space around the log, well we don't want SCAR to look for that too, so we are going to black that part out. So select your "Bucket" tool and fill the non-willow log part of the bitmap with black like so:


    Now it is time to make the image smaller, yes smaller. The golden rule in bitmaps is the smaller the better. Try to balance efficiency with size. Ok, so now we are going to attempt to make the image smaller by getting as close to the edge of the willow log as possible without removing any part of it. To do this you might want to zoom into the image in Paint by hitting Ctrl+ Page Dn.

    So now zoom in and use the select/cut tool to crop the image even closer. Here were my results:


    Now it is time to open the bitmap in SCAR!
    To do this Open up SCAR, and go to 'Tools' ---> 'Picture to String...'


    You should be presented with a menu resembling the following:


    Now hit open, and find the saved bitmap that you have just created. Make sure the entire image is selected and hit "Ok".
    You should now be presented with a whole mess of jumbled letters and numbers in your debug box, that should look similar to this:
    SCAR Code:
    WillowLog2 := BitmapFromString(31, 25, 'beNqtlkFLAzEUhJujWBS' +
           'V6qUHeyhqUcuKFUUKVihUFEVRoSAUPPn/f4GzjAyv+zZpsLvMoTTd' +
           'L5O8eUlbrfWesKymnpJ22N3o9zYH/fbwZOvyfLshfhBzPNq9Lnagb' +
           'HhIC5zJzR6wVnnw8l1YguANDmUS9gAB1isPHt4eBx/Pp1/vw+m4Q3' +
           'mUhjRK+EGnneSH7/kF9XC37/kWa0U4VpcPt3yJ31sJvnJbBF98Fpb' +
           'vmRJWhHKssl0PT4g7RtsoeryV/mImuN2cGJPxZq6gyW3vqug6fmAj' +
           'QAmyiissxReZdtNNnCI8TY+wCWoHkm0aGXuPUuxVFzs7p0C2AQdt/' +
           'nrGH5Msbx7rw+l3jPCfxYhWBUcfvcyOKw3urfp8erjiITjnwhSxro' +
           'kl38PBIRwfaDuW9pyGqsBh2MJtYBLwvIYqCyo4bOc4r00pc8iz1KS' +
           '95MM/hBXN7vu1fZooH5S88paGYq1kz0kHzL3FrHOZ19G99o0cKtvS' +
           'BLPKp+Gm/zlUCvGv5xdCwRWZ');

    Now Lets turn this into a working bitmap finder.

    To start of you have SCAR load your bitmap before it can use it, so lets create a procedure and call it "LoadBitmap", straightforward, huh?
    And lets copy the bitmap from the debug box and paste it within the procedure, so select the bitmap text and hit CTRL + C (this is the keyboard shortcut for 'copy').

    You should have code that look like this:
    SCAR Code:
    program New;

    procedure LoadBitmap;
    begin
     WillowLog2 := BitmapFromString(31, 25, 'beNqtlkFLAzEUhJujWBS' +
           'V6qUHeyhqUcuKFUUKVihUFEVRoSAUPPn/f4GzjAyv+zZpsLvMoTTd' +
           'L5O8eUlbrfWesKymnpJ22N3o9zYH/fbwZOvyfLshfhBzPNq9Lnagb' +
           'HhIC5zJzR6wVnnw8l1YguANDmUS9gAB1isPHt4eBx/Pp1/vw+m4Q3' +
           'mUhjRK+EGnneSH7/kF9XC37/kWa0U4VpcPt3yJ31sJvnJbBF98Fpb' +
           'vmRJWhHKssl0PT4g7RtsoeryV/mImuN2cGJPxZq6gyW3vqug6fmAj' +
           'QAmyiissxReZdtNNnCI8TY+wCWoHkm0aGXuPUuxVFzs7p0C2AQdt/' +
           'nrGH5Msbx7rw+l3jPCfxYhWBUcfvcyOKw3urfp8erjiITjnwhSxro' +
           'kl38PBIRwfaDuW9pyGqsBh2MJtYBLwvIYqCyo4bOc4r00pc8iz1KS' +
           '95MM/hBXN7vu1fZooH5S88paGYq1kz0kHzL3FrHOZ19G99o0cKtvS' +
           'BLPKp+Gm/zlUCvGv5xdCwRWZ');
    end;

    begin
    end.

    Ok, now that you have the bitmap loaded, you have to declare the bitmap name as a variable, so lets do that.
    In this case we will declare it as what is called a 'Global Variable'.
    To do this add the command 'Var', about one to two spaces below 'Program', so that should like like this:
    SCAR Code:
    program New;

    var

    procedure LoadBitmap;
    begin
     WillowLog2 := BitmapFromString(31, 25, 'beNqtlkFLAzEUhJujWBS' +
           'V6qUHeyhqUcuKFUUKVihUFEVRoSAUPPn/f4GzjAyv+zZpsLvMoTTd' +
           'L5O8eUlbrfWesKymnpJ22N3o9zYH/fbwZOvyfLshfhBzPNq9Lnagb' +
           'HhIC5zJzR6wVnnw8l1YguANDmUS9gAB1isPHt4eBx/Pp1/vw+m4Q3' +
           'mUhjRK+EGnneSH7/kF9XC37/kWa0U4VpcPt3yJ31sJvnJbBF98Fpb' +
           'vmRJWhHKssl0PT4g7RtsoeryV/mImuN2cGJPxZq6gyW3vqug6fmAj' +
           'QAmyiissxReZdtNNnCI8TY+wCWoHkm0aGXuPUuxVFzs7p0C2AQdt/' +
           'nrGH5Msbx7rw+l3jPCfxYhWBUcfvcyOKw3urfp8erjiITjnwhSxro' +
           'kl38PBIRwfaDuW9pyGqsBh2MJtYBLwvIYqCyo4bOc4r00pc8iz1KS' +
           '95MM/hBXN7vu1fZooH5S88paGYq1kz0kHzL3FrHOZ19G99o0cKtvS' +
           'BLPKp+Gm/zlUCvGv5xdCwRWZ');
    end;

    begin
    end.

    Now we have to declare our bitmap "WillowLog2" as a variable. Bitmaps are declared as integers. So lets do it...
    SCAR Code:
    program New;

    var
     WillowLog2: integer;

    procedure LoadBitmap;
    begin
     WillowLog2 := BitmapFromString(31, 25, 'beNqtlkFLAzEUhJujWBS' +
           'V6qUHeyhqUcuKFUUKVihUFEVRoSAUPPn/f4GzjAyv+zZpsLvMoTTd' +
           'L5O8eUlbrfWesKymnpJ22N3o9zYH/fbwZOvyfLshfhBzPNq9Lnagb' +
           'HhIC5zJzR6wVnnw8l1YguANDmUS9gAB1isPHt4eBx/Pp1/vw+m4Q3' +
           'mUhjRK+EGnneSH7/kF9XC37/kWa0U4VpcPt3yJ31sJvnJbBF98Fpb' +
           'vmRJWhHKssl0PT4g7RtsoeryV/mImuN2cGJPxZq6gyW3vqug6fmAj' +
           'QAmyiissxReZdtNNnCI8TY+wCWoHkm0aGXuPUuxVFzs7p0C2AQdt/' +
           'nrGH5Msbx7rw+l3jPCfxYhWBUcfvcyOKw3urfp8erjiITjnwhSxro' +
           'kl38PBIRwfaDuW9pyGqsBh2MJtYBLwvIYqCyo4bOc4r00pc8iz1KS' +
           '95MM/hBXN7vu1fZooH5S88paGYq1kz0kHzL3FrHOZ19G99o0cKtvS' +
           'BLPKp+Gm/zlUCvGv5xdCwRWZ');
    end;

    begin
    end.

    Now that we have the bitmap declared and ready for use, lets search for it!
    If you look at your list of Bitmap function, you will see
    "function FindBitmapToleranceIn(bitmap: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; tolerance: Integer): Boolean;"
    And you guessed it, this is what we will use to search for the willow log in the RuneScape inventory.

    This function my seem complicated, but really it is extremely easy to use. To start off, lets make a procedure to find our bitmap, so creat a new procedure and lets name it "FBitmap". So our script should look like this:
    SCAR Code:
    program New;

    var
     WillowLog2: integer;

    procedure LoadBitmap;
    begin
     WillowLog2 := BitmapFromString(31, 25, 'beNqtlkFLAzEUhJujWBS' +
           'V6qUHeyhqUcuKFUUKVihUFEVRoSAUPPn/f4GzjAyv+zZpsLvMoTTd' +
           'L5O8eUlbrfWesKymnpJ22N3o9zYH/fbwZOvyfLshfhBzPNq9Lnagb' +
           'HhIC5zJzR6wVnnw8l1YguANDmUS9gAB1isPHt4eBx/Pp1/vw+m4Q3' +
           'mUhjRK+EGnneSH7/kF9XC37/kWa0U4VpcPt3yJ31sJvnJbBF98Fpb' +
           'vmRJWhHKssl0PT4g7RtsoeryV/mImuN2cGJPxZq6gyW3vqug6fmAj' +
           'QAmyiissxReZdtNNnCI8TY+wCWoHkm0aGXuPUuxVFzs7p0C2AQdt/' +
           'nrGH5Msbx7rw+l3jPCfxYhWBUcfvcyOKw3urfp8erjiITjnwhSxro' +
           'kl38PBIRwfaDuW9pyGqsBh2MJtYBLwvIYqCyo4bOc4r00pc8iz1KS' +
           '95MM/hBXN7vu1fZooH5S88paGYq1kz0kHzL3FrHOZ19G99o0cKtvS' +
           'BLPKp+Gm/zlUCvGv5xdCwRWZ');
    end;

    procedure FBitmap;
    begin

    end;

    begin

    Now let me show you how to fill out the function 'FindBitmapToleranceIn':
    bitmap: Integer; - This is the name of you bitmap, in this case "WillowLog2"
    var x, y: Integer; - These are the variables that will be returned for the position of the found bitmap, this is useful when you want to click the bitmap, or interact with it after it is found.
    Integer; x1, y1, x2, y2: Integer; - These are the coordinates for the "box" that SCAR will search for the bitmap in. This is very useful to not only save time when searching for bitmaps (because SCAR has to search less of the selected client), but also reduces memory usage and lag. In our case, since we are searching for the willow logs in the inventory, we will be using the coordinateness 560, 214, 734, 457
    tolerance: Integer - this is the amount that the color can change and still be recognized, you want as low a number as possible, so you don't have other colors interfering. I recommend a tolerance of about 20 - 30.

    Ok so now that we understand the different parts of 'FindBitmapToleranceIn', lets fill it out and add it to our script. So lets add:
    Code:
    FindBitmapToleranceIn(WillowLog2, x, y, 560, 214, 734, 457, 25);
    to our script:
    SCAR Code:
    program New;

    var
     WillowLog2: integer;

    procedure LoadBitmap;
    begin
     WillowLog2 := BitmapFromString(31, 25, 'beNqtlkFLAzEUhJujWBS' +
           'V6qUHeyhqUcuKFUUKVihUFEVRoSAUPPn/f4GzjAyv+zZpsLvMoTTd' +
           'L5O8eUlbrfWesKymnpJ22N3o9zYH/fbwZOvyfLshfhBzPNq9Lnagb' +
           'HhIC5zJzR6wVnnw8l1YguANDmUS9gAB1isPHt4eBx/Pp1/vw+m4Q3' +
           'mUhjRK+EGnneSH7/kF9XC37/kWa0U4VpcPt3yJ31sJvnJbBF98Fpb' +
           'vmRJWhHKssl0PT4g7RtsoeryV/mImuN2cGJPxZq6gyW3vqug6fmAj' +
           'QAmyiissxReZdtNNnCI8TY+wCWoHkm0aGXuPUuxVFzs7p0C2AQdt/' +
           'nrGH5Msbx7rw+l3jPCfxYhWBUcfvcyOKw3urfp8erjiITjnwhSxro' +
           'kl38PBIRwfaDuW9pyGqsBh2MJtYBLwvIYqCyo4bOc4r00pc8iz1KS' +
           '95MM/hBXN7vu1fZooH5S88paGYq1kz0kHzL3FrHOZ19G99o0cKtvS' +
           'BLPKp+Gm/zlUCvGv5xdCwRWZ');
    end;

    procedure FBitmap;
    var
     x, y :integer;
    begin
     FindBitmapToleranceIn(WillowLog2, x, y, 560, 214, 734, 457, 25);
    end;

    begin
    end.
    As you might have noticed, I have added the variables 'x' and 'y' to the "Local variables", you need to do this in order for this script to compile and work. "Local Variables" work the same as Global Variables except they can't be used outside of the specified procedure/function.

    Now You just add our procedure 'Fbitmap' to the mainline, and there you go, you have your very own bitmap searching script.

    Congratulations!

  4. #4
    Join Date
    Feb 2006
    Location
    Pennsylvania
    Posts
    1,524
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Design tips:

    When you want to leave notes to the user of your script like this:
    Code:
    program script;
    
    const
    Message1='Hello world!';
    
    procedure Hello;
    begin
      wait(1000)
      Writeln(Message1); // this says hello
    end;
    
    begin
     repeat
      hello;
     until(false)
    end.
    Now you will notice that I used "//". This tells SCAR not to include what comes after the "//" in the script.
    Now if you don't feel like using "//" every time you want to comment on something, then you can use " { " and " } ". examples of both.

    with //:

    Code:
    program script;
    
    const
    Message1='Hello world!';
    
    procedure Hello;
    begin
      wait(1000)
      Writeln(Message1); // this says hello wolrd!
    end;
    
    begin
     repeat
      hello;
     until(false)
    end.
    with { and }:
    Code:
    { 
      This a script in scar that will say
       Hello world!
    }
    
    
    program script;
    
    const
    Message1='Hello world!';
    
    procedure Hello;
    begin
      wait(1000)
      Writeln(Message1);  { this says hello}
    end;
    
    
    begin
     repeat
      hello;
     until(false)
    end.
    You will notice that with { and } that you can do multiple lines where as with // you can not with out constantly typing "//" over and over.

  5. #5
    Join Date
    Feb 2006
    Location
    Pennsylvania
    Posts
    1,524
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Update: 07-30-08 - I fixed the images is the bitmap tutorial and tweaked a few things I said. I plan on doinging more improvments soon.

  6. #6
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Dang! Hot tutorial!

    P.S - Why do people reserve...?
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  7. #7
    Join Date
    Mar 2007
    Posts
    3,681
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by SantaClause View Post
    Dang! Hot tutorial!

    P.S - Why do people reserve...?
    so they can edit later

    and Bebe nice TUT!

  8. #8
    Join Date
    Feb 2006
    Location
    Pennsylvania
    Posts
    1,524
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by SantaClause View Post
    Dang! Hot tutorial!

    P.S - Why do people reserve...?
    Because I'm not done just yet

    @hugolord Thank you

  9. #9
    Join Date
    Jun 2007
    Location
    Ohio
    Posts
    341
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thx for the guide bebe

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

    Default

    Your tutorials are always so descriptive. ;DD

  11. #11
    Join Date
    May 2006
    Location
    GMU
    Posts
    1,101
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Wow, best tutorial on here. GJ, you get a sticker
    I like it because it actually explains what things like constants and variables are. So many other tuts are like:

    "Ok, type

    const
    i=1;

    which makes i equal to 1"
    Hey lady, I need a yank! Ha ha, dislocation.

  12. #12
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,823
    Mentioned
    3 Post(s)
    Quoted
    25 Post(s)

  13. #13
    Join Date
    Jul 2007
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm sorry man. I just have to ask the people this one question. Does anyone here understand this script that DOES NOT know how to script? I just started using SRL scripts and I don't want to feel like a leech so I want to take up scripting.

    Maybe it's just me or the fact that I'm really tired - Played volleyball all day and it's 1:30 - I just don't understand

  14. #14
    Join Date
    Mar 2007
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It isnt just you brettw_nero.
    i started using scripts and started feeling like a lecher to so i thought id read through a tut but i just have no clue what to do

    i was tryin to see how to make scripts so i could try making a willow cutter/banker but i dont think that i will be able to do that for years of practice

  15. #15
    Join Date
    Jul 2007
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah. I was also thinking of making a willow cutter/banker... I found the ones already on this site were useless. Too many errors with them

  16. #16
    Join Date
    Jul 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    is it just me or being 14 and learning this stuff really hard to learn lol... i learnt the first part :saying words lol had some good fun with that HECK YEAH EASY and bitmap had a bit of trouble...but i didnt get mine to work but got urs to work tho :S

  17. #17
    Join Date
    Jun 2007
    Location
    Hell Stream
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, Scripting is fun and it do help a lot but the main problem of yours will be try to learning programming coz its the source of learning scripting in scar. As it won't be happen in a single click, learning scripting is a long way to go and you must have a fate in yourself. lol

  18. #18
    Join Date
    Jul 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I am reasonably new to scripting (havn't made a useful script), and I thought the tutorial was good, but not finished. I know more about bitmaps and functions, but only about 1 feature of bitmaps. I would also like to see more about clicking.
    Great job .

  19. #19
    Join Date
    Jul 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    how would you use it to click on the object?

  20. #20
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    good tut thx alot man

  21. #21
    Join Date
    Jul 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    very very nice my scar always does this error BUT i figure it out...Line 31: [Error] (31:1): Semicolon (';') expected in script so i put a semicolon all around the area and then i forgot to put a semicolon after Procedure FBitmap; and that fixed it?

  22. #22
    Join Date
    Jul 2007
    Location
    UK
    Posts
    175
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    looks a real nice big and detailed tut ill be sure to read it thanks for the tut.

    edit - read it all great tut thnx!

  23. #23
    Join Date
    Feb 2007
    Location
    behind you, with a GUN
    Posts
    60
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nicve tutorial, but i have now got a headache and my eyes are hurting... im serious!!

    i demand for you to pay me for new eyes!

  24. #24
    Join Date
    Jul 2007
    Posts
    98
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)
    Hey i have read a bit of the tutorial, and it is really helpful,

    but, i get a "Failed when compiling"

    Failed when compiling
    Line 8: [Error] (8:1): Unknown identifier 'WriteIn' in script

    please answer as fast as possible so i can continue this tutorial

    Thanks.

    EDIT: Here is the script i done so far from this tutorial~

    Code:
    program Script;
    
    Const
    Message1='Hello World!';
    
    Procedure Hello;
    begin
    WriteIn(Message1);
     End;
    
    
    Begin
    Repeat
    Hello;
    Until(False)
    
    end.


    P.S.

    The tutorial ROCKS


    EDIT2: Found the problem, think that one space " " can do so much difference O.o


    ~~ Skalla ~~

  25. #25
    Join Date
    Aug 2007
    Location
    irc://irc.rizon.net:6667/srl
    Posts
    1,566
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Ty! This helped me out alot lol I already knew a how to do bitmaps & dtm's + write a message or 2 in the debug box, but that was about it

    "Far better it is to dare mighty things, to win glorious triumphs, even though checkered by failure, than to take rank with those poor spirits who neither enjoy much nor suffer much because they live in the gray twilight that knows neither victory nor defeat."
    — Theodore Roosevelt

Page 1 of 16 12311 ... LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Tutorial for the "Beginner Scripter". With video aid.
    By Wanted in forum Outdated Tutorials
    Replies: 63
    Last Post: 07-26-2010, 04:59 PM
  2. Beginner
    By Ejjman in forum Graphics and Multimedia
    Replies: 1
    Last Post: 11-16-2007, 08:56 AM
  3. C++ Beginner Tut
    By Macrosoft in forum C/C++ Help and Tutorials
    Replies: 31
    Last Post: 10-28-2007, 11:15 PM
  4. Help with beginner questions.
    By pdw40893 in forum OSR Help
    Replies: 9
    Last Post: 02-24-2007, 08:09 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
  •