Results 1 to 13 of 13

Thread: All-Proof - Looking at procedures

  1. #1
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,100
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default All-Proof - Looking at procedures

    THE SCAR

    Looking at Procedures

    If you appreciate this tutorial, please provide the author ("Dan's The Man") with more reputation

    NOTE: Do NOT attempt to use a procedure which contains MoveMouse or ClickMouse, as these will get you banned. The only purpose they're in this tutorial is for educational purposes. Please refer to other tutorials on how to implement SRL into your script for more human-like purposes.

    Introduction:
    This chapter takes you through the use and wonders of procedures. "The Scar", walks you through what to use procedures for and when. This information is vital for all scripters. If you don't know then you should read on as this is one of the steps on your way to becoming a more advanced scripter into the customized pascal language, SCAR.

    Requirements:

    Contents:
    1. What are procedures
    2. When to use procedures
    3. Setting up a basic procedure
    4. Use of correct formatting
    5. Receiving Errors and Fixing Them

    1 - What are procedures:
    Procedures are a way of doing a lot of things in the order you specify. You cannot do multiple things at once with a procedure, the same is with a function. They do not supply you with a boolean, integer, string or extended when called. Procedures need to be contained with at least 5 or more lines, they do not have to but that is the proper way of procedure formatting. As if you do, what is the point in having that procedure? You have to ask yourself that very question, as there is absolutely no point because you can just add those lines instead of writing that procedures name.

    2 - When to use procedures:
    If you just want part of your script to do something, multiple times, without typing the same piece of text all over again, then a procedure is right for you. Ok, so you have decided to use a procedure, but if you only need to use that procedure once, then you should get rid of it. You must put the procedure above the part of script that you're going to use it in. If you're using that procedure in multiple parts of your script then you should put that procedure at the top most part of your script that you're using that procedure in.

    3 - Setting up a basic procedure:

    To setup a basic procedure, you must put the word procedure, then after procedure you put the name of that procedure. You cannot name the procedure the same name as another or the name of the script, variable or constant otherwise you will receive an 'Unknown Identifier' error when running the script. After the line that the word procedure is called, you have to put a begin. The next line is what your procedure contains. In this example, i will be making a procedure call MoveAndClick. So, it will obviously move the mouse to a specified location then it will click the mouse on that spot. So, after the begin i will put MoveMouse(x,y);, if you have a basic knowledge of SCAR then you'll understand what it does. Ok, so now i will want it to click the mouse at that location, but i want it it to wait before i click the mouse so i add Wait(1000); after MoveMouse(x,y); and i want it to left click so i'll add ClickMouse(x,y,True);. I'll add an end; to end my procedure. My new procedure looks like this:
    SCAR Code:
    procedure MoveAndClick;
    begin
      MoveMouse(x,y);
      Wait(1000);
      ClickMouse(x,y,True);
    end;
    See, that will move the mouse and click the mouse at coordinates x and y. But does the person, who is using the procedure, get to set the coordinates? No, they do not because we have not allowed them to enter their own details. We want them to be able to do that so we'll add some brackets after the name which lets the person input values. This is like MoveMouse, you have brackets after the word MoveMouse which contain the letters x and y which allows you to input the coordinate. To add brackets, after the name of that procedure put an (, now that is the start of your user input area. This area is just like being able to set variables, but without using x:=100;, instead you just replace x with whatever you want, as long as it is a number. I want to put the variable name as x and the other name as y, i will put them as an integer because they're numbers. So, now my new procedure looks like this:
    SCAR Code:
    procedure MoveAndClick(x, y: Integer);
    begin
      MoveMouse(x,y);
      Wait(1000);
      ClickMouse(x,y,True);
    end;

    4 - Use of correct formatting:

    Formatting, also called Standards, is what most scripters want to see in others scripts. The reason why it is mostly required is because it makes scripts more user friendly and it is better for more advanced scripters to look through the script then suggest things which are to be added or to be shortened.

    Ok, to start the formatting part of the tutorial. If you have a word that is bold in your scar script, the next line should contain two or three spaces after the first bolded word, not a symbol such as ; or . but an actual word that is bolded, such as if. If there you're adding a bolded word under another bolded word, then that bolded word does not require it to have two or three spaces. Only in the next line when a word that is not bolded should receive the extra indending.

    In "The Scar", the formatting tutorial is very basic as not much work has been achieved into that. So it is recommended you look at the Standards tutorial written by BamBam, it can be found in the SRL Forums: Tutorial Island section.

    5 - Receiving errors and fixing them:
    When you're creating your first procedure, you're most likely to get at least one error. This part of the tutorial will cover all, if not most, of the errors that will be displayed when you make a procedure.

    PPP = Any Value

    Unknown identifier 'PPP' in script:
    This means that you have made a mistake when making brackets. For example, in my procedure i put MoveMouse(x,y); and in the brackets i put (i, p: Integer);, it is only defining i and p as an integer and not x and y. So change that PPP to the correct letter.

    Type mismatch in script:
    This means that you have either declared a variable as a different type than what it should be. So you probably put, in your brackets, (x, y: String);, and have MoveMouse(x, y); in your procedure. X and Y in the MoveMouse procedure are actually Integers, which require numbers. So just change the variable type, in your brackets, to Integer and you'll get that procedure working.

    Semicolon (';') expected in script:
    What this error means is that you have not put a semicolon, ;, to where it should be. You need to put a semicolon after the brackets or the procedure name. An example of this error would be: procedure ClickAndMove, see how there is no semicolon. To simply fix this error, add a semicolon after the name, like this (The fix is underlined): procedure ClickAndMove;.

  2. #2
    Join Date
    Sep 2006
    Location
    include srl/srl.scar ( aussie)
    Posts
    2,878
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Very nice tut

    <3 Freddy1990
    <3 Hobbit
    <3 Widget
    <3 ZephyrsFury
    I have 1337 standards in scripts

  3. #3
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,798
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    How gay is this tutorial, WHY BOTHER MAKING IT@!@!@!

















    Kidding, GJ.

  4. #4
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,100
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by BobboHobbo View Post
    How gay is this tutorial, WHY BOTHER MAKING IT@!@!@!

















    Kidding, GJ.
    OMG, you're the gay one here.
    I'm kidding too... <_> Thanks

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

    Default

    good tut =]



  6. #6
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,100
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by Bonfield View Post
    good tut =]
    Thanks Bonfield
    Last edited by Daniel; 07-05-2010 at 04:44 AM.

  7. #7
    Join Date
    Jun 2007
    Location
    Liverpool ,Nsw,Australia
    Posts
    741
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by BobboHobbo View Post
    How gay is this tutorial, WHY BOTHER MAKING IT@!@!@!

















    Kidding, GJ.
    OMFGz0rs.....Bobbo Knows Html :O

    Favorited... I always start out good but i am to lazy to fix it....
    Quote Originally Posted by Darkmage View Post
    I got 2 questions'
    #1. When i run the script will it automatically pick up the mouse and move?

  8. #8
    Join Date
    Mar 2007
    Posts
    4,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  9. #9
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,100
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by NaumanAkhlaQ View Post
    congratz on your tutorial cup
    Thanks Nauman!

    @strikerx25: No, he knows BBCode

  10. #10
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,790
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hmm does html work?

    <html>
    <body>
    <font color="white">Hello?</font>
    </body>
    </html>

    Edit: Na he just knows BBCode .

  11. #11
    Join Date
    Jun 2007
    Location
    south park
    Posts
    1,121
    Mentioned
    0 Post(s)
    Quoted
    47 Post(s)

    Default

    A bit clumpled together maybe more examples?
    http://www.youtube.com/user/YoHoJoSRL
    Good scripting guides on youtube
    Formerly known as (djcheater)

  12. #12
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,100
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by djcheater View Post
    A bit clumpled together maybe more examples?
    There are quick examples in the text

    :'( No one has checked out my other tutorial

  13. #13
    Join Date
    Nov 2008
    Location
    East bay -- California
    Posts
    91
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for the help with the variables and mouse positions i might be able to incorporate this into a walking script

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. pking is coming back *have proof*
    By oliver1205 in forum Runescape News and General
    Replies: 28
    Last Post: 12-30-2007, 04:22 PM
  2. Proof Read PowerChopper.
    By kooldude in forum Scripting Help
    Replies: 7
    Last Post: 05-25-2007, 11:27 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
  •