Page 1 of 5 123 ... LastLast
Results 1 to 25 of 120

Thread: Simplistic Beginners Guide To RS3 Scripting

  1. #1
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Question Simplistic Beginners Guide To RS3 Scripting


    Simplistic Beginners Guide To RS3 Scripting
    Updated: 12th May 2015


    This tutorial is designed to give you a very basic overview of RS3 scripting. You may be aware of my AIO RS3 and SRL6 scripting tutorial, but it may be a bit complicated if you’re just starting out. This tutorial is short and sweet, and sufficient to give you a basic understanding of the main SRL-6 (the include we use for RS3) scripting techniques.

    This tutorial is split into the following sections:
    1. Simba basics
    2. Mouse basics
    3. MainScreen basics
    4. Backpack basics
    5. Minimap basics
    6. BankScreen basics
    7. ActionBar basics
    8. DepositBox basics
    9. LodestoneScreen basics
    10. ToolScreen basics
    11. ProductionScreen basics
    12. ProgressScreen basics
    13. PowersScreen basics
    14. ConversationBox basics
    15. Chatbox basics
    16. CollectBox basics
    17. GrandExchange basics
    18. LootScreen basics


    NOTE: I'm still working on the last 2 or 3 sections, and I plan to add a section on logging in your player etc.

    Please leave a comment if this has helped you, or if you have any questions




    1) Simba Basics

    Printing to the debug box

    The first thing you need to know is how to write text to the debug box (the box at the bottom of the simba GUI). This is done using the writeLn command (which means write on a new line). Take a look at this example:





    You also need to know how to clear the debug box. This is done using the clearDebug() command. In the following example I clear the debug and then print Goodbye, meaning the first line I wrote gets cleared before I print the second line:



    Wait a second!

    Next you should know how to wait. Using waits in your script is very useful, especially if you are learning. This is done using the wait(milliseconds) command. This example is similar to that above, except it waits 3 seconds before printing goodbye.





    It is also important to know that waiting for an exact amount of time is not very human like, so it is better to wait for a random amount of time. We do this using the randomRange(min, max) procedure. The following snippet is exactly the same as the previous one, except it waits for a random amount of time between 1 and 4 seconds:





    Understanding coordinates

    Understand coordinates is important as each location on your screen has its own coordinates (x and y). See in the bottom left corner of simba there are 2 numbers inside parentheses. These are the current (x, y) coordinates of your mouse. Move your mouse and see how they change. These are the current coordinates of your mouse:






    2) Mouse and Clicking Basics

    Moving and clicking the mouse is quite important (obviously). I’ll show you some of the different ways to do that. You can move and/or click a point on the screen (if you know the x and y coordinates) or you move/click anywhere inside a box. Before we get into that, first you need to know the 3 different mouse actions:

    MOUSE_MOVE
    MOUSE_LEFT
    MOUSE_RIGHT

    The first one just moves the mouse, the second one left clicks the mouse, and the final one right clicks the mouse. These are used inside the following mouse functions.

    Moving the mouse and clicking a point

    This function moves the mouse to point(x, y) and will then click the mouse depending on the mouseAction you select:

    Simba Code:
    mouse(x, y, mouseAction);

    Let’s say I wanted to move the mouse to point (100, 100) and not click. I could use:

    Simba Code:
    mouse(100, 100, MOUSE_MOVE);

    If I wanted to move the mouse to point(100, 100) and then right click, I would use this:

    Simba Code:
    mouse(100, 100, MOUSE_RIGHT);

    This is demonstrated in the picture below. This will load SMART and move the mouse to point 100, 100 on the login screen (this also demonstrates a how a procedure works – see AIO tutorial). Write this in simba and press play if you want to test it! Make sure you write everything, including the $DEFINE and $I lines at the top (I explain these below).





    Sometimes it is good to have a little bit of randomness when moving the mouse so the mouse doesn't land in exactly the same spot every time. This can be achieved with this function:

    Simba Code:
    mouse(x, y, ranX, ranY, mouseAction);

    This is the same as above, except is has ranX and ranY, which is the randomness (in pixels) it will add to x and y. If I wanted to move the mouse to point(100, 100) with a randomness of 5 pixels in each direction (so x = 100-105 and y = 100-105) I would use:

    Simba Code:
    mouse(100, 100, 5, 5, MOUSE_MOVE);

    Now let’s say you wanted to just click the mouse without moving it. You can use fastClick(mouseAction) for this. For example, to left click the mouse without moving it:

    Simba Code:
    fastClick(MOUSE_LEFT);

    Now let’s put the things you've learn so far together. This snippet combines mouse moving, mouse clicking, writing text, and waiting (copy and paste this into simba and press run). If you were wondering, the {$DEFINE SMART} and {$I SRL-6/SRL.simba} at the top are just to include the SMART and SRL files from your C:/simba folder. The setupSRL() procedure at the start of the main loop loads all the files that you just included.

    Simba Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure practiceMouse();
    begin
      mouse(200, 200, MOUSE_MOVE);
      wait(3000);
      mouse(50, 50, MOUSE_MOVE);
      wait(3000);
      fastClick(MOUSE_RIGHT);
      writeLn('We just right clicked');
      wait(3000);
      mouse(300, 30, MOUSE_MOVE);
    end;

    begin
      clearDebug();
      setupSRL();
      practiceMouse();
    end.


    Moving the mouse and clicking inside a box

    The previous section you learnt how to move the mouse and click a point. The other way to move and/or click a mouse is inside a box. The good thing about this method is the mouse moves anywhere inside the box, so you don't need randomness.

    A box is made up of 2 points – the top left corner and bottom right corner of the box. Even though a box has 4 corners, you only need to know 2 points to make a box. See this picture taken from my AIO tutorial:





    In simba, a box variable is called a TBox, and is made up of 4 integers (i.e., 2 coordinates for each point). Here I make a box out of integers:

    Simba Code:
    intToBox(x1, y1, x2, y2);

    The following is an example of declaring a TBox variable called myBox and assigning 4 integers to it:

    Simba Code:
    procedure makeMyBox();
    var
      myBox: TBox; // Created a TBox variable called myBox
    begin
      myBox := intToBox(10, 10, 50, 50); // Assigned these coordinates to the myBox variable
    end;

    Now that you know how to make a box, let’s move the mouse inside that box. You do this using the mouseBox function:

    Simba Code:
    mouseBox(box, mouseAction);

    where box is a Tbox, and mouseAction is one of the 3 mouseActions described above.

    If you are wondering how to get the coordinates for your box, you can simply use the coordinates displayed in the bottom left corner of simba (like I showed you above). If you are selecting coordinates from the SMART client (which you probably are), remember to drag the cross-hair from simba to SMART (so the coordinates start counting from the top left corner of the SMART window and not your desktop). The cross-hair looks like this:



    Time for a practical example. Let’s create a box around the settings button on the runescape login screen, and then move the mouse inside that box and left click. This will open up the settings screen.





    Simba Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure practiceBox();
    var
      settingsButton: TBox; //declare TBox variable
    begin
      settingsButton := intToBox(735, 80, 750, 100); // Top left, bottom right points
      mouseBox(settingsButton, MOUSE_LEFT); // Left click the box we just made
    end;

    begin
      clearDebug();
      setupSRL();
      practiceBox();
    end.

    If you run the following code, you will see it clicks the settings button and opens up the settings menu! Now I’ll show you another way to click a box. Instead of declaring a TBox variable and putting that variable inside the mouseBox function, you can create a box directly inside the mouseBox function. This example will open up the settings menu like before, wait 4 seconds, and then click the X to close it using another mouseBox:

    Simba Code:
    procedure practiceBox();
    var
      settingsButton: TBox; // Declare TBox variable
    begin
      settingsButton := intToBox(735, 80, 750, 100);
      mouseBox(settingsButton, MOUSE_LEFT);
      wait(4000);
      mouseBox(intToBox(630, 105, 640, 115), MOUSE_LEFT); // Notice how I made the box inside the mouseBox function
    end;

    Well done, now you know all about moving and clicking the mouse! Welcome to the l33t club of RS pro scripters. InB4AIODungScript.





    3) Main Screen Basics

    Here at SRL we refer to the screen where your player is as the mainScreen. In this section we will cover how to change the angle of the mainScreen, how to find objects (using colour finding), and how to check if text matches.


    Changing the mainScreen angle

    Changing the angle is useful as you probably want to make the angle high (like a birds eye view) after you login, as this makes it easier to play the game. You can change the mainScreen angle using the function:

    Simba Code:
    mainScreen.setAngle(angle);

    There are 2 angles built in to SRL-6. Each of these has a picture to demonstrate.

    MS_ANGLE_LOW:





    MS_ANGLE_HIGH:





    This snippet will set the angle high, wait 3 seconds, and then set the angle low (try it if you want - just login manually):

    Simba Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure changeAngleBoss();
    begin
      mainScreen.setAngle(MS_ANGLE_HIGH);
      wait(3000);
      mainScreen.setAngle(MS_ANGLE_LOW);
    end;

    begin
      clearDebug();
      setupSRL();
      changeAngleBoss();
    end.


    Finding objects on the mainScreen

    Now let’s find objects on the screen and click them. Before we get into finding colours, let's do a quick section on text recognition. Recognising text is very important as it's used to recognise objects, NPC and items. When you hover your mouse over an object, a box pops up. We call this the mouseOverText. If I hover over this Evergreen Tree, this is the mouseOverText:





    Next we have the chooseOption menu. This is different to the mouseOverText so don't confuse them. The chooseOption menu pops up when you right click. If I right click an Evergreen Tree, this is the chooseOption menu:





    Remember what both the mouseOverText and chooseOptions look like as we will use them later. Now let’s use a very general object finding function. This is the simplest form of the mainScreen.findObject function:

    Simba Code:
    mainscreen.findObject(x, y, color, tolerance, mouseOverText, mouseAction);

    We are going to attempt to right click an Evergreen Tree and select the 'Chop down Evergreen' option from the chooseOption menu. First we need to pick some colours of the tree. The image below is a screenshot of Auto Colour Aid (ACA), which we use to pick colours. If you don't know how to use this (or need to download it), please look at ACA section in my AIO tutorial (it's about half way down). These are the colours I have picked from the tree (notice I’m just using CTS1 here - I'm only interested in the color and the RGB tolerance on the left of ACA).





    I need to put the colour and tolerance from ACA into that mainScreen.findObject function. I also need to put the mouseOverText and mouseAction. The mouseOverText can be any part of the text that appears in the mouseOverText pop up box (see picture above). I've chosen to use 'vergreen'. Note that text is case sensitive, meaning that 'Chop Tree' is not the same as 'Chop tree'. Since I’m right clicking the tree, the mouse action is MOUSE_RIGHT. I've put this together:

    Simba Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure clickTree();
    var
      x, y: integer; //we need to declare these variables since findObject outputs/requires these
    begin
      if mainscreen.findObject(x, y, 925721, 11, ['vergreen'], MOUSE_RIGHT) then
      begin
        writeLn('We right clicked a tree!'); // If findObject returns true, this will print
        chooseOption.select(['hop down']); // This will choose ‘Chop down’ in chooseOptions menu
      end;
    end;

    begin
      clearDebug();
      setupSRL();
      clickTree();
    end.

    If I run this it will successfully find and click 1 evergreen tree. Try it if you want (you should probably pick your own colours). Note that this object finding function is very basic and can be a little bit unreliable in some cases. My AIO tutorial covers more advanced object finding techniques.





    4) Backpack Basics

    In this section we are going to cover the basics of dealing with the backpack.


    Moving and clicking a backpack slot

    First of all I’ll tell you how to move the mouse to a backpack slot and click. You could create your own mouseBox function like we did above, but there are easier ways already built into the SRL-6 include.

    Take a look at the following function:

    Simba Code:
    tabBackPack.mouseSlot(slot, mouseAction);

    This can move and/or click any slot in the backPack. The slot parameter can be any number between 1 and 28, and the mouseAction you already know (move, left or right click). Look at the following picture:





    If I wanted to move the mouse to the first backpack slot and hover over the logs I would use this:

    Simba Code:
    tabBackPack.mouseSlot(1, MOUSE_MOVE);

    Let’s combine a few things you've learnt already. I want to right click the item in the first slot and drop it, but only if it's a log. If I had a party hat in the first slot (which I normally do, obviously) I wouldn't want to drop that by mistake, so we need to check the mouseOverText first.

    Simba Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure dropItem();
    begin
      tabBackPack.mouseSlot(1, MOUSE_MOVE); // Move mouse to slot 1

      if isMouseOverText(['raft Logs']) then // If text matches then start the next 'begin..end block'
      begin
        fastClick(MOUSE_RIGHT);    // Right click
        chooseOption.select(['rop Logs']); // Choose the drop option
        writeLn('We dropped a log!');
      end else
        writeLn('There wasn''t a log in slot 1'); // If the mouseOverText didn't match, this will print instead

    end;

    begin
      clearDebug();
      setupSRL();
      dropItem();
    end.

    Now you know how to move the mouse, left click, right click, check mouseOverText and select an option from the chooseOptions menu for any slot in the backpack! Now I will go over a few other useful backpack functions.


    Waiting for the backpack count to change

    The following function waits up to a maximum time for the backpack count to change:

    Simba Code:
    tabBackPack.waitForShift(waitTime);

    If I clicked a tree and I wanted to wait for a maximum of 5 seconds for the logs to appear in my inventory I would do this (and by max time I mean if you got logs after 1 second it would stop waiting).

    Simba Code:
    tabBackPack.waitForShift(5000);

    For example, in the clickTree() procedure I wrote above, I could simply add this line after I click the tree to wait for a log to appear in my backpack.

    Simba Code:
    procedure clickTree();
    var
      x, y: integer;
    begin
      if mainscreen.findObject(x, y, 925721, 11, ['vergreen'], MOUSE_RIGHT) then
      begin
        writeLn('We right clicked a tree!');
        chooseOption.select(['hop down']);
        tabBackPack.waitForShift(5000); // After we click tree, wait for logs to appear
      end;
    end;


    Checking if the backPack is full

    Another useful function is tabBackPack.isFull(), which returns true if the backpack has an item in every slot. This is useful in many situations, such as if you’re mining or woodcutting and you want to keep mining until the backpack is full. Let’s use the example above of clicking the Evergreen Tree. I can make it repeat that procedure until the backpack is full.

    Simba Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure clickTree();
    var
      x, y: integer;
    begin
      if mainscreen.findObject(x, y, 925721, 11, ['vergreen'], MOUSE_RIGHT) then
      begin
        writeLn('We right clicked a tree!');
        chooseOption.select(['hop down']);
        tabBackPack.waitForShift(5000);
      end;
    end;

    begin
      clearDebug();
      setupSRL();

      repeat
        clickTree(); // Repeat this procedure until we have 28 logs
      until tabBackPack.isFull();

    end.


    Dropping items in the backPack

    The last inventory function I’ll show you is how to easily drop items. There are a number of ways to drop items, such as dropping everything, different drop patterns, or only dropping specific slots. These are all accomplished with the function:

    Simba Code:
    tabBackPack.dropItems();

    There are a number of different dropping patterns. For example, I could drop all items in order starting at slot 1 all the way to slot 28, or I could start at slot 28 and work backwards. These are the drop patterns built into SRL-6:

    DROP_PATTERN_REGULAR (slot 1 to 28)
    DROP_PATTERN_BACKWARDS (slot 28 to 1)
    DROP_PATTERN_SNAKE (slot 1 to 5, 10 to 6, 11 to 20, etc.)
    DROP_PATTERN_UP_DOWN (Moves down the columns; slot 1, 6, 11, 16, 21, 26, 2, 7 etc.)

    If I wanted to drop everything in order from slot 1 to slot 28 I would write:

    Simba Code:
    tabBackPack.dropItems(DROP_PATTERN_REGULAR);


    I can also drop only certain slots by putting all the slots I want to drop in an array. For example, if I wanted to drop slots 1, 3, 10, and 20 I could go:

    Simba Code:
    tabBackPack.dropItems([1, 3, 10, 20]);

    Let’s put this in our script to complete a basic power chopper! (like, OMG totally cool).

    Simba Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure clickTree();
    var
      x, y: integer;
    begin
      if mainscreen.findObject(x, y, 925721, 11, ['vergreen'], MOUSE_RIGHT) then
      begin
        writeLn('We right clicked a tree!');
        chooseOption.select(['hop down']);
        tabBackPack.waitForShift(5000);
      end;
    end;

    begin
      clearDebug();
      setupSRL();

      repeat // Notice the 2 repeat loops (1 repeats the whole script, 1 the chop tree procedure only)

        repeat
          clickTree();
        until tabBackPack.isFull();

        tabBackPack.dropItems(DROP_PATTERN_SNAKE); // Once backpack is full, it will drop everything

      until false; // Until false means it will repeat this loop forever

    end.

    Well done on creating your first runescape script for RS3. You can now tell all of your friends you are a "pro scriptwriter".





    5) Minimap Basics

    In this section I want to cover the minimap. There are two functions I want to explain here; how to rotate the compass, and how to find and click minimap symbols.





    Rotating the compass

    Rotating the compass is done using the function:

    Simba Code:
    minimap.setAngle(angle);

    There are 4 angles already built in to SRL-6. These are:

    MM_DIRECTION_NORTH
    MM_DIRECTION_SOUTH
    MM_DIRECTION_EAST
    MM_DIRECTION_WEST

    If I wanted to make the compass north I would go:

    Simba Code:
    minimap.setAngle(MM_DIRECTION_NORTH);

    I could also move it to any angle I wanted by writing the actual angle (from 0 to 360). For example, if I wanted it between North and East (i.e., 45 degrees) I would go:

    Simba Code:
    minimap.setAngle(45);

    Clicking minimap symbols

    Minimap symbols are found using this function:

    Simba Code:
    minimap.findSymbol(var TPoint, symbol, searchBox);

    You can see the function takes 3 parameters, which I'll take you through below. The second parameter is the symbol you want to find. There are ~94 symbols in SRL-6, these are some of them (the full list with images can be found in this thread):


    MM_SYMBOL_TREE
    MM_SYMBOL_RUNECRAFTING
    MM_SYMBOL_MINING
    MM_SYMBOL_BANK
    MM_SYMBOL_LODESTONE

    The last parameter, searchBox, is a TBox where you want to look for the symbol (remember we created a TBox above). Instead of creating your own box around the minimap interface, SRL-6 has allows you to get the boundaries of any interface (mainscreen, chatBox, etc.) by using:

    Simba Code:
    .getBounds()

    So to get a TBox around the minimap interface I can use:

    Simba Code:
    minimap.getBounds()

    I want to find and click the lodestone symbol, so I will use MM_SYMBOL_LODESTONE for the symbol:



    So far my function looks like this:

    Simba Code:
    minimap.findSymbol(var TPoint, MM_SYMBOL_LODESTONE, minimap.getBounds());

    Now I'll explain the first parameter var TPoint. The var in front of the parameter means that it is an OUTPUT parameter, not INPUT parameter like the others. Basically, the coordinates of the symbol it finds are stored in this variable which you can use later (remember a TPoint is made up of X and Y coordinates).

    As the TPoint is an output parameter, we need to declare a TPoint variable which will store the information it receives from the findObject function. You'll see below I've declared a TPoint called "myPoint". When it finds the lodestone symbol, the X and Y coordinates are stored in "myPoint". I then left click "myPoint" to make my player run to the symbol:

    Simba Code:
    procedure clickTheLodestone();
    var
      myPoint: TPoint; // I've declared this TPoint.
    begin
      minimap.findSymbol(myPoint, MM_SYMBOL_LODESTONE, minimap.getBounds());
     
      mouse(myPoint, MOUSE_LEFT); // Now we click 'myPoint' (the above function stored the coordinates of the symbol in 'myPoint');
    end;





    6) Bank Screen Basics

    In this section I want to cover the basics with the bankScreen. This will include how to open and close the bank, and how to deposit and withdraw items. This is the RS3 bankScreen:






    Opening and closing the bank

    It is actually quite easy to open the bank as there is already a function built into SRL-6. This function is:

    Simba Code:
    bankScreen.open(bankType);

    where the bankType is the type of bank you are opening. The valid options for this are:


    BANK_NPC_BLUE
    BANK_NPC_GREY
    BANK_NPC_GREEN
    BANK_NPC_DRAYNOR
    BANK_BOOTH
    BANK_CHEST_SW
    BANK_CHEST_SHANTAY
    BANK_CHEST_DUEL
    BANK_CHEST_CW
    BANK_CHEST_GROTTO
    BANK_TABLE_BURTHORPE
    BANK_CHEST_LUMBRIDGE

    For example, I'm standing in Varrock West Bank and I want to open the bank:






    Since the bankers are blue, I would use the function:

    Simba Code:
    bankScreen.open(BANK_NPC_BLUE);

    Closing the bank is a lot easier. You just use the function:

    Simba Code:
    bankScreen.close();


    Depositing items

    These are a number of ways to deposit items. I'll show you 3 ways: quick deposit, certain slots, and the preset buttons. There are other ways too, such as finding DTMs or bitmaps, but I won't cover those now.

    The first function is the quickDeposit:

    Simba Code:
    bankScreen.quickDeposit(depositType);

    Where the depositType parameter is the quick deposit button you want to click. There are 4 buttons, which are:


    QUICK_DEPOSIT_INVENTORY
    QUICK_DEPOSIT_EQIUPMENT
    QUICK_DEPOSIT_BOB
    QUICK_DEPOSIT_MONEY_POUCH

    For example, if I wanted to deposit all 28 of these logs into the bank, I would want to quick click the QUICK_DEPOSIT_INVENTORY button, like so:

    Simba Code:
    bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);





    The second method is to deposit certain slots. If there are items which you don't want to deposit, it is best to deposit certain slots by using the function:

    Simba Code:
    bankScreen.deposit(slots);

    The slots parameter is an integer array (a set of numbers as opposed to an individual number). Arrays are filled inside square brackets. Here are a few examples of how I can fill this in:


    [1..28] will deposit all slots from 1 to 28
    [2..28] will ignore slot 1 and deposit the rest
    [1, 2, 10] will deposit slots 1, 2 and 10, and ignore the rest.

    Take the following example. I want to deposit the logs only, and ignore slot 1 (my axe) and slot 28 (my small pile of coins). I would write:

    Simba Code:
    bankScreen.deposit([2..27]);





    The last method I'm going to show you is the preset buttons. You have to setup your presets in-game before using these. The good thing about this method it that it deposits, withdraws, and closes the bank all at the same time. This is the function:

    Simba Code:
    bankScreen.clickButton(button);

    Where the button parameter is one of the following:


    BANK_BUTTON_PRESET_1
    BANK_BUTTON_PRESET_2

    For example, if I wanted to click the first preset button, I would use this:

    Simba Code:
    bankScreen.clickButton(BANK_BUTTON_PRESET_1);





    Withdrawing items

    There is one function you need to know when withdrawing items, which is:

    Simba Code:
    bankScreen.withdraw(slot, amount, mouseOverText);

    Where the slot is the bank slot number, the mouseOverText you already know, and the amount is any number OR one of the following:


    WITHDRAW_AMOUNT_ALL
    WITHDRAW_AMOUNT_ALL_BUT_ONE

    Bank slots start in the top left at 1, and go across the rows, and then down the columns. Like so:





    The 3rd parameter, the mouseOverText, just double checks that the item in the slot is the one you want to withdraw. You can leave this blank to ignore the text and withdraw any item. If I wanted to withdraw all of the coins I would go:

    Simba Code:
    bankScreen.withdraw(20, WITHDRAW_AMOUNT_ALL, ['oins']);

    Or if I wanted to withdraw 25 items in slot 8 (in this case law runes) I could go:

    Simba Code:
    bankScreen.withdraw(8, 25, ['']);

    Putting it all together

    Now I'm going to put together everything you've learnt about the bankScreen into one simple program. Let's say I'm making a script that fletches logs into bows. I want to do the following:

    1. Open the bank at Varrock West
    2. Deposit everything in my inventory
    3. Withdraw 28 oak logs, which are in slot 10
    4. Close the bank


    Read the following snippet and try and understand it:

    Simba Code:
    program exampleBank;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure doBankingStuff();
    begin

      if bankScreen.open(BANK_NPC_BLUE) then // Open the bank
      begin
        bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY); // Press the quick deposit button
        wait(randomRange(1000, 2000));
        bankScreen.withdraw(10, WITHDRAW_AMOUNT_ALL, ['']); // Withdraw all from slot 10
        wait(randomRange(1000, 2000));
        bankScreen.close(); // Close the bank
      end else
        writeLn('Couldn''t find the bank for some reason!');

    end;

    begin
      clearDebug();
      setupSRL();
      doBankingStuff();
    end.

    I could also achieve the same result using the preset buttons (if I have setup my preset in-game previously):

    Simba Code:
    program exampleBank;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure doBankingStuff();
    begin

      if bankScreen.open(BANK_NPC_BLUE) then
        bankScreen.clickButton(BANK_BUTTON_PRESET_1) // This deposits, withdraws, and closes the bank
      else
        writeLn('Couldn''t find the bank for some reason!');
       
    end;

    begin
      clearDebug();
      setupSRL();
      doBankingStuff();
    end.



    7) ActionBar Basics

    In this section I want to cover the actionBar. I'll show you how to click (and key press) actionBar slots, how to reading the player's HP/Adrenaline/Prayer/Summoning percent, and enable or disable auto-retaliate.




    Clicking an actionBar slot


    To click an actionBar slot using the mouse, you could make a mouseBox like we did right at the beginning, but you should use this function:

    Simba Code:
    actionBar.clickSlot(slot, mouseAction)

    Where the slot is a number from 1 to 14, and the mouseAction you should already know from above.

    If I wanted to left click the slice ability (in slot 1), I would write:

    Simba Code:
    actionBar.clickSlot(1, MOUSE_LEFT)

    To actually type '1' using the keyboard instead of clicking with the mouse, I can use this function:

    Simba Code:
    typeSend(text, pressEnter)

    The first parameter is a string, and the second is a boolean, so to type 1 and not press enter, I would write:

    Simba Code:
    typeSend('1', false)

    Getting the players HP/Adrenaline/Prayer/Summoning percentage


    You can return the players current HP percent (and the other stats) as an integer. Each of these stats has a slightly different function, but they are used in exactly the same way:

    Simba Code:
    actionBar.getHPPercent();
    actionBar.getAdrenalinePercent();
    actionBar.getPrayerPercent();
    actionBar.getSummoningPercent();

    If I wanted to print my current HP percent I could write:

    Simba Code:
    program actionBarExample;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure actionBarTest();
    var
      myHP: integer;
    begin
      myHP := actionBar.getHPPercent(); // Now the 'myHP' variable is holding our current HP
      writeLn(myHP);
    end;

    begin
      clearDebug();
      setupSRL();
      actionBarTest();
    end.

    Enabling or disabling auto-retaliate


    You can enable of disable auto-retaliate by clicking the retaliate button. To do this we use the function:

    Simba Code:
    actionBar.setRetaliate(enabled);

    The 'enabled' parameter is a boolean, so it can be either True or False. If I wanted to enable retaliate I would write:

    Simba Code:
    actionBar.setRetaliate(True);




    8) DepositBox Basics

    In this section I want to cover the depositBox. This is basically the same as the bankScreen section above, so I will quickly skim over this without going into too much detail. I'll show you how to deposit items by clicking them, and by using the deposit buttons at the bottom of the interface.




    Depositing items in the DepositBox


    The first method is by using the quick deposit button. The button you will use the most is the inventory button:

    Simba Code:
    depositBox.quickDeposit(QUICK_DEPOSITBOX_INVENTORY);

    Just like the bankScreen, there are 3 other constants which you can use instead of the INVENTORY button:

    QUICK_DEPOSITBOX_EQUIPMENT
    QUICK_DEPOSITBOX_BOB
    QUICK_DEPOSITBOX_MONEY_POUCH

    The next deposit method is to click the actual items. Again, this is identical to the bankScreen code, except you are calling it through the depositBox interface type. To deposit slots 2 to 28 I would write:

    Simba Code:
    depositBox.deposit([2..28]);

    Once you have finished depositing items, you can close the depositBox by writing:

    Simba Code:
    depositBox.close();




    9) LodestoneScreen Basics

    In this section I want to cover the lodestoneScreen. I'll show to show you how to lodestone teleport to any location.




    Lodestone teleporting


    Teleporting via the lodestone network is very easy in SRL-6. There is just one function you need to be familiar with.

    Simba Code:
    lodestoneScreen.teleportTo(location);

    This function opens the lodestoneScreen and clicks the location you set. The location can be one of 23 locations. Here are some examples:

    LOCATION_EDGEVILLE
    LOCATION_FALADOR
    LOCATION_PORT_SARIM
    LOCATION_VARROCK
    LOCATION_DRAYNOR_VILLAGE
    LOCATION_LUMBRIDGE

    If I wanted to teleport to Varrock I would write:

    Simba Code:
    lodestoneScreen.teleportTo(LOCATION_VARROCK);

    This function also checks that the lodestone is unlocked, and that it isn't P2P, so you don't try and click something that you cannot.




    10) ToolScreen Basics

    In this section I'll cover the ToolScreen, which is the interface that pops up when you first click a log, or try and use a needle for crafting. I'll show you how to select a tool from this interface.




    Selecting a tool


    There are two ways to select a tool. You can either select a tool using a string (i.e., the name of the tool, like 'Needle'), or the slot number where the tool is located. Here are two ways to select the Knife in the above image:

    Simba Code:
    toolScreen.select('Knife');

    And since the knife is in the second position, I can use the integer:

    Simba Code:
    toolScreen.select(2);

    I'll cover the next 2 interfaces before combining these in a practical example.




    11) ProductionScreen Basics

    In this section I want to cover the ProductionScreen, which is used in many skills, such as smithing, cooking, and fletching. Firstly, I'll show you how to select an item, and then click the start button.




    Selecting an item


    To select an item, all you need to know is what slot the product is in. Like all the slots in SRL-6, they start at the top-left, go across the row, and then down to the next column. If I wanted to click the arrow shafts in the above image, I would write:

    Simba Code:
    productionScreen.selectBox(1);

    Clicking the start button


    Once the item is selected, then you most likely want to press the start button. This is very simple, and all you have to write is:

    Simba Code:
    productionScreen.clickStart();

    Once you click the start button, the progressScreen will open (which is covered in the next section).




    12) ProgressScreen Basics

    In this section I'll cover the ProgressScreen. The only thing that you really want to do with the progressScreen is wait until it's no longer open, or until the 'Cancel' button changes to the 'Done' button.




    Wait until the progressScreen is no longer open


    All interfaces in SRL-6 (like the bankScreen, depositBox, lodestoneScreen etc.) have a boolean function:

    Simba Code:
    .isOpen(waitTime);

    This function returns true if the interface is open. The 'waitTime' parameter is optional, and it's used if you want to wait a few seconds for the interface to open. You can use the result of this function to tell when the progressScreen (or any other interface) is no longer open. In the following snippet, I will put together some of the code you've already learnt from the backpack, toolScreen, productionScreen, and progressScreen interfaces:

    Simba Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}

    procedure makeSomeArrowShafts();
    begin

      tabBackpack.mouseSlot(1, MOUSE_LEFT); // Left click backpack slot 1 (e.g., logs)

      if toolScreen.isOpen(2000) then  // If the toolScreen is open within 2 seconds, click the Knife
        toolScreen.select('Knife');
     
      if productionScreen.isOpen(5000) then // If productionScreen is open within 5 seconds
      begin
        productionScreen.selectBox(1);     // Select the first box (arrow shafts)
        productionScreen.clickStart();     // Click the start button

        if progressScreen.isOpen(5000) then // if progressScreen is open within 5 seconds
        begin
          writeLn('The progressScreen is open!');

          repeat
            wait(1000);
          until (not progressScreen.isOpen()); // Repeat waiting 1 second until it's not open anymore

        end;

      end;

    end;

    begin
      clearDebug();
      setupSRL();
      makeSomeArrowShafts();
    end.

    You could literally combine this little script with the woodcutting example in the above section, and you just about have a fully functional arrow shaft maker! Or you could combine this with the banking snippet above to cut bows, cut gems, crush chocolate...whatever you want!


    Getting the progressScreen button


    If you want your script to be a little bit faster, you can wait for the progressScreen 'Done' button (or until the 'Cancel' button is no longer present). You can get the current button using the function:

    Simba Code:
    progressScreen.getButton();

    Instead of waiting until the progressScreen is no longer open, I could change that loop to wait until the button is not equal to the cancel button:

    Simba Code:
    repeat
      wait(1000);
    until (progressScreen.getButton() <> PROGRESS_BUTTON_CANCEL);




    13) PowersScreen Basics

    In this section I'll cover the PowersScreen, which is mainly used in combat related scripts. Using this interface, you can change your combat mode (e.g., momentum, revolution), modify the experience types for each combat style (e.g., defence XP for ranged combat style), and add abilities to the action bar.




    Selecting a combat mode


    In RS3 there are now 3 combat modes: Full Manual, Revolution, and Momentum, as seen on the left side of the image above. You can set the combat mode using the function:

    Simba Code:
    powersScreen.setCombatMode(combatMode);

    The combat mode can be one of the following:


    MODE_MANUAL
    MODE_REVOLUTION
    MODE_MOMENTUM

    If I wanted to set my player's combat mode to momentum (like it is in the above image), I would write:

    Simba Code:
    powersScreen.setCombatMode(MODE_MOMENTUM);

    These powersScreen functions automatically open the powersScreen if it's not already open, making it very easy for you as a scripter.

    Setting combat experience


    On the right-hand side of the above image, there are different XP selection settings, for each of the three combat styles. You can set the experience type, for a particular combat style using the function:

    Simba Code:
    powersScreen.setCombatExperience(combatStyle, ExperienceType);

    The combat style can be one of the following:


    MELEE_STYLE
    RANGED_STYLE
    MAGIC_STYLE

    and the ExperienceType can be one of the following:


    XP_BALANCED
    XP_RANGED_AND_DEFENCE
    XP_MAGIC_AND_DEFENCE
    XP_ATTACK
    XP_STRENGTH
    XP_RANGED
    XP_MAGIC
    XP_DEFENCE

    For example, if I wanted to set my player's melee combat style to defence XP, I would write:

    Simba Code:
    powersScreen.setCombatExperience(STYLE_MELEE, XP_DEFENCE);

    This function also prevents you from doing something silly, like setting the melee combat style to rangedXP.


    Adding abilities to the actionBar


    A great feature of the powersScreen is the ability to add abilities to the actionBar for customised setups. There are over 140 different abilities that you can add to the actionBar with the following function:

    Simba Code:
    powersScreen.addAbilityToActionBar(ability, slot);

    The 'slot' parameter is the actionBar slot number where you want to add the ability. If an ability already exists in the slot, it will clear the previous ability before adding the new one. The ability parameter can be one of many, here are some examples:


    PS_SLICE
    PS_HAVOC
    PS_AIR_BOLT
    PS_VARROCK_TELEPORT
    PS_LVL_6_ENCHANT

    As I said, there are over 140 different abilities. The full list can be found in the spoiler below:

    PowersScreen Ability List

    { Attack Abilities }
    PS_SLAUGHTER
    PS_SLICE
    PS_OVERPOWER
    PS_HAVOC
    PS_BACKHAND
    PS_FORCEFUL_BACKHAND
    PS_SMASH
    PS_BARGE
    PS_FLURRY
    PS_SEVER
    PS_HURRICANE
    PS_MASSACRE
    PS_METEOR_STRIKE
    PS_BALANCED_STRIKE

    { Strength Abilities }
    PS_STOMP
    PS_KICK
    PS_PUNISH
    PS_DISMEMBER
    PS_FURY
    PS_DESTROY
    PS_QUAKE
    PS_BERSERK
    PS_CLEAVE
    PS_ASSAULT
    PS_DECIMATE
    PS_PULVERISE
    PS_FRENZY

    { Ranged Abilities }
    PS_PIERCING_SHOT
    PS_SNAP_SHOT
    PS_DEADSHOT
    PS_SNIPE
    PS_DAZING_SHOT
    PS_BINDING_SHOT
    PS_NEEDLE_STRIKE
    PS_TIGHT_BINDINGS
    PS_FRAGMENTATION_SHOT
    PS_ESCAPE
    PS_RAPID_FIRE
    PS_RICOCHET
    PS_BOMBARDMENT
    PS_INCENDIARY_SHOT
    PS_UNLOAD
    PS_DEATHS_SWIFTNESS

    { Magic Abilities }
    PS_ASPHYXIATE
    PS_WRACK
    PS_OMNIPOWER
    PS_DRAGON_BREATH
    PS_SONIC_WAVE
    PS_IMPACT
    PS_CONCENTRATED_BLAST
    PS_DEEP_IMPACT
    PS_COMBUST
    PS_SURGE
    PS_DETONATE
    PS_CHAIN
    PS_WILD_MAGIC
    PS_METAMORPHOSIS
    PS_TSUNAMI
    PS_SUNSHINE

    { Magic Combat Spells }
    PS_AIR_STRIKE
    PS_CONFUSE
    PS_WATER_STRIKE
    PS_EARTH_STRIKE
    PS_WEAKEN
    PS_FIRE_STRIKE
    PS_AIR_BOLT
    PS_CURSE
    PS_BIND
    PS_WATER_BOLT
    PS_EARTH_BOLT
    PS_FIRE_BOLT
    PS_AIR_BLAST
    PS_WATER_BLAST
    PS_SNARE
    PS_SLAYER_DART
    PS_EARTH_BLAST
    PS_FIRE_BLAST
    PS_DIVINE_STORM
    PS_AIR_WAVE
    PS_WATER_WAVE
    PS_VULNERABILITY
    PS_EARTH_WAVE
    PS_ENFEEBLE
    PS_FIRE_WAVE
    PS_STORM_OF_ARMADYL
    PS_ENTANGLE
    PS_POLYPORE_STRIKE
    PS_STAGGER
    PS_AIR_SURGE
    PS_WATER_SURGE
    PS_TELEPORT_BLOCK
    PS_EARTH_SURGE
    PS_FIRE_SURGE

    { Magic Teleport Spells }
    PS_HOME_TELEPORT
    PS_MOBILISING_ARMIES_TELEPORT
    PS_VARROCK_TELEPORT
    PS_LUMBRIDGE_TELEPORT
    PS_FALADOR_TELEPORT
    PS_HOUSE_TELEPORT
    PS_CAMELOT_TELEPORT
    PS_ARDOUGNE_TELEPORT
    PS_WATCHTOWER_TELEPORT
    PS_GOD_WARS_DUNGEON_TELEPORT
    PS_TROLLHEIM_TELEPORT
    PS_APE_ATOLL_TELEPORT
    PS_TELE_OTHER_LUMBRIDGE
    PS_TELE_OTHER_FALADOR
    PS_TELE_OTHER_CAMELOT

    { Magic Skilling Spells }
    PS_ENCHANT_CROSSBOW_BOLT
    PS_LVL_1_ENCHANT
    PS_BONES_TO_BANANAS
    PS_LOW_LEVEL_ALCHEMY
    PS_LVL_2_ENCHANT
    PS_TELEKINETIC_GRAB
    PS_SUPERHEAT_ITEM
    PS_LVL_3_ENCHANT
    PS_HIGH_LEVEL_ALCHEMY
    PS_CHARGE_WATER_ORB
    PS_LVL_4_ENCHANT
    PS_BONES_TO_PEACHES
    PS_CHARGE_EARTH_ORB
    PS_CHARGE_FIRE_ORB
    PS_CHARGE_AIR_ORB
    PS_LVL_5_ENCHANT
    PS_LVL_6_ENCHANT

    { Defensive Abilities }
    PS_ANTICIPATION
    PS_BASH
    PS_REVENGE
    PS_PROVOKE
    PS_IMMORTALITY
    PS_FREEDOM
    PS_REFLECT
    PS_RESONANCE
    PS_REJUVENATE
    PS_DEBILITATE
    PS_PREPARATION
    PS_BARRICADE

    { Constitution Abilities }
    PS_WEAPON_SPECIAL_ATTACK
    PS_REGENERATE
    PS_SIPHON
    PS_INCITE


    For example, if I wanted to put the slice melee ability into the first actionBar slot (as in the image above) I would write:

    Simba Code:
    powersScreen.addAbilityToActionBar(PS_SLICE, 1);





    14) ConversationBox Basics

    In this section I'll cover the ConversationBox. The conversationBox appears when ever you are talking to someone, and sometimes when you get game notifications. Sometimes you need to proceed through the conversation by clicking the continue button, and selecting conversation options.

    Pressing the continue button




    Simba Code:
    conversationBox.continue(spaceBar, wait);

    Simba Code:
    conversationBox.continue(True, True);

    Selecting a conversation option




    Simba Code:
    conversationBox.selectOption(2);

    Simba Code:
    conversationBox.selectOption(['PIN']);




    15) ChatBox Basics

    In this section I'll cover the ChatBox.




    Reading the XP Bar



    Simba Code:
    chatBox.getXPBar();


    Finding text on lines



    Simba Code:
    chatBox.findTextOnLines(['ello'], [1..5]);





    16) CollectBox Basics

    In this section I'll cover the CollectBox.




    Pressing a collect button



    Simba Code:
    collectBox.collectButton(button);


    COLLECT_BUTTON_BANK
    COLLECT_BUTTON_INV

    Simba Code:
    collectBox.collectButton(COLLECT_BUTTON_BANK)




    17) GrandExchange Basics

    GrandExchange compatibility was recently added to SRL-6, and in this section I'll show you how to buy and sell items, and how to look-up prices.





    Selling an item on the GE


    Selling an item is very easy, and can be done with the function:

    Simba Code:
    grandExchange.sellItem(packSlot, price, quantity);

    The first parameter is the backpack slot where the item you're selling is located. In the above image, you can see I have 1000 noted Swamp toads in the first backpack slot, so packSlot would be 1.

    The 'price' parameter is a string; valid options are:
    • 'mid'
    • '-5'
    • '+5'
    • Any other number


    The 'quantity' parameter is a string; valid options are:
    • '1'
    • '10'
    • '100'
    • 'all'
    • Any other number


    So if I wanted to sell all of my Swamp toads at 5% above the current mid price, I would write:

    Simba Code:
    grandExchange.sellItem(1, '+5', 'all');

    and if I wanted to sell 50 of them for 2000 each, I would write:

    Simba Code:
    grandExchange.sellItem(1, '2000', '50');

    Buying an item on the GE


    Buying an item is similar to selling an item; the function is:

    Simba Code:
    grandExchange.buyItem(itemName, price, quantity);

    The itemName is the name of the item you are buying (make sure it's accurate). The only difference to the 'price' and 'quantity' parameters when buying an item is that there is no 'All' option for the quantity (as you cannot buy 'all' of an item).

    The 'price' parameter is a string; valid options are:
    • 'mid'
    • '-5'
    • '+5'
    • Any other number


    The 'quantity' parameter is a string; valid options are:
    • '1'
    • '10'
    • '100'
    • Any other number

    If I wanted to buy 5000 Swamp toads at mid price, I would write:

    Simba Code:
    grandExchange.buyItem('Swamp toad', 'mid', '5000');

    Looking up the price of an item


    With the following function you can return the current mid price of any item on the grand exchange:

    Simba Code:
    grandExchange.getPrice(item);

    The 'item' parameter is an integer; it's ID number.

    For example, if I wanted to find the price of a Swamp toad, I would use Swamp toad's ID, which is 2150:

    Simba Code:
    grandExchange.getPrice(2150);

    Item IDs can be found on the on the item's Grand Exchange webpage. The webpage for Swamp toads is:

    http://services.runescape.com/m=item...em.ws?obj=2150

    and you will notice the last 4 digits of the URL are the item's ID number. Alternatively, you could look up IDs at itemdb.biz




    18) Loot Screen Basics

    Recently Jagex added the loot screen as a new way to collect drops. In this section I'll show you some of the lootScreen methods available to you.




    Looting certain slots


    You can loot an individual slot with:
    Simba Code:
    lootScreen.lootSlot(1);

    Or you can loot an array of slots with:
    Simba Code:
    lootScreen.lootSlots([1, 2, 3, 14]);

    Looting DTMs


    I haven't covered how to make a DTM in this tutorial, so if you don't know how to make an item DTM you better go and read my AIO Beginners Guide!

    To loot a single DTM:
    Simba Code:
    lootScreen.lootDTM(MyDTM);

    Or you can loot an array of DTMs:
    Simba Code:
    lootScreen.lootDTMs([BonesDTM, CoinsDTM]);

    Both of these methods will loot ALL of the matching DTMs.

    Using the loot buttons


    Simba Code:
    lootScreen.clickButton(LOOT_BUTTON_ALL);

    Simba Code:
    lootScreen.clickButton(LOOT_BUTTON_CUSTOM);

    So to give you an example snippet:

    Simba Code:
    procedure lootStuff();
    begin
      // if mainScreen.findObject(.....) // Clicking ground loot
     
      if lootScreen.isOpen(5000) then
      begin
        lootScreen.lootSlots([1, 2, 3, 4]);
        writeLn('We just looted the first 4 slots');
        lootScreen.close();
      end;

    end;



    Last edited by The Mayor; 05-14-2015 at 07:33 AM. Reason: Added lootScreen

  2. #2
    Join Date
    Jan 2013
    Location
    United kingdom
    Posts
    102
    Mentioned
    4 Post(s)
    Quoted
    34 Post(s)

    Default

    Much appreciated, Mayor! This will be unimaginably useful! Loving the Evergreen pic XD
    Last edited by beefman; 06-15-2014 at 06:41 PM.

  3. #3
    Join Date
    Dec 2011
    Posts
    266
    Mentioned
    16 Post(s)
    Quoted
    185 Post(s)

    Default

    This is even more noob-friendly than your AIO tut. Wish we had this a few months ago when I started lol. Oh well, at least this gives me a "back in my day, we didn't have all this fancy..." :P

    Great guide, good job.

  4. #4
    Join Date
    Jun 2014
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    None of the code is working for me? The writeLn and stuff works, but when it involves launching SMART nothing works. The cameras don't move, the mouse does not move to click on the options on the one part nothing. Any help?

  5. #5
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by SeaHorseShooter View Post
    None of the code is working for me? The writeLn and stuff works, but when it involves launching SMART nothing works. The cameras don't move, the mouse does not move to click on the options on the one part nothing. Any help?
    Have you included SMART and SRL6 at the top of the script?

    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}


    and have you

    setupSRL();

    in your Main Loop?

  6. #6
    Join Date
    Jun 2014
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    Have you included SMART and SRL6 at the top of the script?

    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}


    and have you

    setupSRL();

    in your Main Loop?
    I have typed exactly what you have and even tried to paste the code you have into simba
    Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.simba}
    
    procedure practiceMouse();
    begin
      mouse(200, 200, MOUSE_MOVE);
      wait(3000);
      mouse(50, 50, MOUSE_MOVE);
      wait(3000);
      fastClick(MOUSE_RIGHT);
      writeLn('We just right clicked');
      wait(3000);
      mouse(300, 30, MOUSE_MOVE);
    end;
    
    begin
      clearDebug();
      setupSRL();
      practiceMouse();
    end.
    even tried with the camera code, still didn't work I have no clue whats wrong.

  7. #7
    Join Date
    Jun 2014
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    does not even say in the console 'We just right clicked'.

  8. #8
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by SeaHorseShooter View Post
    does not even say in the console 'We just right clicked'.
    Either your interfaces are not set correctly, or your graphics settings are not correct. I assume you have run a rs3 script before? I can TV you if you like? Skype the.mayor.rs

  9. #9
    Join Date
    Jun 2014
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    Either your interfaces are not set correctly, or your graphics settings are not correct. I assume you have run a rs3 script before? I can TV you if you like? Skype the.mayor.rs
    I got it working! Turns out I messed up some stuff on my graphics settings. Thank you!

  10. #10
    Join Date
    Jun 2014
    Posts
    65
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default

    What a very well written and in-depth guide. A nice slow introduction to from the basics to the nitty gritty to set almost anyone with at least half a brain to scripting delight. It would be bad to not say thanks, so thank you!

  11. #11
    Join Date
    May 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Excellent guide, but I'm trying to get my banking down, the depositing is working okay but whenever I try to withdraw anything I get this

    Exception in Script: Runtime error: "The given DTM Index[1] doesn't exist" at line 701, column 20 in file "C:\Simba\Includes\srl-6\lib\utilities\wrappers.simba"
    The following bitmaps were not freed: [Minimap Mask]
    File[C:\Simba\Includes\SRL-6/logs/SRL log (11-07-14 at 05.33.10 PM).txt] has not been freed in the script, freeing it now.

    any help would be great

  12. #12
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by aquatic fish View Post
    Excellent guide, but I'm trying to get my banking down, the depositing is working okay but whenever I try to withdraw anything I get this

    Exception in Script: Runtime error: "The given DTM Index[1] doesn't exist" at line 701, column 20 in file "C:\Simba\Includes\srl-6\lib\utilities\wrappers.simba"
    The following bitmaps were not freed: [Minimap Mask]
    File[C:\Simba\Includes\SRL-6/logs/SRL log (11-07-14 at 05.33.10 PM).txt] has not been freed in the script, freeing it now.

    any help would be great
    Post your code.

  13. #13
    Join Date
    May 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Code:
    program Suhsuhsoopaheetin;
    {$DEFINE SMART}
    {$i srl-6/srl.simba}
    
    Var
    x, y:integer;
    CastBox, CoalBagBox, CoalBagDrop: TBox;
    
    
    Procedure Graphics;
      begin
        minimap.setAngle(MM_DIRECTION_SOUTH);
      end;
    Procedure MakingBoxes;
      begin
        CastBox := intToBox(630, 365, 662, 392);
        CoalBagBox := intToBox(600, 90, 630, 120);
        CoalBagDrop := intToBox(595, 143, 643, 156);
        //CoalWithdraw :=
        //RuniteWithdraw :=
      end;
    
    Procedure SuperHeating;
    
      begin
        MouseBox(CastBox, MOUSE_MOVE);
        If (isMouseOverText(['unite ore']))then
          begin
            repeat
              KeyDown(49);
                Wait(randomRange(20, 25));
              Keyup(49);
                Wait(randomRange(50, 150));
              fastclick(MOUSE_LEFT);
                Wait(randomRange(1500, 350));
            until
              (isMouseOverText(['une bar']));
          end;
       end;
    
    //Procedure OpeningBank;
      //begin
      //end;
    
    Procedure Banking;
    
    
      Var
        Coal, Runite, Runebar: Integer;
    
      begin
        Coal := 1;
        Runite := 2;
        RuneBar :=3;
        bankScreen.deposit([3..8]);
          wait(randomRange(150, 350));
        bankScreen.withdraw(Coal, WITHDRAW_AMOUNT_ALL);
          wait(randomRange(150, 350));
        MouseBox(CoalBagBox, MOUSE_RIGHT);
          wait(randomRange(10, 100));
        MouseBox(CoalBagDrop, MOUSE_MOVE);
          wait(randomRange(10, 100));
            fastclick(MOUSE_LEFT);
          wait(randomRange(150, 350));
        bankScreen.withdraw(Runite, 5);
          wait(randomRange(150, 350));
        bankScreen.withdraw(Coal, WITHDRAW_AMOUNT_ALL);
      end;
    begin
      clearDebug();
      setupSRL();
      Graphics();
      MakingBoxes();
      Banking();
      //SuperHeating();
      TerminateScript();
    end.
    edited:
    Even if i commented out the integers and set the withdraw to just 1 or 2 or w/e, I get the same error
    Last edited by Penguin; 07-12-2014 at 01:30 AM.

  14. #14
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by aquatic fish View Post

    edited:
    Even if i commented out the integers and set the withdraw to just 1 or 2 or w/e, I get the same error
    Ahh. Sorry I forgot the last parameter in the withdraw function (mouseOverText). I've updated it

  15. #15
    Join Date
    May 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Ah, Thank you

  16. #16
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    69
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Nice one mayor! Btw a little spelling error just under the picture for withdrawing items in bank. Says "mosueOverText" well written guide though!!
    I want to make a working script. Lets hope i can be bothered anytime soon

  17. #17
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by Crit View Post
    Nice one mayor! Btw a little spelling error just under the picture for withdrawing items in bank. Says "mosueOverText" well written guide though!!
    DemTypos. I never raed what I type.

  18. #18
    Join Date
    Jul 2014
    Posts
    135
    Mentioned
    0 Post(s)
    Quoted
    55 Post(s)

    Default

    This is fantastic beginners guide to RS3 scripting, I found it to be great in explaining the language and using different aspects of it. Great job!

  19. #19
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    This is wonderful. Reminds me of Griff's SRL-5 tutorial, which I used to begin scripting.
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Bad™ before everyone gets laser pistols

  20. #20
    Join Date
    Jul 2014
    Posts
    1
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm new to this. Tried to start up SMART, and this shows on the debug panel:

    Code:
    -- setupSRL()
    ---- Setting up SRL...
    ---- initSmart():
    ------ Attempting to pair to a previously spawned client
    ------ smartPairToExistingClient():
    -------- Found no free clients to pair to
    ------ smartPairToExistingClient(): result = false
    ------ Attempting to spawn a new client..
    ------ smartCreateClient():
    ---------- smartGetParameters(): Succesfully grabbed paramters
    -------- getJavaPath():
    ---------- Attempting to search for your Java path
    ---------- ERROR: Failed To Find Path: C:\Program Files (x86)\Java\
    ---------- WARNING: Failed to find your Java path
    ---------- HINT: If RS is failing to switch to OpenGL mode, add JRE to your systems path before JDK (if you have JDK)
    -------- getJavaPath()
    -------- Using parameters [http://world12.runescape.com/, f52784816396786405]
    -------- Using plugins "OpenGL32.dll"
    -------- FATAL ERROR: Failed to spawn a SMART client
    Successfully executed.
    What do I do?

  21. #21
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    Thanks a lot for this mayor, im a new user trying to script and your guides are awesome and really well explained

  22. #22
    Join Date
    Jul 2014
    Location
    Europe
    Posts
    182
    Mentioned
    7 Post(s)
    Quoted
    103 Post(s)

    Default

    This must be the best guide that I've ever read, everything is explained really well. You're a good person.

  23. #23
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by theorange View Post
    This is fantastic beginners guide to RS3 scripting, I found it to be great in explaining the language and using different aspects of it. Great job!
    Quote Originally Posted by KeepBotting View Post
    This is wonderful. Reminds me of Griff's SRL-5 tutorial, which I used to begin scripting.
    Quote Originally Posted by undorak7 View Post
    Thanks a lot for this mayor, im a new user trying to script and your guides are awesome and really well explained
    Quote Originally Posted by Spaceblow View Post
    This must be the best guide that I've ever read, everything is explained really well. You're a good person.
    Why thank you

  24. #24
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    180
    Mentioned
    14 Post(s)
    Quoted
    101 Post(s)

    Default

    Im trying to follow this guide as I want to learn to script but for some reason, some of the code you're showing here doesnt want to compile in my simba.

    For example, I type FastClick(Mouse_left); And it says 'Unknown declaration "fastclick" at line 3, column 1"
    Anything wrong here or have the declarations been changed to something different.

    I've updated the extensions and simba, but no go.

    Thanks for any help!

  25. #25
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by luispadron View Post
    Im trying to follow this guide as I want to learn to script but for some reason, some of the code you're showing here doesnt want to compile in my simba.

    For example, I type FastClick(Mouse_left); And it says 'Unknown declaration "fastclick" at line 3, column 1"
    Anything wrong here or have the declarations been changed to something different.

    I've updated the extensions and simba, but no go.

    Thanks for any help!
    Well, fastClick is a function built into SRL6, so you have to 'include' the SRL6 files at the top of your script to give simba access to them. Make sure you have:

    {$I SRL-6/SRL.simba}

    at the top, and then

    setupSRL

    at the start of your main loop, just like it shows you.

Page 1 of 5 123 ... LastLast

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
  •