PDA

View Full Version : Using SRL In Your Script



WhoCares357
04-03-2007, 10:05 PM
Using SRL In Your Script
by WhoCares357


Table of Contents

<Intro>
<Including SRL>
<Most Used Functions>


<Intro>

To say it in big-people words: I will bestow my knowledge of incorporating SRL functions upon thou. The title says it all. I will show you a few functions that you can use with the SRL, as well as some anti-randoms. If you have already perfected yourself in using Scar functions to auto in RuneScape, this will help you.




<Including SRL>

Before you use any of these following functions and procedures, you must learn how to tell Scar to use the include. This is very simple:

program ILoveSRL;

{.include SRL\SRL.Scar}

begin
SetupSRL; //Must have this as the first thing in the main loop
//Rest of script
end.

Just place {.include SRL\SRL.Scar} after the program Name. Another thing you always need is the command SetupSRL in the main loop. This will trigger the variables and other things needed for the functions and commands you will use. Always have SetupSRL as the first command in your main loop if you are using SRL.



<Most Used Functions>


MMouse(x, y, xrandom, yrandom);

This procedure simply moves the mouse to x, y. xrandom and yrandom are for randomizing the mouse stop area. For instance, if I had:

MMouse(0, 0, 2, 2);

Scar would move the mouse to anywhere from 0-1 for the x coordinate and 0-1 for the y coordinate.

---
Mouse(x, y, xrandom, yrandom, button);

This command is similar to MMouse, except that it actually clicks the mouse. An example of this would be:

Mouse(0, 0, 1, 1, true);

Scar will click 0-1 for the x coordinate and 0-1 for the y coordinate. It will click the left mouse button.

true – left mouse button
false – right mouse button

MMouse and Mouse are pretty undetectable by RuneScape. Use them instead of MoveMouse and ClickMouse.

---
TypeSend(text);

This is a child of the SendKeys command. TypeSend, however, actually types the text as if it were a human (letter by letter).

TypeSend('I love SRL.');

Use TypeSend instead of SendKeys. It will make auto-typing undetectable.

---
GameTab(GameTab);

This function clicks the tab you tell it to. Tab number 1 is the tab in the uppermost left corner (Combat Tab). The tab numbers increase by 1 each time you go over to the right. (2=Stats). Once you reach the end (Magic Book) the next number is the one in the lower left corner (Clan Chat). It keeps going right until number 15 (last tab number).

Taken directly from the SRL Script:


// * GameTab 1 = Fightmode
// * GameTab 2 = Statistic
// * GameTab 3 = Quest
// * GameTab 4 = Inventory (see Inventory.scar)
// * GameTab 5 = Wield
// * GameTab 6 = Prayer
// * GameTab 7 = Mage
// * GameTab 8 = Add Friend
// * GameTab 9 = Del Friend
// * GameTab 10 = ClanChat
// * GameTab 11 = Run/Tools
// * GameTab 12 = Emotes
// * GameTab 13 = Music
// * GameTab 14 = LogOut
// * GameTab 15 = Summoning

GameTab(2);

This will click on the stats tab.

---
SetRun(Run);

Sets the run option true or false (on or off).

SetRun(true);

That will turn on run.

---
OpenBank(WhichBank, ChangeCompass, ChangeAngle);

This command simply opens the Bank Screen. You need to set three options. The first is which bank. Here is the list from the SRL file (note these may have changed since I last updated the tutorial):


'feb' (Falador East Bank)
'fwb' (Falador West Bank)
'veb' (Varrock East Bank)
'vwb' (Varrock West Bank)
'db' (Draynor Bank)
'akb' (Al-Kharid Bank)
'lb' (Lumbridge Bank)

As for the other two options, I'd recommend that you set both to true. It makes it easier to find the bank screen.

---
DepositAll;

If it finds the Bank Screen open, it deposits everything in your inventory.

---
CloseBank:

Closes the Bank Screen.

---
MakeCompass(Direction);

This spins the map until the Compass points to the direction you say.


n = North
s = South
e = East
w = West

MakeCompass('n');

Makes the compass (map) face north.

---
PerfectNorth;

This command makes Scar spin the screen until it's perfectly faced north. This one takes a bit longer than MakeCompass command.

---
UseItem(Inventory);

This will left click on the item specified. The items are numbered by slots. Top left slot would be 1 and it would go to the right until the last one in the row. Then it will count from the left of the next row.

UseItem(4);

This will click the fourth slot (upper right slot).

---
DragItem(inv1, inv2);

This command moves an item from one slot to another.

DragItem(1, 28);

This would make Scar the item in Inventory slot 1 to Inventory slot 28.

---
InventoryFull;

Checks if the Inventory is full.

if InventoryFull = true then
//do whatever

---
InvEmpty;

Checks if the Inventory is Empty.

if InvEmpty = true then
//do whatever

---
CountItemColor(Color);

This will count the amount of items in the Inventory with the given color number.

if CountItemColor(1251123) < 10 then
//do whatever

---
DropItem(Item);

Drops the item in the indicated slot number.

DropItem(5);

That will drop the item in slot number 5 (row 2 column 1).

---
DropAll;

Drops everything in your inventory.

---
DropTo(Slot1, Slot2);

This command drops everything from the first Slot number you indicate to the Second slot number you indicate.

DropTo(5, 10);

This example will drop everything from the fifth Slot to the tenth Slot.

---
TimeRunning;

This function finds the amount of time the script has been running. This is useful in progress reports.

WriteLn('Time since start: ' + TimeRunning);

This would WriteLn the amount of time the script has been running.

---
GetUpText;

This procedure checks the words in the upper left corner of the screen. This is useful for double-checking that what you are about to click is a rock (tree, monster, etc.).

if FindColorSpiral(x, y, Color, x1, y1, x2, y2) then
begin
MMouse(x, y, 1, 1);
if GetUpText = 'ock' then
Mouse(x, y, 1, 1, true);
end;

This example would first look for a color spiral. If it fond the color spiral it would move the mouse there. Scar would then check if the text in the upper left corner of the screen has the letters 'ock' in it. If it does, it will click the color spiral.



There are many more functions, but these are the most useful/used.

ranojit
04-04-2007, 03:13 AM
good tut for the beginner. also its best if you add how to do the multi players soon because that is like one of the main things about srl. other then that great tut :f:

crapkiller
04-05-2007, 09:07 PM
thank you so much! i really needed something like this. Now i can attempt a very simple script. Thank you very much.

gamerz
04-13-2007, 05:09 AM
this really helps alot, i been following all your tuts and there all awsome!

FineDreadHawk
04-28-2007, 04:27 AM
Thanks for the great tut, really helped understand the SRL Commands without opening the files

PwNZoRNooB
04-28-2007, 10:39 AM
Nice tut, +rep!

Harry
04-28-2007, 11:54 AM
THANK YOU! Very easy + simple tut for me ++rep!

WhoCares357
05-22-2007, 03:10 PM
Thanks for the comments guys. I made an error on one of the commands. Fixed now :).

Bammersx
05-23-2007, 06:52 PM
Thank you very much i have not been able to use srl in my scripts for the simple fact that i have not understood it. Again thank you so very much.

MasterKill
06-02-2007, 01:54 PM
Tnx this is just what i needed for my script :D :cool:

Stevee
06-23-2007, 06:47 AM
i think its awesome, i learned some stuff here n there, although open bank dusnt work too well -.-

2nd-protocol
06-23-2007, 10:18 AM
Thanks for taking the time to do this.

Having lurked in the forums for a couple of weeks it would appear I am already beyond retirement age for tinkering with SCAR and SRL and should not even think about starting. Bah, humbug I say.

Having looked through some good scripts and digested some good tutorials (like this one) curiosity has got the better of me and I am ready to spend the odd lunch hour whipping up something useful for my son instead of giving away more unpaid time to the company

F1r3Fox
09-15-2007, 05:22 PM
Excelent Just What I Wanted !!! Should Link It To Your Other Guides Too . Took Me A While To Find It

drizzt
09-27-2007, 01:08 AM
this guide did teach me what i was doing wrong on my other script, but i still don't know how to use the "skill" SRL's =(

WhoCares357
09-27-2007, 02:02 AM
this guide did teach me what i was doing wrong on my other script, but i still don't know how to use the "skill" SRL's =(

Open Scar and go to C:\Program Files\Scar (version)\includes\SRL\SRL\SRL. Check through the different files (especially the ones in the folder "core") and on the top of each .scar file, they list all the scar functions/procedures. To figure out what the function/procedure does, go down to the procedure name and it will have a description next to it.

faster789
09-30-2007, 12:27 AM
thanks this gona help me a lot!

li_HAM1
10-02-2007, 11:55 PM
lol dont quite understand, but then again im not that smart

lalaland
10-03-2007, 11:25 PM
Thank you! I am about to get to work on some of my first scripts (auto-fletcher and auto-stringer) and I needed to learn some of this stuff to help get me going! Thanks!

s1thslay3r0
10-03-2007, 11:28 PM
great guide man

Pancakes
10-03-2007, 11:40 PM
Nice tut, ++ rep.

buck cakes
10-04-2007, 03:34 AM
nice guide, i am well on my way to making my first powerminer now

Tazzie 02
10-31-2007, 06:42 AM
Just what I needed :) I didn't even know half of those SRL functions lol. ++rep

nasty
03-04-2008, 05:34 PM
very nice and very handy!!!
+rep for you :D

StrikerX
03-05-2008, 06:30 AM
nice tut someone should sticky :) rep++

Bonfield
03-05-2008, 08:32 AM
wow gj Nice tut helped me understand the SRL Commands

durza998
03-16-2008, 02:00 AM
Yes! i finally understand some of the commonly used commands of SRL!
Thank you so very very much! A+ work!:)

hobbobobbo1
03-21-2008, 01:32 AM
Thats a great tut on how to use SRL it made me learn heaps

WhoCares357
05-05-2008, 10:12 PM
I updated this tutorial a bit. I weeded out some useless commands and modified the information on some of the other ones.

redknight153
05-09-2008, 07:43 AM
I have read a few of your guides on here AND on Sythe! You are a SRL/SCAR tut god! <3

redknight153
05-09-2008, 07:45 AM
By the way, where it talks about the tabs, towards the beginning, tab 14 isn't log out anymore! ;D

WhoCares357
05-09-2008, 08:55 PM
By the way, where it talks about the tabs, towards the beginning, tab 14 isn't log out anymore! ;D

Well, I took that quote directly from the SRL include. It's not an official "tab" but I think that it is still included as one in SRL.

sink998
07-25-2008, 04:13 AM
Can you help umm I get an arror with the overrite thing in includes//srl/srl/cor/overwrite what do I do and where can i get the version of it alls it sais for me is
program hello;
begin
end. please pm me

carlover
07-27-2008, 05:04 PM
good tut only 1 question how do you do the login procedure?

WhoCares357
08-05-2008, 04:47 PM
good tut only 1 question how do you do the login procedure?

LogInPlayer

If you set up the DeclarePlayer procedure it will log in the current player.

soccnut
08-06-2008, 10:00 AM
invalid no. of parameters means u didnt use certain commands correctly.

i use the example of openbank

Openbank('akb')

u need the parameters akb to tell scar which bank to open
FYI: AKB is for alkharid bank

to check these parameters, open bank.scar in the srl/core folder.

WhoCares357
08-06-2008, 03:56 PM
Yeah, I gotta update that in the tutorial :D.

DeSnob
12-28-2008, 03:00 PM
This really helped me with my chopper, (is this gravedigging?)

marzey
01-17-2009, 12:14 PM
Great tut Love it

Cant wait for update

acmilanrulesall
03-22-2009, 01:54 AM
I tried the first few functions but things like Gametab and OpenBank aren't working for me, what might be the problem? The script compiles perfectly but does nothing.

Edit: Actually, Gametabs work, just not Gametabs(3) for some reason, which unfortunately was the one I had tried with. OpenBank still doesn't work at all.