SRL Archive - Outdated Tutorials

Guide to Scripting(If you are totally new at it)


WhiteShadow

2006-05-31 23:22:01

Guide by WhiteShadow

This tutorial goes over basics of SCAR.

What you must know before reading this.= How to open SCAR. :p

——–
Comments in scripts are written with these keys, {} and // notice they change green in SCAR.
[(* comment in here*) - this is also a way. Credits to Bebe.]

Eg.
{Comment here} 
//Comment Here
(*comment here*)
program New;
begin
end.
——–

Now let's get familiar with some Basic SCAR functions and procedures.

Writeln(s : String); - It writes in the debug.
Status(s : String); - It writes in Status bar.
Wait(ms : Integer); - It makes the script wait, like a pause in miliseconds.
Try it.

program New;
begin
Writeln('Place what to write here');
Status('Place what to write here');
Wait(1000);
end.
——–
The mainloop - is what the script actually does. It contains procedure and functions.

More explainations.

E.g

program New;

procedure AnyNameYoudLike;
begin
Writeln('Hello my name is nick');
end;

procedure AnotherName;
begin
Status('You are reading this, ty');
Wait(3000);//Wait's 3 miliseconds.
end;

begin
//This is the mainloop.
AnotherName;
end;
So this script only runs AnotherName. Not AnyNameYoudLike. Why? Because it is not declared in the Mainloop. The script only does what's in the MainLoop.
——–
Variables.

String - is a way to store words.
Integer - is a way to store numbers.
Extended - Like integer, the difference is that it can store decimals
Boolean - is a way to store true or false.
//There are some others but, are a bit more advanced.

Using variables in scripts in declaring them.

program New;

//Global variables are placed here, under program. Global variables can be accessed //throughtout the script.
var
i : Integer;//Name them anything you'd like!
Zv : String;//" "
Ty : Extended;//" "

procedure AnyName;
begin
i:= 3; //< Remember these 3 are global.
Zv:= 'A String';
Ty:= 2.3;
end;

procedure PmgNotGlobalVars;
var//These are local variables only accessed in this procedure!
it : Integer;//Name them anything you'd like!
Zvg : String;//" "
Tyg : Extended;//" "
begin
it:= 3; //< Remember these 3 are global.
Zvg:= 'A String';
Tyg:= 2.3;
end;

procedure WriteInLocalVars;//This gives me an error.
begin
Writeln(Zvg);
end;

Line 29: [Error] (29:9): Unknown identifier 'Zvg' in script 

Why because Zvg was a local variable of course and it wasn't accessible by other procedures.

But Now try this.[erase the above one]

procedure LoadNums;
begin
AnyName; //Load in this procedure so SCAR realizes what it is storing.
Writeln(Zv);
Writeln(IntToStr(i));
end;
[Error] (34:1): Unexpected end of file Works! it only got that though since we had no mainloop so it was an "end of file" thing.

What the hell was that IntToStr above there?

Variables can be changed from Integer to String and vice versa.
E.g


program New;

var
Ix : Integer;
Iy : String;

procedure Change;
var
Ce : Integer;
begin
Ix:= 2
Iy:= '7'
Writeln(IntToStr(Ix));//Write in debug value of Ix as a string.
Ce:= StrToInt(Iy));//Makes Iy a Integer instead of a String;
end;

Integer to String = IntToStr( )
String to Integer = StrToInt( )
——–
Now to the part that is actually more Runescape related! Moving, and clicking your mouse.

 MoveMouse(x, y : Integer);//Moves to coord specified by x, y
ClickMouse(x, y : Integer; Left: boolean);//Clicks coord specified by x, y

Never use these in a Runescape script, it's detectable and can get someone banned. I teach it though because learning this will help you understand coord, and more advanced mouse moves.

How do I get the coord?
First drag the crosshair onto a client, any open program anything.

-thats the crosshair.

Use the ColorPicker.


Click it now your mouse cursor should become a plus(+) sign sort of thing with a box next to it. The first row tells you what the coords are second row gives you the color. Click on the spot you want the coords for.

Color Picked: 16777215 at (413, 405)

Something like this should appear in the debug.
16777215 = color
(413, 405) = coord. and if you ever did graphing before. x is always the first part and y is the second.
So 413 = the x, 405 = the y.

//Moves Mouse.
program New;

begin
MoveMouse(413, 405);
ClickMouse(413, 405, true);
end,

Now that we covered that now to learn the more anti ban mouse. SRL's has the finest mouse made so far.

 Mouse(mousex, mousey, ranx, rany : Integer; Left : boolean);
- Moves Mouse and clicks or right clicks. Human- Like.

Describing the params:
mousex, mousey = just the x, y we covered above.
ranx, rany = random x or so it hits a few pixel of target. 0, 0 is perfect click.
left = true or false? true = click left, false= click right.

Let's cover how to include an include and how to use procedure and functions from it.

program New;
{.include SRL/SRL.Scar}
//^ how to include
begin
SetUpSRL;//This loads SRL.
//Now to use procedures from it. Now that you included it and loaded it.
//You have access to everything. Just fill in procedure params.
Mouse(413, 405, 4, 4, true);
end.
——–
Constants - like a variable except that this can't be changed throughout the whole script.

//This doesn't really do anything just shwoing how to use it.
//Constants are more useful to store colors.
program New;
{.include SRL/SRL.Scar}

var
//Global vars here

const//const - is abbrev. for constants. - this is how you declare it.
UserName = ' ';
PassWord = ' ';
AColor = 34343243;

begin
end.
——–
ColorFinding.
http://82.92.130.193/forums/showthread.php?t=612
I think I explained it ok there. Please ask questions if it was a bit to hard to get for you.
——–
Well I guess that's it. These are the most basic things I could think of. Please post anything relevent to this.

~WhiteShadow.

Keen

2006-05-31 23:30:34

Another v.good tutorial again, Whity.
You have too much free time.

Oh, and btw, thanks for the color picker bit, I didn't know how to use that. :o
Joking. :p

WhiteShadow

2006-05-31 23:33:25

From: King Keen
Another v.good tutorial again, Whity.
You have too much free time.

Oh, and btw, thanks for the color picker bit, I didn't know how to use that. :o
Joking. :p


Nah, I just use up my sleep time. I usually sleep at 1 - 4am. Because I like to do scripting stuff and I end up starting my homework like at 10 pm +. :p

[sarcastic]Your welcome I'm glad you learned how to use the "colorpicker". [/sarcastic]

Bebe

2006-05-31 23:41:01

From: WhiteShadow
Comments in scripts are written with these keys, {} and // notice they change green in SCAR.

Not completly true! You can also use (* and *) ;)

Try it. :)
Or look at my New Lamp Solver in the TestCorner Forum :)
http://82.92.130.193/forums/showthread.php?t=1779

WhiteShadow

2006-05-31 23:57:16

From: Bebemycat2
Not true! You can use (* and *) ;)

Try it. :)
Or look at my New Lamp Solver in the TestCorner Forum :)
http://82.92.130.193/forums/showthread.php?t=1779


You mean what I wrote was not true, or are you suggesting that, (**) is a way?

Bebe

2006-05-31 23:58:54

I mean
"Not completly true! You can also use (* and *) ;)"

:p

WhiteShadow

2006-06-01 00:02:12

Edited and thank you. :)