- DTM's
You can use a DTM for an item in your inv, for the bankers, etc...
1.- Take a pic of the item you want to use as DTM
2.- go to SCAR > Tools > DTM Editor...
3.- Load your pic
4.- Click on the center, then start clicking around the black outline of the item
5.- File > DTM to Text
6.- A string will appear in the debug box.
7.- Paste them in your script
8.- Test it!
a DTM should look like this:
SCAR Code:
DTM := DTMFromString('A4D64F65S4G684SG65S4G65SG465SG4D5641V5D4G85S4G8SD4G165DS4G56G');// Just an example
SCAR Code:
program New;
{.include srl/srl.scar}
var
x, y, Log : Integer; // you can change the name
Procedure DTMExample;
begin
Log := DTMFromString('A4D64F65S4G684SG65S4G65SG465SG4D5641V5D4G85S4G8SD4G165DS4G56G');// Just an example
end;
begin
SetupSRL;
ActivateClient;
DTMExample;
if FindDTM(Log, x, y, MIX1, MIY1, MIX2, MIY2) then// here we are finding for the DTM, MIX's and MIY's are the inv coords for searching
begin
Mouse(x, y, 5, 5, True);
Writeln('yay');
end else
Writeln('nooo');
end.
also, you can 'free' the DTM from the the memory.
SCAR Code:
FreeDTM(dtmname : integer);
Example:
SCAR Code:
program New;
{.include srl/srl.scar}
var
x, y, Log : Integer;
Procedure DTMExample;
begin
Log := DTMFromString('A4D64F65S4G684SG65S4G65SG465SG4D5641V5D4G85S4G8SD4G165DS4G56G');
end;
begin
SetupSRL;
ActivateClient;
DTMExample;
if FindDTM(Log, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 5, 5, True);
Writeln('yay');
FreeDTM(Log);// here
end else
Writeln('nooo');
FreeDTM(Log);// and here
end.
if you free DTMs your script will be be smoother and will not cause memory leaks.
how to count items with DTM's:
SCAR Code:
CountItemsDtm('inv', DtmName : integer) : integer;
(doesnt count stackables)
this one count stackables:
SCAR Code:
AmountDtm('inv', DtmName : integer): Integer;
- BMP's
if you are going to make a BMP, try to make it smallest as possible or else, it will lag. You can use Bmp's for items, or something like the 'Click Here to Continue' button.
1.- The same as the DTM but instead of using the DTM Editor... you are going to enter to 'Picture to String...'.
2.- Load the pic.
3.- press 'OK'
4.- Paste the string in the debug box to your script.
The same applies for BMPs, you can free it using:
SCAR Code:
FreeBitmap(bmpname : integer);
how to count items in the inv with bmp's:
SCAR Code:
CountItemsBmp('inv', BmpName, Tol : integer): integer;
with stackables:
SCAR Code:
AmountBmp('inv', BmpName, Tol : integer): integer;
- RadialWalk(or other)
here, I'll be using 'RadialWalk':
SCAR Code:
RadialWalk(thecolor, startradial, endradial, radius, Xmod, Ymod : integer): boolean;
the best way for 'thecolor' in RadialWalk is using autocoloring functions (EDIT: This does not applies for recent SRL revisions. Use AutoColor(srl_VarrockRoadColor)!):
SCAR Code:
// » function FindWaterColor: Integer; | by Tarajunky
// » function FindRoadColor: Integer; | by Tarajunky
// » function FindVarrockRoadColor: Integer; | by Tarajunky
// » function FindFallyRoadColor: Integer; | by Tarajunky
// » function FindRockColor: Integer; | by Tarajunky
// » function FindStoneColor: Integer; | by Tarajunky
// » function FindDirtRoadColor: Integer; | by Tarajunky
// » function FindBridgeColor: Integer; | by Tarajunky
// » function FindLadderColor: Integer; | by Tarajunky
// » function AutoColorThis(Bitmap, MaxTol, X1, Y1, X2, Y2:Integer) : integer; | by Sumilion
Remember colors change so you need to get it again everytime.
the 'startradial' and 'endradial' are:
an example:
if you want to search the read square I put there, you need to know the 'radius'
'radius':
The distance of the color from the center of the minimap to click, the number must be betweeen 0-70.
'Xmod,Ymod':
numbers between -1, 1. Read Zephyr's fury walking tut for more info: http://www.villavu.com/forum/showthr...ost241494.html
SCAR Code:
RadialWalk(FindRoadColor, 0, 360, 65, 1, 1);
but wait, remember that RadialWalk returns a boolean so an efficient example could be:
SCAR Code:
if RadialWalk(FindFallyRoadColor, 0, 360, 65, -1, 1) then
Writeln('We are at fally')
else
Writeln('we arent at fally');
just remember to use autocoloring functions
EDIT: Now you can use RadialWalkTolerance!
I forgot to say, RadialWalk has FFlag(10) inside it, so it's not necessary to add:
SCAR Code:
if RadialWalk(FindRoadColor, 0, 360, 65, 0, 1) then Flag;
- Failsafes
They are always needed.
one way could be:
SCAR Code:
if FindColor(bla) then
begin
Writeln('something');
end else // here
bla
end else; works as end; and else
or you can use:
they are the same except they doesn't work as end;
the most used:
SCAR Code:
if (not(LoggedIn)) then Exit;
people use it at the start of a procedure/function to check if the player is really logged in
Another way:
SCAR Code:
procedure FindTree;
var
x,y,Time,NotFound : Integer;
begin
MarkTime(Time);
repeat
if FindObjCustom(x, y, blabla) then
begin
Mouse(x, y, 3, 3, True);
Exit;
end else
NotFound := +1;
until (TimeFromMark(Time) <= 10*10*10*10) or (NotFound = 5);
end;
See?
- Multi Players
They are easy, just declare players:
SCAR Code:
Procedure DeclarePlayers;
begin
HowManyPlayers := 2;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 letters of your Username
Players[0].Active := True; // Auto with this char?
Players[1].Name := '';
Players[1].Pass := '';
Players[1].Nick := '';
Players[1].Active := True;
end;
and remember to logout and set the activity to false if SRL couldn't solve the random:
SCAR Code:
if FindNormalRandoms then
If Not LoggedIn Then
begin
Writeln('Found unsolvable random');
NextPlayer(False);
end;
- Anti Ban
Remember people gets bored sometimes, so antiban makes your script gets bored too! :
SCAR Code:
procedure AntiBan;
begin
if (not(LoggedIn)) then
Exit;
case random(40) of
0: SleepAndMoveMouse(1232+random(857));
1: HoverSkill('woodcutting', False);
2: begin
DoEmote(1+random(17));
wait(2546+random(165))
GameTab(1 +random(5))
Gametab(4)
end;
3: MMouse(random(250), random(250), 10, 10);
4: PickUpMouse;
5: begin
GameTab(1 + Random(12));
wait(1000+random(1000));
GameTab(4);
end;
end;
end;
Try using functions and procedures that simulate human behavior (like chaning tabs randomly, examining objects, etc).
- Anti Randoms
It's so easy to solve a random with SRL included!
How to know when SRL couldn't solve a random:
SCAR Code:
if FindNormalRandoms then
If Not LoggedIn Then
begin
Writeln('Found unsolvable random');
NextPlayer(False);
end;
- FindNormalRandoms; will look for all randoms and solve them.
- FindFight; When you randomly get a fight
EDIT: No longer applies - but you can get fight from highway men too
- Cases, Arrays, FindingColors
Cases:
SCAR Code:
case random(40) of
0: bla
1: bla
2 : begin blabla; bla2; end;
end;
Antiban procedures normally use that.
SCAR Code:
program new;
{include srl/srl.scar}
const
whattotype = '1'; // 1 if you want to type hello, 2 for bye, and 3 for how r u
procedure Typethem;
begin
case (whattotype) of
'1': TypeSend('hello');
'2': TypeSend('bye');
'3': TypeSend('how r u');
end else
Writeln('the options are: 1, 2 and 3 only');
end;
begin
SetupSRL;
ActivateClient;
Typethem;
end.
Arrays:
SCAR Code:
procedure hi;
words : Array[0..4] of string;
begin
words[0] := 'hi';
words[1] := 'bye';
words[2] := 'sup';
words[3] := IntToStr(im bored);
words[4] := FloatToStr(10*3)
end;
or
SCAR Code:
procedure hi;
words : array of string;
i : Integer;
begin
SetLength(words, 2);
for i:=0 to High(words) do
begin
words[i] := 'this will apply for every string';
end;
end;
- Finding Colors:
There are many ways for that, you can use TPA's, FindObjCustom, FindColorTolerance/FindColorSpiralTolerance, etc...
but, never use FindColor or FindColorSpiral.
SCAR Code:
if FindColorTolerance(x, y, 1515661, MSX1, MSY1, MSX2, MSY2, 15) then
begin
Writeln('found it');
Mouse(x, y, 5, 5, True);
...
That's all, you find the color, store the coords in x and y, and then you click it.
-Standards
They are needed for any script, so people will understand/read you script without burning their eyes.
a script without standards:
SCAR Code:
program new;
procedure do;
begin
Writeln('sup');
MMouse(random(500),25,100,200))
Disguise('i dont know standards');
repeat
writeln(IntTOSTR(RANDOM(100000)));
until (false);
end;
begin
do;
end.
a script with standards:
SCAR Code:
program new;
{include SRL\SRL.scar}
var
x, y, LogDTM, LogBMP : integer;
procedure LoadDTM;
begin
LogDTM := DTMFromString('bla');
end;
procedure LoadBMP;
begin
LogBMP := BitmapFromString(10,10,'bla');
end;
begin
SetupSRL;
ActivateClient;
LoadDTM;
if FindDTM(LogDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 5, 5, True);
FreeDTM(LogDTM');
end else
LoadBMP;
if FindBitmap(x, y, LogBMP) then
begin
Mouse(x, y, 5, 5, True);
FreeBitmap(LogBMP);
end else
Writeln('couldnt find log!);
end.
rules :
-
SCAR Code:
var
x,y : integer;// did you see two white spaces?
-
SCAR Code:
begin
writeln('Skip two spaces');
end.
-same.
More and more to learn from:
-DDTM's
YoHoJo's DDTM Tut - http://www.villavu.com/forum/showthread.php?t=12584
DDTM's and their uses - by Cut em2 it - http://www.villavu.com/forum/showthread.php?t=26968
-Path
A guide to the noteworthy “WalkPath(0);” -by footballdjs-http://www.villavu.com/forum/showthread.php?t=25712
-TPA's
ObjectFinding using TPointArray-by negaal-http://www.villavu.com/forum/showthread.php?t=26006
.:The Almighty TPA Tutorial:. -by n3ss3s- http://www.villavu.com/forum/showthread.php?t=21786
-Forms
http://www.villavu.com/forum/showthread.php?t=17966
http://www.villavu.com/forum/showthread.php?t=17196
http://www.villavu.com/forum/showthread.php?t=23850
http://www.villavu.com/forum/showthread.php?t=12000
http://www.villavu.com/forum/showthread.php?t=1101
http://www.villavu.com/forum/showthread.php?t=15209
http://www.villavu.com/forum/showthread.php?t=13520
http://www.villavu.com/forum/showthread.php?t=3664
http://www.villavu.com/forum/showthread.php?t=24998
http://www.villavu.com/forum/showthread.php?t=
http://www.villavu.com/forum/showthread.php?t=12360
http://www.villavu.com/forum/showthread.php?t=14077
http://www.villavu.com/forum/showthread.php?t=13618
http://www.villavu.com/forum/showthread.php?t=13806
http://www.villavu.com/forum/showthread.php?t=11176
http://www.villavu.com/forum/showthread.php?t=1616
http://www.villavu.com/forum/showthread.php?t=3688
http://www.villavu.com/forum/showthread.php?t=3709
http://www.villavu.com/forum/showthread.php?t=3660