A SCAR BEGGINERS GUIDE
_ I tried to cut it to the point, for noobs that dont like to read _
-----------TABLE OF CONTENTS------------
CHAPTER 1 - SYNTAX
CHAPTER 2 - VARIABLES/CONSTANTS
- HOW TO DEFINE THEM
CHAPTER 3 - FUNCTIONS
- FINDBITMAP
- FINDCOLOR
- INTTOSTR
- STRTOINT
- WAIT
- CLICKMOUSE
- SENDKEYS
- RANDOMS
- WRITELN
- CLEARDEBUG
- ISFKEYYDOWN
- SENDKEYSVB
- GETMOUSEPOS
- MOVEMOUSE
- HOLDMOUSE
- RELEASEMOUSE
- MOVEMOUSESMOOTH
CHAPTER 4 - OTHER FUNCTIONS[NOT BUILT IN SCAR]
- IsTextUp
- Sendkeyshuman
- InFight
- FlagPresent
- CheckChatMsg
- Clickhuman
- Takescreenshot
CHAPTER 5 - Touchups(Make You Script User Friendly)
- Reports
- Forms (Go To Chapter 6)
CHAPTER 6 - How To Add Forms/Get Them Running
- Designing them
- Adding them
CHAPTER 7 - Making your own Procedures/Functions
CHAPTER 8 - Some Script Tutorials
- Autoclicker
- Autotalker
- Chicken Fighter(Coming Soon)
CHAPTER 9 - ERRORS? SOLUTIONS HERE
- Click HERE
CHAPTER 10 - Run scar on 2+ Accounts
- Click HERE
CHAPTER 11 - A List Of Tutorials By Other People.
-----------------------------------------------
CHAPTER 1 - Syntax
The Syntax Of Scar Is
Code:
program New;
begin
end.
Name Your Program:
Change "New" To Your Program Name
Strings:
And When Telling Scar What A String Is, You Put The Text Between ' ' as so in this example
CHAPTER 2 - VARIABLES/CONSTANTS
VARIABLES
Strings:
Defining them
when abc = your string variable name
and use for this would be Integer:
Defining them
when i = your integer variable name
these are all whole numbers positive or negative
and use for this would be and you may add other integers into it like this or Operators for ints.
Multiply = *
Divide = /
Add = +
Subtract = -
Extended:
when i = your extended variable name
these are decimals that are positive and negative
and use is Boolean:
use Constants
Defining them
Code:
Const
abc = 'hi';
i = 1;
no defining types, that's it
CHAPTER 3 - Functions
ok the basic functions to find color and bitmap are
Code:
FindColor(var x,y: Integer; Color, xs, ys, xe, ye: Integer): Boolean;
FindBitmap(Bitmap: Integer; var x,y: Integer): Boolean;
FindColor:
Originally Posted by
The Rs Monkey
FindColor(
var x,y: Integer;
Color,
xs, ys,
xe,
ye: Integer): Boolean;
var x,y = u well put to variables in there, they will be returned as the value of the the x,y position.
Color=Color your searching for, use the crosshairs to pick the color to get the number for that color and put it here
xs=Top left corner in what u r searching in(x coordinate)
ys=^^^^^^^^^^^^^^^^^^^^^^^^^(y coordinate)
xe=Bottom Right corner in what u r searching in(x coordinate)
ye=^^^^^^^^^^^^^^^^^^^^^^^^^^^^(y coordinate)
and if it is found it will return true
so
if(findcolor(x,y,21432,32,32,454,546)=True)then and so on.
a little pick on the coords
Code:
(xs,ys)__________
| |
| |
| |
|__________(xe,ye)
Find Bitmap:
Originally Posted by
The Rs Monkey
FindBitmap(Bitmap: Integer; var x,y: Integer): Boolean;
Bitmap=Picture u r looking for(lets explain this a bitmore)
first to get the picture go to script -> picture to string, once u do that and selected a picture, it will return as a string, copy that ALL down. and define the variable, variable as in "hi" in hi = BitmapFromString('dsnfsanihbgfuhidahbygsxihdjfi')
var x,y = u well put to variables in there, they will be returned as the value of the bitmap
Inttostr:
This will allow you to put an integer into a string
use
Code:
inttostr(i : integer) : string;
something like this:
Strtoint:
This will allow you to put an string into a integer
use
Code:
strtoint(abc : string) : integer;
something like this:
Wait:
Code:
wait(i : miliseconds);
waits a certain num of milliseconds
that will wait for 1 second
Clickmouse:
Code:
Clickmouse(var x,y:integer; left : boolean);
will click at a certain position
use
Code:
Clickmouse(45,45,True)
that will left click at 45,45
to right click change True to false
Sendkeys:
Code:
sendkeys(s : string);
will send a letter(s) or word(s)
usewill type "hi", note, will type really fast.
Random:
Code:
random(i : integer) : integer;
will return random integer from the ranger you selected
say you put 6
will return random integer from 0-5, or 0,1,2,3,4,5(will choose one), or say random(6) + 1 will return from 1 - 6
useWriteln:
Code:
Writeln(s : string);
will put text in debug box
useCleardebug:
will clear debug
useIsFKeyDown
will return true if fkey is down
use
Code:
if isfkeydown(1)=true then
and so on.
SendKeysVb:
mostly used for enter.
Code:
SendKeysVb('{ENTER}',false)
Getmousepos:
will return x and y as the mouse pos
Movemouse:
will movemouse to coords
HOLDMOUSE:
will hold left or right down starting at x,y
Code:
Holdmouse(x,y,true)
TRUE FOR LEFT CLICK
FALSE FOR RIGHT
RELEASEMOUSE:
will release left or right down starting at x,y (use with holdmouse function)
Code:
releasemouse(x,y,true)
TRUE FOR LEFT CLICK
FALSE FOR RIGHT
MoveMouseSmooth
moves mouse like human.
self explanatoy like everything else
use
Code:
movemousesmooth(45,45)
CHAPTER 4 - OTHER FUNCTIONS
IsTextUp:
This will check if the text is in the corner of the rs window, like Attack or Mine Or Take
Code:
Function IsTextAt3(x, y : Integer; S : String; Tolerance : Integer) : Boolean;
Var
a, b : Integer;
Begin
result:= IsTextInAreaEx(x - 2, y - 2, x + 2, y + 2, a, b, S, Tolerance, ChrCharsNormal, True, False, 0, 1, -1);
End;
Function IsTextUp(text : String) : Boolean;
Begin
result:= IsTextAt3(9, 9, text, 100);//reads text in corner of rs
End;
begin
ChrCharsNormal:= LoadChars2(AppPath + 'Charsrs22\'); //Loads rs characters from bitmaps
end.
use
Code:
if IsTextUp('Attack') = true then
Sendkeyshuman:
will send keys like a human would.
Code:
Procedure SendKeysHuman(text:String);
Var
a1 : Integer;
Begin
a1:= 1;
Repeat
wait(random(220) + 15);
sendkeys(copy(text, a1, 1));
a1:= a1 + 1;
Until a1 > length(text);
End;
Use is self explanitory if your reading this tutorial.
In Fight?:
Code:
Function InFight : Boolean;
Var
a, b : Integer;
Begin
If(findcolorspiral(a, b, 16728128, 215, 115, 330, 185))
Or(findcolorspiral(a, b, 192, 215, 115, 330, 185))Then
If(Poisoned= false)And(diseased= false)Then
result:= true;
End;
This Will Return True If You In A Fight:
Code:
if InFight = True Then
and so on.
FlagPresent
Checks if the flag is present on the minimap.
Code:
Function FlagPresent : Boolean;
Var
a, b, runescapeflag, runescapeflag2 : Integer;
Begin
result:= false;
runescapeflag := BitmapFromString(7, 7, 'z78DA3330200CDCDC' +
'8855835F25B21A5C2A31D560AAC4A50659257E35A49200AE7D3BF' +
'1');
runescapeflag2 := BitmapFromstring(2, 4,
'C656045D3311C656045D3311C656045D3311C656045D3311');
If(findbitmapin(runescapeflag, a, b, 555, 5, 735, 160))
Or(findbitmapin(runescapeflag2, a, b, 555, 5, 735, 160))Then
Begin
wait(50);
If(findbitmapin(runescapeflag, a, b, 555, 5, 735, 160))
Or(findbitmapin(runescapeflag2, a, b, 555, 5, 735, 160))Then
result:=true;
End;
FreeBitmap(runescapeflag);
FreeBitmap(runescapeflag2);
End;
to check if it is present
Code:
if Flagpresent = true then
... and so on.
Checkchatmsg
Checks last message in the chatbox and sees if it is the same as what u specified.
Code:
Function CheckChatMsg(Text: String) : Boolean;
Begin
Result:= IsTextAtEx(20, 415, Text, 40, ChrChatChars, False, True, 0, 1, 0);
End;
Clickhuman
Code:
Procedure ClickHuman(x, y : Integer; left : Boolean);
Begin
holdmouse(x, y, left);
wait(random(20) + 15);
releasemouse(x, y, left);
End;
Takescreenshot
Code:
Procedure TakeScreenShot(reason:String; number:Integer);
Begin
SaveScreenshot(apppath + 'scripts\' + reason + inttostr(number) + '.bmp');
writeln('Screenshot taken: ' + reason + ' #' + inttostr(number));
End;
CHAPTER 5 - Touch ups
Reports:
Use reports so user's can see what the script has been doing.
a report script would look something like this.
Code:
Procedure report;
begin
writeln('This is my Autominer')
writeln('Mined: ' + inttostr(numrocksmined))
writeln('End Report')
end;
this is a example of a simple report.
CHAPTER 6 - Making User Forms(for advanced)
1.Open Scar
2.Tools -> Form Editor...
3.Click and drag a button on the form.
and
4.Save Form
5.Loadform
6.Stuff should appear in the debug box.
7.Delete Whats Is In scar(Program New; Begin End; Etc)
8.And Copy the stuff that appeared in the debug and paste it in the script.
Put those between Proecdure tags
Code:
Procedure Form1;
begin
//stuff here
end;
9.And Copy The Variables At The Bottom Of The Debug Box To The Top Of You Script.
10.Add this Button on click thingy in the stuff in the script
11.And Define this Procedure:
12.And At The Bottom of you script put this:
Code:
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('Form1', v);
//Replace Form1 with the Procedure name you put the stuff between.
end;
procedure ShowFormModal;
begin
frmDesign.ShowModal;
//Replace frmDesign with the name of your form
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
13. And At The Bottom add
Code:
begin
SafeInitForm;
SafeShowFormModal;
end.
14. When Finished:
Code:
program New;
var
frmDesign : TForm;
Button1 : TButton;
procedure buttonclick(sender: TObject);
begin
Writeln('Button pressed!');
frmDesign.Caption:= frmDesign.Caption + '.';
frmDesign.ModalResult:= mrOk;
end;
procedure InitForm;
begin
frmDesign := CreateForm;
frmDesign.Left := 259;
frmDesign.Top := 132;
frmDesign.Width := 354;
frmDesign.Height := 254;
frmDesign.Caption := 'frmDesign';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := False;
frmDesign.PixelsPerInch := 96;
Button1 := TButton.Create(frmDesign);
Button1.OnClick:= @buttonclick;
Button1.Parent := frmDesign;
Button1.Left := 69;
Button1.Top := 61;
Button1.Width := 75;
Button1.Height := 25;
Button1.Caption := 'Button1';
Button1.TabOrder := 8;
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
begin
SafeInitForm;
SafeShowFormModal;
end.
15. For More Info, on scar, press f1, or go to help->help, and scroll to the bottom of that page.
CHAPTER 7 - Making Procedures/Functions
Procedures - Runs a certain code, like clickmouse or writeln
Basic Syntax
Code:
Procedure Show;
begin
end;
or you can have them enter info
Code:
Procedure Fight(colorofprey : integer; eatfood : boolean);
begin
writeln('Looking for ' + inttostr(colorofprey))
//not really a fight function, just an example.
end;
Functions - returns values or booleans like findcolor = true or find bitmap
Basic Syntax
Code:
Function belowten(num : integer) : boolean;
begin
result:= false;
if(num < 10)then
result:= true;
end;
CHAPTER 8 - Making Your Own Scripts(Tuts)
Autoclicker:
Code:
program Autoclicker;
Const
Betweentime = 1; //Wait between each click in seconds.
var x,y:integer;
begin
repeat
getmousepos(x,y);
clickmouse(x,y,True);
wait((Betweentime * 1000) + random(300))
until(false)
end.
Ok We Put The Code Between Repeat and until(false) so this will run forever until the user stops it.
ok in the wait between each click we put
Code:
wait((Betweentime * 1000) + random(300))
between time is what the user wants to wait before clicks, we times it by 1000 to convert it to milliseconds, and we put random(300) milliseconds to make it more human like. that is pretty much it.
Autotalker:
Code:
program Autotalker;
Const
Whattosay = 'Hiyah';//What to type F1
begin
repeat
if(IsFKeyDown(1))then
begin
sendkeys(Whattosay);
SendKeysVb('{ENTER}',false);
end;
wait(300);//Keeps it from saying it more than once on one simple click,
//remove this and press f1 too see what i mean.
until(false)
end.
Selfexplanatory. IsFKeyDown Checks to see if the fkey is down.
CHAPTER 9 - ERRORS? SOLUTIONS HERE
- Click HERE
CHAPTER 10 - Run scar on 2+ Accounts
- Click HERE
CHAPTER 11 - A List Of Tutorials By Other People.
-----------------------------------------------------------------------------------------------------------
THANK YOU FOR READING THIS FAR, THATS THE END OF MY TUTORIAL, I WILL ADD STUFF ON REQUEST, JUST POST HERE.
NOTE: DONT REQUEST SCRIPTS HERE! AS THAT SAID, I WILL CONSIDER IT AS SPAM!