PDA

View Full Version : Ultimate Scar Basics



Waddo
07-05-2008, 12:06 PM
Hi this is my first real tutorial my spelling is not good and I may miss some stuff, please comment with positives or constructive critisism but dont flame.

Use the contents block to your right or scroll down to view the first page.

i am adding to it and improving on a regular basis so check back often
recent updates
starting to macro basics
colour finding
clicking
talking

2 new exercises
creating an script to attack man
creating an auto talker

This is not complete.


I will also include

more basic funtions to actually create macros

and I will create a very primitive script step by step

and more

Scar

Click here to download Scar
http://freddy1990.com/scarsig/scar2.png (http://freddy1990.com/scar.php)

Srl

Click here to download Srl (http://subversion.tigris.org/files/documents/15/39559/svn-1.4.5-setup.exe)

Install both Scar and the Subversion Repository.

Setup
1.Once they have been installed run Scar.

2.When Scar opens a help window will open just close this for now and go to tools>options.

3.when the new window opens click the bottom tab and you will see this
http://82.92.130.193/Pictures/DLSRL42.png
image from ft fakawi

4.Check the Subversion repository bullet.

5.Click Checkout and wait for the DOS box to dissapear.


6.Click OK and your finished.





The Basics

Here is a program

Program HelloWorld;
Begin
Writeln('Hello World');
end.


A program starts Program name;

A semi colon goes at the end of a line to say it has finished doing what it was doing

everything you want the program to do must be between a begin and end

scar is stupid you need to tell it where to start and stop (for the record scar is not stupid)

when you program is finished completly you put a fullstop.

all text is put between speechmarks this is so scar can tel it from a command

writeln is a command it writes text into the debug box

the program can also be writen

program helloworld;
begin
begin
writeln('hello world');
end;
end.

Notice how one of the ends have ; this is because it is not the end of the script.

Repeat

to use repeats you must call it like this

program helloworld;
begin
repeat
wait(100);
writeln('hello world');
until false;
end.

this will wait 100 milliseconds then write hello world and repeat that untill you stop it more about repeat later





Data Types
There are 5 data types
these are
Integer: This is a whole number eg 1, 5 or 1000000

Extended: These hold non whole number values eg 1.5, 0.25 or 32.23142453

Boolean: These hold true or false values

String: A string is a word, eg 'hello'

Char: A single letter eg. 'A', 'a', 't' etc.




Variables

A variable is a datatype that can be changed throughout the script



:=
This is used to change the data held by the variable
=
This is used to check if something is equal to the data in the variable

program helloworld;
var
hello:string;
begin
hello:='hello world';
writeln(hello);
end.

Var: Used to tell scar you are going to decare some variables


:string
Tells scar what data type the variable will hold


hello:='hello world';
Tells scar that what is contained in the variable hello wil be changed to 'hello world' notice it is in speech marks this is because it is a string.



writeln(hello);
writes the data that is held in the variable hello into the debug box

in this case that data is 'hello world'



now for integer variables.

program helloworld;
var
number:Integer;
begin
number:=27;
writeln(IntToStr(number));
end.

number:=27;
Tells scar that what is contained in the variable number wil be changed to 27.

writeln(intotostr(number));

this writes the number that is stored in the variable in the debug box
the inttostr(number) turns the number from 27 to '27' (notice the apostrophies this is because it turns it ino a string).


program helloworld;
var
number:Integer;
begin
writeln(IntToStr(number));
end.

that will write 0 as an integer variable is 0 by default.


program helloworld;
var
number:Integer;
begin
number:=27;
writeln(IntToStr(number));
number:=number+1;
writeln(IntToStr(number));
end.

this will write 27 on one line and then 28 on the next because of number:=number +1;


program helloworld;
var
number:Integer;
begin
number
writeln(IntToStr(number));
end.

repeats and variables

i mentioned before the = symbol
this is how it is used in conjunction with variables and repeats



program helloworld;
var
number:=integer;
begin
repeat
writeln(inttostr(number));
number:=number+1
until number = 5;
end.

this will repeat writing the number stored in the variable and then increasing it by 1 until it equals 5 so it will write the numbers 0 to 5



macroing

Here i wil teach the basics of interacting with runescape

first of all randomness
this is the most important thing with out this you will get banned

randomness can be used for random timing random co-ord clicking

Randomness with clicking

this is how to make the mouse click somewhere

Mouse(X, Y, XMod, YMod, type)

Mouse: tells scar that you want it to click

X, Y: the x and y co-ordinates of the place to click

XMod, YMod: These are the randomness if you had mouse(100,100,10,10....

it will click any where betwen the co-ords 90,90 and 110,110

, type: this is the type of click left or right to left click this should be set as true, to right click set it as false

so mouse(100, 100, 10, 10, true);
would left click anywhere inbetween the co-ord 90,90 and 110,110

but mouse is an srl procedure so you need to include
{.include srl/srl.scar}


Randomness with time

remember


program helloworld;
begin
repeat
wait(100);
writeln('hello world');
until false;
end.

well the wait(100) means it will wait 100 milliseconds

if you click every 10 milliseconds its not very human like

so to add randomness to it you do

wait(100+random(100))

simple that wil wait any where between 100ms and 200ms

so now using the script from before im going to show you how to type messages in rs


program helloworld;
begin
repeat
wait(100+random(100));
writeln('hello world');
until false;
end.

thats the script from before with randomness added


program helloworld;
{.include srl/srl.scar}
begin
repeat
wait(100+random(100));
typesend('hello world');
until false;
end.

this is the same but no it uses typesend instead of writeln
that simply types hello world into runescape or any active window that you can type in every 100-200ms untill you stop it

typeend is part of srl so you need to include
{.include srl/srl.scar}

Case Functions

case variable of


end;


program helloworld;
var number:integer;
begin
number:=random(3)
case number of
0: writeln('0')
1: writeln('1')
2: writeln('2')
3: writeln('3')
end;
end.

that will writeln a random number from 0 to 3 this could also be acheived by simply using writeln(inttostr(random(3)));
but using case functions you can also do things such as call procedures
or things like that or

make an auto talker

here is a simple auto talker below

it is in white so you need to highlight to see

BEFORE HIGHLIGHTING TRY AND MAKE IT YOURSELF
program helloworld;
{.include srl/srl.scar}
var number:integer;
begin
number:=random(3)
case number of
0: typesend('hi')
1: typesend('bye')
2: typesend('hello')
3: typesend('raor')
end;
end.

Colour finding

to find a color on the page use
FindColorSpiralTolerance(x, y,color, xs, ys, xe, ye,tolerance);

x,y: the x, y co-ords of where the colour was found

colour: the colour you want to find (you select the color using the colour picker)

xs,ys,xe,ye: start and end coords of where you want to search

tolerance: the colour tolerance

FindColorSpiralTolerance(x, y,255, MSX1, MSY1, MSX2, MSY2,20);

this will move the mouse in a spiral from the center if the mouse moves over the colour 255(a shade of red) or a colour with 20 tolerance it will stop and return the x,y co-ords of the colour


MSX1, MSY1, MSX2, MSY2: these are the co-ords of the runescape main screen

MS stands for main screen

MI main invent

MM minimap




when this finds the colour it returns an x and y co-ord this can be used to then cary out actions like clicking

for example

mouse(x,y,0,0,false);
that would right click

then you could use

chooseoption('ttac');


or eithen

if isuptext('rat') then
chooseoption('ttack');

excercise

now create a script that will attack a person

answer here:
BEFORE HIGHLIGHTING TRY AND MAKE IT YOURSELF
program attack;
{.include srl/srl.scar}
var
x,y:integer;
begin
if findcolorspiraltolerance(x,y,255, MSX1, MSY1, MSX2, MSY2,20) then
begin
mmouse(x,y,0,0);
if isuptext('Man') then
begin
mouse(x,y,0,0,false);
chooseoption('ttack');
end;
if isuptext('oman') then //so it looks for men or woman
begin
mouse(x,y,0,0,false);
chooseoption('ttack');
end;
end;
end.

the colour 255 is not the right colour so you will need to find out what works
Note.
if isuptext('Man') then
begin
mouse(x,y,0,0,false);
chooseoption('ttack');
end;
if isuptext('oman') then //so it looks for men or woman
begin
mouse(x,y,0,0,false);
chooseoption('ttack');
end;

can be simplified to

if ((isuptext('Man')) or (isuptext('oman'))) then
begin
mouse(x,y,0,0,false);
chooseoption('ttack');
end;

Silent
07-24-2008, 05:39 AM
Very good tutorial, explained everything very well.

Waddo
07-24-2008, 12:08 PM
Ty for more Tutorials check out my learner hand book that starts taking you into the more advanced areas and has a few extra exercises.
Link in sig.

Stevo44
04-23-2009, 04:23 PM
this is a nice tut i realy enjoyed it i dont know alot about scripting so im tryin to figure it out obviously but this one helped as for it working with scar i keep getting an error writein isnt a.... heres the error Line 3: [Error] (3:1): Unknown identifier 'WriteIn' in script
so i know i dont realy know what im doin but can you help me out? thanks

MasterKill
04-23-2009, 04:28 PM
this is a nice tut i realy enjoyed it i dont know alot about scripting so im tryin to figure it out obviously but this one helped as for it working with scar i keep getting an error writein isnt a.... heres the error Line 3: [Error] (3:1): Unknown identifier 'WriteIn' in script
so i know i dont realy know what im doin but can you help me out? thanks

That's because it's WriteLn, not WriteIn :)

marpis
04-23-2009, 08:36 PM
Very good tutorial! :)

1: you forgot to tell how to drag the crosshair (specify client? what's it in english :D) Please take PrtScr of this
I think you should explain tolerance too. What is 'tolerance'?
Also i think you should also introduce FindColor() before FindColorTolerance(), because then Findcolortolerance() would be easier to understand.

2: It's good to use brackets in until() too. You should make it
until(false);
or
until(i = 5);
it's alot easier to understand/read.

3: Your header 'cases' isnt big text :D

4: Your man killing program doesnt find a man, isuptext is case sensitive so use IsUptext('Man');

5: To make this tutorial very very awesome, tell us about procedures too :) functions are not that essential at this point.

tom99
11-25-2009, 12:22 PM
Very nice tutorial but you forgot to explain the bitmapfromstring witch is much used for scar.