SRL Archive - RS3 Beginner Scripting Tutorials

Simplistic Beginners Guide To RS3 Scripting


The Mayor

2014-06-15 03:43:28


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

[INDENT]Printing to the debug box

[INDENT]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:

[/INDENT]


Wait a second!

[INDENT]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:



[/INDENT]


Understanding coordinates

[INDENT]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:


[/INDENT]

[/INDENT]




2) Mouse and Clicking Basics

[INDENT]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:

[INDENT]MOUSE_MOVE
MOUSE_LEFT
MOUSE_RIGHT
[/INDENT]

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

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

mouse(x, y, mouseAction);

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

mouse(100, 100, MOUSE_MOVE);

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

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:

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:

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:

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.


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.
[/INDENT]


Moving the mouse and clicking inside a box

[INDENT]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:

intToBox(x1, y1, x2, y2);

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


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:

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.





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:


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.[/INDENT][/INDENT]





3) Main Screen Basics

[INDENT]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

[INDENT]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:

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):


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.
[/INDENT]


Finding objects on the mainScreen

[INDENT]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:

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:


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.
[/INDENT]
[/INDENT]





4) Backpack Basics

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


Moving and clicking a backpack slot

[INDENT]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:

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:

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.


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.[/INDENT]


Waiting for the backpack count to change

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

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).

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.


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;
[/INDENT]


Checking if the backPack is full

[INDENT]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.


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.
[/INDENT]


Dropping items in the backPack

[INDENT]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:

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:

[INDENT]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.)[/INDENT]

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

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:

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

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


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.
[/INDENT]

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





5) Minimap Basics

[INDENT]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

[INDENT]Rotating the compass is done using the function:

minimap.setAngle(angle);

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

[INDENT]MM_DIRECTION_NORTH
MM_DIRECTION_SOUTH
MM_DIRECTION_EAST
MM_DIRECTION_WEST
[/INDENT]

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

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:

minimap.setAngle(45);
[/INDENT]

Clicking minimap symbols

[INDENT]Minimap symbols are found using this function:

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):

[INDENT]
MM_SYMBOL_TREE
MM_SYMBOL_RUNECRAFTING
MM_SYMBOL_MINING
MM_SYMBOL_BANK
MM_SYMBOL_LODESTONE
[/INDENT]

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:

.getBounds()

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

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:

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:


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;

[/INDENT]
[/INDENT]





6) Bank Screen Basics

[INDENT]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

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

bankScreen.open(bankType);

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

[INDENT]
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
[/INDENT]

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:

bankScreen.open(BANK_NPC_BLUE);

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

bankScreen.close();
[/INDENT]


Depositing items

[INDENT]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:

bankScreen.quickDeposit(depositType);

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

[INDENT]
QUICK_DEPOSIT_INVENTORY
QUICK_DEPOSIT_EQIUPMENT
QUICK_DEPOSIT_BOB
QUICK_DEPOSIT_MONEY_POUCH
[/INDENT]

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:

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:

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:

[INDENT]
[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.
[/INDENT]

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:

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:

bankScreen.clickButton(button);

Where the button parameter is one of the following:

[INDENT]
BANK_BUTTON_PRESET_1
BANK_BUTTON_PRESET_2
[/INDENT]

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

bankScreen.clickButton(BANK_BUTTON_PRESET_1);


[/INDENT]



Withdrawing items

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

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:

[INDENT]
WITHDRAW_AMOUNT_ALL
WITHDRAW_AMOUNT_ALL_BUT_ONE
[/INDENT]

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:

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:

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

[/INDENT]

Putting it all together

[INDENT]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:


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):


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.

[/INDENT]
[/INDENT]



7) ActionBar Basics

[INDENT]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

[INDENT]
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:

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:

actionBar.clickSlot(1, MOUSE_LEFT)

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

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:

typeSend('1', false)
[/INDENT]

Getting the players HP/Adrenaline/Prayer/Summoning percentage

[INDENT]
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:


actionBar.getHPPercent();
actionBar.getAdrenalinePercent();
actionBar.getPrayerPercent();
actionBar.getSummoningPercent();

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


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.
[/INDENT]

Enabling or disabling auto-retaliate

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

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:

actionBar.setRetaliate(True);
[/INDENT]

[/INDENT]




8) DepositBox Basics

[INDENT]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

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

depositBox.quickDeposit(QUICK_DEPOSITBOX_INVENTORY);

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

[INDENT]QUICK_DEPOSITBOX_EQUIPMENT
QUICK_DEPOSITBOX_BOB
QUICK_DEPOSITBOX_MONEY_POUCH
[/INDENT]

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:

depositBox.deposit([2..28]);

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

depositBox.close();
[/INDENT]

[/INDENT]




9) LodestoneScreen Basics

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



Lodestone teleporting

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

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:

[INDENT]LOCATION_EDGEVILLE
LOCATION_FALADOR
LOCATION_PORT_SARIM
LOCATION_VARROCK
LOCATION_DRAYNOR_VILLAGE
LOCATION_LUMBRIDGE
[/INDENT]

If I wanted to teleport to Varrock I would write:

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.

[/INDENT]

[/INDENT]




10) ToolScreen Basics

[INDENT]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

[INDENT]
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:

toolScreen.select('Knife');

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

toolScreen.select(2);

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

[/INDENT]

[/INDENT]




11) ProductionScreen Basics

[INDENT]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

[INDENT]
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:

productionScreen.selectBox(1);
[/INDENT]

Clicking the start button

[INDENT]
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:

productionScreen.clickStart();

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

[/INDENT]




12) ProgressScreen Basics

[INDENT]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

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

.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:


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!
[/INDENT]


Getting the progressScreen button

[INDENT]
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:

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:


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

[/INDENT]

[/INDENT]




13) PowersScreen Basics

[INDENT]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

[INDENT]
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:

powersScreen.setCombatMode(combatMode);

The combat mode can be one of the following:

[INDENT]
MODE_MANUAL
MODE_REVOLUTION
MODE_MOMENTUM
[/INDENT]

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

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.
[/INDENT]

Setting combat experience

[INDENT]
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:

powersScreen.setCombatExperience(combatStyle, ExperienceType);

The combat style can be one of the following:

[INDENT]
MELEE_STYLE
RANGED_STYLE
MAGIC_STYLE
[/INDENT]

and the ExperienceType can be one of the following:

[INDENT]
XP_BALANCED
XP_RANGED_AND_DEFENCE
XP_MAGIC_AND_DEFENCE
XP_ATTACK
XP_STRENGTH
XP_RANGED
XP_MAGIC
XP_DEFENCE
[/INDENT]

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

powersScreen.setCombatExperience(STYLE_MELEE, XP_DEFENCE);

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


Adding abilities to the actionBar

[INDENT]
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:

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:

[INDENT]
PS_SLICE
PS_HAVOC
PS_AIR_BOLT
PS_VARROCK_TELEPORT
PS_LVL_6_ENCHANT
[/INDENT]

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

[SPOILER=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
[/SPOILER]

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

powersScreen.addAbilityToActionBar(PS_SLICE, 1);

[/INDENT]

[/INDENT]





14) ConversationBox Basics

[INDENT]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

[INDENT]

conversationBox.continue(spaceBar, wait);

conversationBox.continue(True, True);

[/INDENT]

Selecting a conversation option

[INDENT]

conversationBox.selectOption(2);

conversationBox.selectOption(['PIN']);

[/INDENT]

[/INDENT]




15) ChatBox Basics

[INDENT]In this section I'll cover the ChatBox.



Reading the XP Bar

[INDENT]

chatBox.getXPBar();


[/INDENT]

Finding text on lines

[INDENT]

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


[/INDENT]

[/INDENT]




16) CollectBox Basics

[INDENT]In this section I'll cover the CollectBox.



Pressing a collect button

[INDENT]

collectBox.collectButton(button);

[INDENT]
COLLECT_BUTTON_BANK
COLLECT_BUTTON_INV
[/INDENT]

collectBox.collectButton(COLLECT_BUTTON_BANK)

[/INDENT]

[/INDENT]




17) GrandExchange Basics

[INDENT]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

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

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.

[INDENT]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
[/INDENT]


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

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

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

grandExchange.sellItem(1, '2000', '50');

[/INDENT]

Buying an item on the GE

[INDENT]
Buying an item is similar to selling an item; the function is:

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).

[INDENT]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
[/INDENT]

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

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

[/INDENT]

Looking up the price of an item

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

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:

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=itemdb_rs/Swamp_toad/viewitem.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

[/INDENT]

[/INDENT]




18) Loot Screen Basics

[INDENT]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

[INDENT]
You can loot an individual slot with:
lootScreen.lootSlot(1);

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

[/INDENT]

Looting DTMs

[INDENT]
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:
lootScreen.lootDTM(MyDTM);

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

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

[/INDENT]

Using the loot buttons

[INDENT]
lootScreen.clickButton(LOOT_BUTTON_ALL);

lootScreen.clickButton(LOOT_BUTTON_CUSTOM);

So to give you an example snippet:


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;


[/INDENT]

[/INDENT]



beefman

2014-06-15 06:19:26

Much appreciated, Mayor! This will be unimaginably useful! Loving the Evergreen pic XD

Gunner

2014-06-15 11:20:02

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.

SeaHorseShooter

2014-06-20 02:29:25

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?

The Mayor

2014-06-20 02:34:38

From: SeaHorseShooter
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?

SeaHorseShooter

2014-06-20 14:37:40

From: The Mayor
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
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.

SeaHorseShooter

2014-06-20 14:38:41

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

The Mayor

2014-06-20 16:49:29

From: SeaHorseShooter
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

SeaHorseShooter

2014-06-20 17:56:03

From: The Mayor
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! :)

Truncheon

2014-07-02 15:19:17

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!

Penguin

2014-07-11 20:37:35

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 :)

The Mayor

2014-07-11 21:02:36

From: aquatic fish
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.

Penguin

2014-07-11 21:28:10

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

The Mayor

2014-07-11 22:00:31

From: aquatic fish


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 :)

Penguin

2014-07-11 22:02:56

Ah, Thank you :D

Crit

2014-07-21 08:32:29

Nice one mayor! Btw a little spelling error just under the picture for withdrawing items in bank. Says "mosueOverText" ;) well written guide though!!

The Mayor

2014-07-23 06:24:06

From: Crit
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.

theorange

2014-07-25 22:51:46

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!

KeepBotting

2014-07-27 19:27:29

This is wonderful. Reminds me of Griff's SRL-5 tutorial, which I used to begin scripting.

Korasi spec FTW

2014-07-30 04:07:33

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


-- 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?

Lipcot

2014-07-30 14:58:55

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

Spaceblow

2014-08-01 09:22:43

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

The Mayor

2014-08-03 00:40:48

From: theorange
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!


From: KeepBotting
This is wonderful. Reminds me of Griff's SRL-5 tutorial, which I used to begin scripting.


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


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


Why thank you :o

Adieux

2014-08-04 17:37:37

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!

The Mayor

2014-08-04 17:52:48

From: luispadron
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.

Adieux

2014-08-04 19:04:08

From: The Mayor
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.


Oh ok Sorry about that!
I got it to work thank you very much!

Adieux

2014-08-04 21:49:28

Sorry for posting again, trying to withdraw some maple logs
when I enter "aple" or "logs" as the mouse over text it opens bank, looks for the logs, but doesnt recognize it and it terminates the script.
I tried switching the item to fellstalk herbs and used that for mouse over text but it worked fine, just wont work with maple logs.

Any idea what might be going on?

lanadekat

2014-08-05 08:30:46

From: luispadron
Sorry for posting again, trying to withdraw some maple logs
when I enter "aple" or "logs" as the mouse over text it opens bank, looks for the logs, but doesnt recognize it and it terminates the script.
I tried switching the item to fellstalk herbs and used that for mouse over text but it worked fine, just wont work with maple logs.

Any idea what might be going on?

You can just put maple logs in slot 1 and use:
bankScreen.withdraw(1, WITHDRAW_AMOUNT_ALL, ['']);

1 = the bankslot, so you can put it in wathever bank slot you want.

Adieux

2014-08-05 12:31:41

From: lanadekat
You can just put maple logs in slot 1 and use:
bankScreen.withdraw(1, WITHDRAW_AMOUNT_ALL, ['']);

1 = the bankslot, so you can put it in wathever bank slot you want.


Yeah I was going to do this but, if the logs run out will the script keep withdrawing anything from slot 1?

theorange

2014-08-08 18:03:39

From: A Bit Poor
Yeah I was going to do this but, if the logs run out will the script keep withdrawing anything from slot 1?


Have the script check, after your withdraw function, to see what the backpack count is.
backpack.count()
Is what i think the function is, it will return an integer, if the number it returns is less than 28, break out of the script, as you have no more logs left in the bank.

Marius90

2014-08-17 10:40:02

Hi nice tutorial i learned a few things from here , anyway i wanted to make a script to spread ashes for prayer skill … i wanted to use the preset button code and action bar … and i cant find the action bar code … could somene help me please.
Thank You!

The Mayor

2014-08-17 17:07:52

From: Ionutz900
Hi nice tutorial i learned a few things from here , anyway i wanted to make a script to spread ashes for prayer skill … i wanted to use the preset button code and action bar … and i cant find the action bar code … could somene help me please.
Thank You!


I guess I could add an action bar section. To click slot 1:

actionBar.clickSlot(1, MOUSE_LEFT)

Marius90

2014-08-17 18:58:31

Thanks for replaying …i found this code in iBuryBones script
typeSend('1', false);
wait(randomRange(500, 700));
until tabBackpack.count() = 0 or chatbox.findAnyText(['ave any lef']);
Do you think this could work for me to ? didn't had time to test

The Mayor

2014-08-17 23:20:06

From: Ionutz900
Do you think this could work for me to ? didn't had time to test


I can't test everything for you too…

Marius90

2014-08-18 05:48:31

Hi, I tested that code and it does work really well.. anyway i asked you maybe you have encounterd that code before and you may know if it would worked …anyway thank you for your replyes

Lama

2014-09-25 20:21:35

You should emphasize case sensitivity for isMouseOverText and chooseOption.select, in the sense of (['rop Logs']), not (['rop logs']). It wasn't entirely apparent for me at least, but I figured it out quickly enough.

The Mayor

2014-09-26 05:00:40

From: Lama0
You should emphasize case sensitivity for isMouseOverText and chooseOption.select, in the sense of (['rop Logs']), not (['rop logs']). It wasn't entirely apparent for me at least, but I figured it out quickly enough.


It's a good idea to mention that. Done!

tulpiuka

2014-10-04 06:38:00

Nice now i have a grasp of what is what. Now all that's left is the rest… which is a lot. My first attempt will probably be a bunch of copy and paste from all the scripts i have and see if i can make something work. Can't wait for action bar basics. Trying to find out how to press actionbar slot with a keyboard. Not with a mouse. Is there some kind of manual for these things in github? I found something there but i dont know if it's up to date.

The Mayor

2014-10-04 07:22:05

From: tulpiuka
Nice now i have a grasp of what is what. Now all that's left is the rest… which is a lot. My first attempt will probably be a bunch of copy and paste from all the scripts i have and see if i can make something work. Can't wait for action bar basics. Trying to find out how to press actionbar slot with a keyboard. Not with a mouse. Is there some kind of manual for these things in github? I found something there but i dont know if it's up to date.


You can click an action bar slot

mouseBox(actionbar.getSlotBox(1), MOUSE_LEFT);

Or you can type '1' using typeSend(text: string; pressEnter: boolean = true);

To type 1 and not press enter:

typeSend('1', false)

To type 1 and press enter:

typeSend('1', true)

but you will see pressEnter is actually true by default, so if you leave that parameter blank, it will resort to the default. So to press enter after typing you could simply:

typeSend('1')


I hope to finish the other sections sometime! You should open the include files in C:/simba/includes/srl6/lib/ and have a look at the function list on the left to see what's available.

tulpiuka

2014-10-04 08:58:41

procedure Spellcast; // Presses 1 to cast spell
begin
KeyDown(31);
wait(RandomRange(30, 100));
KeyUp(31);
end

I ended up finding this. (it's most human like key press?) The problem is the script does one loop (sometimes fails) then the second one comes and 100% fail. I assume it presses up and down while the bank is open or actionbar isn't loaded. Added a waitRandom but it didn't help.

Probably found the problem. Gonna try something.

GodMatic

2014-10-08 21:01:52

very in depth guide I like it, very easy to understand

IROC-Z

2014-10-15 13:49:00

For
minimap.setAngle(45)
can it be set to a range of angles? For example having it turn to an angle between 40 and 50 with a gaussian distribution or an normal distribution. I want to detect the vines in the Karamja Dungeon, so a west angle, I think it is west ha, would be best but don't want it to go exactly west each time.

Olly

2014-10-15 13:50:44

From: IROC-Z
For
minimap.setAngle(45)
can it be set to a range of angles? For example having it turn to an angle between 40 and 50 with a gaussian distribution or an normal distribution. I want to detect the vines in the Karamja Dungeon, so a west angle, I think it is west ha, would be best but don't want it to go exactly west each time.


Minimap.setAngle(Random(40, 50));
Minimap.setAngle(GaussRangeInt(40, 50));

IROC-Z

2014-10-15 14:00:13

From: Olly
Minimap.setAngle(Random(40, 50));
Minimap.setAngle(GaussRangeInt(40, 50));


Thanks! I figured it would be something like that, just wasn't sure where the random/gauss and parenthesis would fall.

victordono

2014-10-23 16:33:27

Would you use the mouseoverobject for picking up items as well ? can you write a little tutorial on looters ?

The Mayor

2014-10-24 17:52:18

From: victordono
Would you use the mouseoverobject for picking up items as well ? can you write a little tutorial on looters ?



mouseOverObject?


You could use mainScreen.findObject, the same way you find the tree.

victordono

2014-10-24 19:18:41

Hmm so would a looter be similar to

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

procedure lootItem();
var
x, y: integer; //we need to declare these variables since findObject outputs these
begin
if mainscreen.findObject(x, y, 925721, 11, ['ffigy'], MOUSE_RIGHT) then
begin
writeLn('We found an item!'); //if findObject results true, this will print
chooseOption.select(['ake']); // this will choose ‘Take’ option in chooseOptions menu
end;
end;

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

The Mayor

2014-10-24 19:28:49

From: victordono
Hmm so would a looter be similar to

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

procedure lootItem();
var
x, y: integer; //we need to declare these variables since findObject outputs these
begin
if mainscreen.findObject(x, y, 925721, 11, ['ffigy'], MOUSE_RIGHT) then
begin
writeLn('We found an item!'); //if findObject results true, this will print
chooseOption.select(['ake']); // this will choose ‘Take’ option in chooseOptions menu
end;
end;

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


In the most basic form, yes ;) That will work if your colour and tolerance are correct.

kozak94

2014-11-03 22:18:35

This is beautiful.

Trollcrank

2014-11-06 20:00:43

I'm starting to wonder if there should be a line, or text, separating the original tutorial from the to be added sections. It's started to go from the basics to all of the inbuilt features of the client.

Edit: I mean a more dominate line.

The Mayor

2014-11-06 21:23:26

From: Trollcrank
I'm starting to wonder if there should be a line, or text, separating the original tutorial from the to be added sections. It's started to go from the basics to all of the inbuilt features of the client.

Edit: I mean a more dominate line.


Everything after the simba basics section is all SRL6 stuff. Everything up to the bankscreen is complete, as you can tell from the other sections being blank.

Marius90

2014-11-10 13:07:59

For some reason i dont know why, sometimes it jumps over this task
typeSend('1', false);
it banks it again without pressing the action bar, so if it help you guys i wrote this

begin
if (tabBackpack.isFull)
then typeSend('1', false);
end;
works obviously only if what you have withdrew from the bank made the backpack full.
And another problem that i sometimes encounter is that even it is
false
is still preses enter and starts typing in the chatbox until the end of times, so what i do is that i select the Emotes panel and works perfectly

SRLnoob

2014-11-27 15:15:01

What AIO tutorial? I can't find it to save my life.

3Garrett3

2014-11-27 18:06:00

From: SRLnoob
What AIO tutorial? I can't find it to save my life.


https://villavu.com/forum/showthread.php?t=107757

Consider your life saved.

SRLnoob

2014-11-27 19:43:58

From: 3Garrett3
https://villavu.com/forum/showthread.php?t=107757

Consider your life saved.


Lol yeah I didn't think that was it because it says on that to go to this tutorial. I didn't make the connection that "AIO" stood for "all in one." Thanks.

MatthewDai98

2014-12-18 00:02:01

how can I know the coordinates of a point to click? Also, bank.open gives an error about operator missing:/

The Mayor

2014-12-18 00:43:04

From: MatthewDai98
how can I know the coordinates of a point to click? Also, bank.open gives an error about operator missing:/


I guess you forgot to read the first few sections about simba basics :(

MatthewDai98

2014-12-18 22:48:11

I did?:O I know the coordinates now but what about bank.open:(

Lipcot

2014-12-19 03:49:55

From: MatthewDai98
I did?:O I know the coordinates now but what about bank.open:(


you are just using bank.open ? you must do this bank.open(THE_BANK_YOU_WANT_TO_OPEN). check the documentation to know what to put within the brackets!

MatthewDai98

2014-12-19 22:52:35

From: undorak7
you are just using bank.open ? you must do this bank.open(THE_BANK_YOU_WANT_TO_OPEN). check the documentation to know what to put within the brackets!


no I did
bankScreen.open(BANK_NPC_BLUE)
Error: Operator expected at line 28

The Mayor

2014-12-19 22:57:04

From: MatthewDai98
no I did
bankScreen.open(BANK_NPC_BLUE)
Error: Operator expected at line 28


It won't be that line causing the error. You would have messed something else up. Easiest way to help is for you to post your whole script in simba tags

 script here [[COLOR="#FFFFFF"].[/COLOR]/SIMBA]

MatthewDai98

2014-12-21 13:39:02


program script;

{$DEFINE SMART} // Always have this to load smart
{$I SRL-6/SRL.simba} // To load the SRL include files
{$I SPS/lib/SPS-RS3.Simba} // To load the SPS include files

procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := true;
end
currentPlayer := 0;
end;


// main loop
procedure mainprogram();
Begin
tabBackPack.mouseSlot(1, MOUSE_LEFT);
mouse(410, 376, 30, 5, MOUSE_MOVE);
fastClick(MOUSE_LEFT);
randomRange(5500, 10500)
bankScreen.open(BANK_NPC_BLUE)
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
bankScreen.close();
end.
begin
clearDebug(); // Clear the debug box
smartEnableDrawing := true; // So we can draw on SMART
setupSRL(); // Load the SRL include files
declarePlayers(); // Set up your username/pass

if not isLoggedIn() then // If player isn't logged in then
begin
players[0].login(); // Log them in
exitSquealOfFortune(); // Exit squeal if found
minimap.setAngle(MM_DIRECTION_NORTH); // Make compass north and angle high
mainScreen.setAngle(MS_ANGLE_HIGH);
mainprogram()
end;
declareplayers()
mainprogram()
end;

Lipcot

2014-12-21 14:16:56

From: MatthewDai98
…..


well, you have some very silly errors there :p, ill mark them on red so i cant use
:


program script;

{$DEFINE SMART} // Always have this to load smart
{$I SRL-6/SRL.simba} // To load the SRL include files
{$I SPS/lib/SPS-RS3.Simba} // To load the SPS include files

procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := true;
end
currentPlayer := 0;
end;


// main loop
procedure mainprogram();
Begin
tabBackPack.mouseSlot(1, MOUSE_LEFT);
mouse(410, 376, 30, 5, MOUSE_MOVE);
fastClick(MOUSE_LEFT);
[COLOR="#FF0000"]WAIT([/COLOR]randomRange(5500, 10500)[COLOR="#FF0000"])[/COLOR][COLOR="#FF0000"];[/COLOR]
bankScreen.open(BANK_NPC_BLUE)[COLOR="#FF0000"];[/COLOR]
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
bankScreen.close();
end[COLOR="#FF0000"];[/COLOR] [COLOR="#FF0000"]//semicolon here not a point.[/COLOR]

begin
clearDebug(); // Clear the debug box
smartEnableDrawing := true; // So we can draw on SMART
setupSRL(); // Load the SRL include files
declarePlayers(); // Set up your username/pass

if not isLoggedIn() then // If player isn't logged in then
begin
players[0].login(); // Log them in
exitSquealOfFortune(); // Exit squeal if found
minimap.setAngle(MM_DIRECTION_NORTH); // Make compass north and angle high
mainScreen.setAngle(MS_ANGLE_HIGH);
mainprogram()
end;
declareplayers()[COLOR="#FF0000"];[/COLOR] [COLOR="#FF0000"]//you were missing semicolons here[/COLOR]
mainprogram()[COLOR="#FF0000"];[/COLOR] [COLOR="#FF0000"]// same here[/COLOR]
end;


apply these changes and it'l compile! next time try following the guide to the detail, and remeber always end lines with a semicolon! "operator" usually means you are missing a semicolon. "block" means you've messed up with begins/ends (you had put a dot instead of a semicolon).

MatthewDai98

2014-12-21 17:22:44

From: undorak7
well, you have some very silly errors there :p, ill mark them on red so i cant use
:


program script;

{$DEFINE SMART} // Always have this to load smart
{$I SRL-6/SRL.simba} // To load the SRL include files
{$I SPS/lib/SPS-RS3.Simba} // To load the SPS include files

procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := true;
end
currentPlayer := 0;
end;


// main loop
procedure mainprogram();
Begin
tabBackPack.mouseSlot(1, MOUSE_LEFT);
mouse(410, 376, 30, 5, MOUSE_MOVE);
fastClick(MOUSE_LEFT);
[COLOR="#FF0000"]WAIT([/COLOR]randomRange(5500, 10500)[COLOR="#FF0000"])[/COLOR][COLOR="#FF0000"];[/COLOR]
bankScreen.open(BANK_NPC_BLUE)[COLOR="#FF0000"];[/COLOR]
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
bankScreen.close();
end[COLOR="#FF0000"];[/COLOR] [COLOR="#FF0000"]//semicolon here not a point.[/COLOR]

begin
clearDebug(); // Clear the debug box
smartEnableDrawing := true; // So we can draw on SMART
setupSRL(); // Load the SRL include files
declarePlayers(); // Set up your username/pass

if not isLoggedIn() then // If player isn't logged in then
begin
players[0].login(); // Log them in
exitSquealOfFortune(); // Exit squeal if found
minimap.setAngle(MM_DIRECTION_NORTH); // Make compass north and angle high
mainScreen.setAngle(MS_ANGLE_HIGH);
mainprogram()
end;
declareplayers()[COLOR="#FF0000"];[/COLOR] [COLOR="#FF0000"]//you were missing semicolons here[/COLOR]
mainprogram()[COLOR="#FF0000"];[/COLOR] [COLOR="#FF0000"]// same here[/COLOR]
end;


apply these changes and it'l compile! next time try following the guide to the detail, and remeber always end lines with a semicolon! "operator" usually means you are missing a semicolon. "block" means you've messed up with begins/ends (you had put a dot instead of a semicolon).


Thanks a lot;) It worked I'll remember to put them semicolons :p

KeepBotting

2014-12-21 18:56:12

From: MatthewDai98
Thanks a lot;) It worked I'll remember to put them semicolons :p


Adding on a bit to what undorak said,

this isn't a huge problem, just a little nit-picky thing, but
exitSquealOfFortune();
should be
exitTreasure();

They're one and the same, but exitSquealOfFortune() will be removed eventually

SlipperyPickle

2014-12-23 08:41:12

Really nice guide! Thank you very much. Trying to make my first scripts, and these guides where really helpful. Hopefully have my first script ready in a week or so. Thanks! :)

MatthewDai98

2014-12-23 12:45:56

From: KeepBotting
Adding on a bit to what undorak said,

this isn't a huge problem, just a little nit-picky thing, but
exitSquealOfFortune();
should be
exitTreasure();

They're one and the same, but exitSquealOfFortune() will be removed eventually


I see thanks!:)

The Mayor

2015-01-03 02:01:41

Updated with a few more sections!

Taric

2015-01-04 01:20:31

So I have my Tpoint clicking the minimap furnace icon:

minimap.findSymbol(myPoint, MM_SYMBOL_FURNACE, minimap.getBounds());
mouse(myPoint ,MOUSE_LEFT);

Is there anyway I can add 10 to the y value of the Tpoint? Still new to this shtuff…

The Mayor

2015-01-04 03:39:20

From: pizzapants
So I have my Tpoint clicking the minimap furnace icon:

minimap.findSymbol(myPoint, MM_SYMBOL_FURNACE, minimap.getBounds());
mouse(myPoint ,MOUSE_LEFT);

Is there anyway I can add 10 to the y value of the Tpoint? Still new to this shtuff…


mouse(myPoint.x, myPoint.y + 10, MOUSE_MOVE)

hihihih565

2015-01-08 15:08:11

Hey,

I was going to PM you but I don't have enough posts to send a PM. If you could add me on Skype, that would be greatly appreciated.

The Mayor

2015-01-16 22:44:09

I added section 17 about working with the Grand Exchange.

Quentini

2015-01-18 14:20:19

Great reading all the updates. Keep it up!

Greytor

2015-01-18 14:37:46

Really nice guide, it is very helpful as I am making my first script, keep up the good work!

3Garrett3

2015-01-22 11:26:21

From: The Mayor
I added section 17 about working with the Grand Exchange.


Quick question about GE parameters:

You have options for +5/-5% in the prices. Is the "Any other number" option a designated price or can it be "+10"?

Just wondering… for reasons.

Also for simple operations, everything should be called from the main GE screen? It handles all of the GE Slot clicking and getting out of offers etc?

The Mayor

2015-01-22 16:11:02

From: 3Garrett3
Quick question about GE parameters:

You have options for +5/-5% in the prices. Is the "Any other number" option a designated price or can it be "+10"?

Just wondering… for reasons.

Also for simple operations, everything should be called from the main GE screen? It handles all of the GE Slot clicking and getting out of offers etc?


Any other number as in a number, not anything with '+' or '-'.

If you wanted to buy at +10% you could just do something like:


procedure buyStuff();
var
price: integer;
begin
price := grandExchange.getPrice(1234);
price += round(price * 0.1);
grandExchange.buyItem('Item', toStr(price), '100');
end;

You can call any function from any screen. It will return to the main summary screen if necessary.

Sajon

2015-02-09 18:13:31

very good thread lerning alot :P thank you so much

Tristana

2015-02-09 20:02:44

Ok im not sure if this question belongs here but I'm sure you can answer it anyways @ The Mayor :p. Is using DTMs for walking more accurate than SPS? . I've noticed that SPS sometimes messes up walk paths that I set.

3Garrett3

2015-02-10 11:02:30

From: Tristana
Ok im not sure if this question belongs here but I'm sure you can answer it anyways @ The Mayor :p. Is using DTMs for walking more accurate than SPS? . I've noticed that SPS sometimes messes up walk paths that I set.


Except in very select areas, SPS is probably faster than DTMs. Made properly, I bet you'd probably have more "accurate" DTMs than SPS, but you should be able to walk to a given tile with the required accuracy using SPS.

The key if you're finding misclicks is to properly set the map up. I don't have the function memorized (or Simba in front of me) but if you look around the help forum and find SPS threads there should be some mentions of SPS settings.

Accuracy, Tolerance, Match Percent are the ones you're looking for. They can be changed around at will and tested until they work perfectly to whatever accuracy you need.

Tristana

2015-02-10 18:25:01

From: 3Garrett3
Except in very select areas, SPS is probably faster than DTMs. Made properly, I bet you'd probably have more "accurate" DTMs than SPS, but you should be able to walk to a given tile with the required accuracy using SPS.

The key if you're finding misclicks is to properly set the map up. I don't have the function memorized (or Simba in front of me) but if you look around the help forum and find SPS threads there should be some mentions of SPS settings.

Accuracy, Tolerance, Match Percent are the ones you're looking for. They can be changed around at will and tested until they work perfectly to whatever accuracy you need.

Ah thanks :). I'll take a look at DTMS for now.

3Garrett3

2015-02-10 19:03:17

From: Tristana
Ah thanks :). I'll take a look at DTMS for now.


Sorry, to be completely explicit: I highly recommend SPS in all situations. At least try it first. It's much easier and works just as accurately in almost all situations. In the case that you need highly precise walking for some special case, try changing settings with your SPS map until you're sure that it can't be done with SPS. Then maybe try DTMs, but they're so much harder to make, maintain, troubleshoot, etc.

SirPrize

2015-02-22 19:58:06

This guide is beautiful, thanks for putting this together! Going to help a looot with learning

Renzanity

2015-03-04 05:24:27

Thanks for the wonderful intro! I've actually made a very simple alch'ing script while reading this. :p

forest

2015-03-06 08:16:32

i don't get why i'm getting a compilation error

program new;

begin
mouse(123, 123, MOUSE_MOVE);
end.


Error: Unknown declaration "Mouse" at line 4
Compiling failed.

e: didnt know it doesnt work outside of the smart client zzzzzzzzzzzzzzzzzzzzzzzzzz

The Mayor

2015-03-06 15:24:57

From: forest
i don't get why i'm getting a compilation error


Error: Unknown declaration "Mouse" at line 4
Compiling failed.

e: didnt know it doesnt work outside of the smart client zzzzzzzzzzzzzzzzzzzzzzzzzz


It doesn't work, because mouse() is a function inside the SRL-6 library. You need to include the SRL-6 library in your script. Read section 2 "Mouse and Clicking Basics".

Kopa

2015-03-22 03:23:09

Great guide, I really enjoyed it.
But I have a quick question. If I create a combat script and I would like to bot to use momentum, how would I check if the combat mode is already set to momentum? Is that even possible?

yourule97

2015-03-22 17:38:55

From: Kopa
Great guide, I really enjoyed it.
But I have a quick question. If I create a combat script and I would like to bot to use momentum, how would I check if the combat mode is already set to momentum? Is that even possible?


I didn't even know it existed because its not in the documentation, but I did some research and apparently you can do:

 
powersScreen.open();
if powersScreen.getCombatMode() = 3 then //Momentum's value is three
begin
//blah
end;

To set the bot to turn on momentum you can do something like:


powersScreen.setCombatMode(MODE_MOMENTUM);

Kopa

2015-03-22 17:46:46

From: yourule97
I didn't even know it existed because its not in the documentation, but I did some research and apparently you can do:

 
powersScreen.open();
if powersScreen.getCombatMode() = 3 then //Momentum's value is three
begin
//blah
end;

To set the bot to turn on momentum you can do something like:


powersScreen.setCombatMode(MODE_MOMENTUM);


Yeah I guessed that it will be the only solution.
Thanks man!

The Mayor

2015-03-22 19:17:15

From: Kopa
Great guide, I really enjoyed it.
But I have a quick question. If I create a combat script and I would like to bot to use momentum, how would I check if the combat mode is already set to momentum? Is that even possible?


When you setCombatMode(), it checks that it's not already on the selected combat mode before clicking it.

Kopa

2015-03-22 19:45:33

From: The Mayor
When you setCombatMode(), it checks that it's not already on the selected combat mode before clicking it.


Oh, that's great, thank you very much!
But it has to open the combat settings to check it, right? I haven't made a test yet, as I'm still searching around and learning.

The Mayor

2015-03-22 19:53:34

From: Kopa
Oh, that's great, thank you very much!
But it has to open the combat settings to check it, right? I haven't made a test yet, as I'm still searching around and learning.


Yes it does have to open it. I don't think there is another way to check what mode you are on?

osoad1

2015-03-23 20:04:46

Thanks for the guide

forest

2015-03-28 21:41:50

Does bankScreen.open(BANK_NPC_BLUE); still work for V West banks? I tried executing the same code you provided but it doesn't open the bank screen for me. Do I have to hardcode opening banks or is there an easier solution? Thanks

drag2270

2015-04-08 15:25:35

I have a question. What if i want to make a if statement? Like i have one procedure that can run if somthing happens

like if my character logs out i log it back in using that procedure and it continues doing whatever its doing

KeepBotting

2015-04-08 15:50:22

From: drag2270
I have a question. What if i want to make a if statement? Like i have one procedure that can run if somthing happens

like if my character logs out i log it back in using that procedure and it continues doing whatever its doing



if not (isLoggedIn()) then
begin
players[currentPlayer].login();
recoverFromLogout(); //This would ideally be a routine that opens
//the backpack, sets the camera, normal stuff
//that you'd do upon logging in to prepare for
//the script's run.
end;

drag2270

2015-04-12 21:50:16

Ok lets take this to a different siutation and not with logs-outs what if my character is in wildy killing revs, what if it gets lured to another spot how can i take it back to revs? like what would be the lines of code.

Camel

2015-04-12 22:05:32

From: drag2270
Ok lets take this to a different siutation and not with logs-outs what if my character is in wildy killing revs, what if it gets lured to another spot how can i take it back to revs? like what would be the lines of code.


It would likely involve SPS. If not it would require some clever solution.

No one will write the code for you, I would suggest reading this https://villavu.com/forum/showthread.php?t=107757 guide to learn about SPS and more advanced scripting… Which doing something like fighting revs will require.

KeepBotting

2015-04-13 03:15:24

From: drag2270
Ok lets take this to a different siutation and not with logs-outs what if my character is in wildy killing revs, what if it gets lured to another spot how can i take it back to revs? like what would be the lines of code.


I agree with what Camel said. However I'll point you to this thread, where a member was helped with location checking. The same concept can be used to accomplish your goal.

UrbanSmoke

2015-04-20 20:05:52

Great tutorial, may I suggest recording yourself making a new script from start to finish? That would be incredibly informative.

The Mayor

2015-04-23 13:54:50

From: UrbanSmoke
Great tutorial, may I suggest recording yourself making a new script from start to finish? That would be incredibly informative.


I've always thought about doing that! Maybe someday when I get the time ;)