Part Eight: Clicking!
There are many ways to click in SCAR. The most common is:
Where the mouse will move to an object if it is found in a "FindObj" procedure or such, True meaning it will click, False meaning it wont click.
This True/False balance is useful for making cases to make you more human like. For example if you had this procedure:
SCAR Code:
if FindObjCustom(x, y, ['Min', 'ine'], [RockColour1, RockColour2], 7) then
begin;
Mouse(x, y, 4, 4,false);
ChooseOption('ine');
end;
Now there is nothing wrong with that procedure, but you being human wouldnt always right click and choose "Mine" would you? So you can use the True/False to make your cases which mean that you can be more human like:
SCAR Code:
if FindObjCustom(x, y, ['Min', 'ine'], [RockColour1, RockColour2], 7) then
repeat
case (Random(2)) of
1: Mouse(x, y, 4, 4,false);
ChooseOption('ine');
2: Mouse(x, y, 4, 4, True);
end;
So sometimes it will move over the rock and choose the Mine, and other times it will just automatically click on the rock.
You can also use ClickMouse, but apparently this is detectable and obsolete now, so we do not use it.
Part Nine: Banking
Copied from my Cutting/Banking Tutorial:
SCAR Code:
procedure Banking;
begin
if (InvFull) then
begin
MakeCompass('N')
Wait (300 + random(160));
OpenBankQuiet('db');
if (PinScreen) then
InPin(YourPin);
if(FindColorSpiral(x, y, 4155248, 547, 206, 734, 464))then
begin
Mouse(x, y, 4, 3, false);
ChooseOption('All');
end;
CloseBank;
Wait(150 + random (278));
MakeCompass('S');
end;
end;
It begins by saying If(InvFull) so it will only bank if the inventory is full. It will make the compass face north, and wait about 460.
SCAR Code:
OpenBankQuiet('db');
if (PinScreen) then
InPin(YourPin);
OpenBankQuiet is a little more laggy, but will open the bank more like a human would, and the 'db' stands for "Draynor Bank" so 'veb' would stand for "Varrock East Bank"
if (PinScreen) then - this means that if the script picks up the Pin Screen then it will "InPin(YourPin)" so as enters your pin for you. (YourPin would be the constant we declared earlier.)
SCAR Code:
if(FindColorSpiral(x, y, 4155248, 547, 206, 734, 464))then
This means that if looks for the colour 4155248(The willow logs) between the coordinates of your inventory which are the 4 numbers after, then means that it should do .... after the colour has been found.
SCAR Code:
begin
Mouse(x, y, 4, 3, false);
ChooseOption('All');
end;
This means it will begin the following. It looks for the colour, and when found it hovers over the willow log in the inventory, and chooses the option 'All' and then ends the part.
SCAR Code:
CloseBank;
Wait(150 + random (278));
MakeCompass('S');
end;
end;
This Closes the bank after the logs have been deposited, waits about 400, and then makes the compass south ready for the walk back to the willows in my script. The ends again just end the procedure.
Part Ten: DTM's
Now, a DTM is part of any good SRL Members worth script. It means that you can find objects for walking, or even for making failsafes like I did, but shorter and more efficient than a Bitmap would. To make a DTM we have to go to Tools, then to DTM Editor. You should get this screen pop up:
Then you click in the centre of the picture you are using, and branch lines out wards like this:
Then you save the DTM, and open up a new page (Just go to File-->New)
Once you have done that, Go to Test -> Find DTM, and open your saved DTM:
If your DTM has worked, you should get something like this (If you get a little box pop up click "No")
Then to get the code for a DTM go to "Open" and Reopen your DTM. Then go to "File" --> "DTM To Text". You will get something like this in your Debug box:
SCAR Code:
DTM := DTMFromString('78DA63E4666060106540011919D9609A11CA6' +
'704A9614255131FAA83AA861F4888A0AA7171F1C454238DAA2638' +
'2412D32E3435393979A86AD831D5949494A1AA6101126204D480C' +
'C11445553515189AA861348F0A2AAA9ACAC4255C301245819D000' +
'23AA1A901902A82ABCBD0351D580DC2289AAC6CDDD1B530D9ABFE' +
'CED5D50D580DC2285DFEF0078731064');
Now name it, declare it as an integer variable, and use it in the script.
Part Eleven: Using DTM's Efficiently..
Using DTM's efficiently is very important. It means that youcan find thing alot easier, but in smaller code then you would if you used a Bitmap. DTM's are alot faster then BMP's, and also take up less room.
There are two ways to use a DTM:
SCAR Code:
if FindDTM(BrokenAxe, x, y, 547, 206, 734, 464) then
or you can use:
SCAR Code:
if DTMRotated(BrokenAxe, x, y, 547, 206, 734, 464) then
The FindDTM will look for a DTM between the coordinates that you set, but the DTM Rotated will look for a DTM without rotating, then will gradually increase rotation around 0 until it finds the DTM specified.
So if you was using a DTM to find something in your inventory, then you would just use FindDTM, but if you was using a DTM to find something equipped (ForExample) it will Rotate around until it finds it.
To load a DTM you need a simple procedure like this:
SCAR Code:
procedure LoadDTMs;
begin
DTM := DTMFromString('78DA63E4666060106540011919D9609A11CA6' +
'704A9614255131FAA83AA861F4888A0AA7171F1C454238DAA2638' +
'2412D32E3435393979A86AD831D5949494A1AA6101126204D480C' +
'C11445553515189AA861348F0A2AAA9ACAC4255C301245819D000' +
'23AA1A901902A82ABCBD0351D580DC2289AAC6CDDD1B530D9ABFE' +
'CED5D50D580DC2285DFEF0078731064');
end;
Now in your MainLoop after you SetupSRL or whatever, you put "LoadDTMs;" like this in my main loop:
SCAR Code:
procedure SetupScript;
begin
SmartSetupEx(SMARTWorld, false, true);
SetTargetDC(SmartGetDC);
while not SmartReady do Wait(2000);
SRLId := YourSRLId;
SRLPassword:= YourSRLPassword;
SetupSRL;
ScriptID:= '687';
Signature;
DeclarePlayers;
LoadDTMs; //Load DTMs is here.
LoginPlayer;
end;
Part Twelve: Standards
Standards are pretty good to have in a script. They make it look more appealing and make it easier to read. The basic standards are as follows:
SCAR Code:
begin
if(blaa)then
begin
LogOut;
Writeln('PlayerLogout')
end;
end.
So 2 spaces forwards per begin and 2 spaces backwards per end.
Im not too good at standards myself though, so this tutorial is good aswell: http://www.villavu.com/forum/showthr...?t=3293?t=3997.
Part Thirteen/Fourteen: AntiBan & AntiRandoms
From my Tutorial:
Overview
AntiRandoms, and less importantly AntiBan, are needed in any script to make it SRL Member quality [AntiRandoms for sure, AntiBan helps] and to stop it being flawed when Jagex sends out a random to stop us autoing. With the ability to sleep, logout randomly and switch players in SCAR, we can recude the amount of randoms, but ofcourse we still get them. AntiRandoms catch any randoms, save unsolvable ones [Mime, Maze, etc] and solve them.
AntiBan stops robotic movements, and acts playerlike, 'checking' skills, pretending to log out, and occasionally does emotes aswell.
Nicknames and their use with AntiRandoms
You have probably seen this at the start of every script:
SCAR Code:
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := 'Username';
Players[0].Pass := 'Password';
Players[0].Nick := 'ame';
Players[0].Active := True;
end;
The important part here is the .Nick part. Enter a few letters of your username and SRL creates a mask of your nickname, and looks for it when a talking random pops up and gives you something.
UsingAntiRandoms
Since the release of SRL 4 Rev#14, the AntiRandoms procedure is pretty basic. All you have to do is setup a procedure following this:
SCAR Code:
procedure FindRandoms;
begin
LampSkill := 'theskill';
FindNormalRandoms;
if FindFight then RunAway('N',True,1,15000);
end;
LampSkill - Theskill is when you setup a script, ie, fletching, you set it to get the LampSkill fletching
FindNormal Randoms - Finds the normal randoms.
FindFight - If it finds a fight it runs away! Runs North, True ie, it will run north, up about 1 or 2, and waits 15 seconds.
This is all you basically need now. I will explain how to use AntiRandoms later on.
Using AntiBan
When making a script, you need to have an AntiBan procedure, to do what the name says, stop you from being Banned! This is achievable by following something of this sort:
SCAR Code:
procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(30) of
1: RandomRClick;
2: HoverSkill('Woodcutting', False);
3: RandomMovement;
4: BoredHuman;
5: AlmostLogout;
6: DoEmote(400 +Random(90));
end;
end;
1) RandomRClick - Randomly Right clicks the mouse anywhere in the screen
2) HoverSkill - Hovers over the skill declared in the ' ', but doesnt click on it[why it says false]
3) RandomMovement - Randomly moves the mouse
4) Bored Human - Moves the mouse around like someone who is bored would do.
5) AlmostLogout - Clicks on logout, like someone who might have had enough of playing, and doesnt click, just hovers over the logout button
6) Do Emote - Does an emote, with a 400-490 random chance.
Using AntiBan & AntiRandoms:
Say this is your script:
SCAR Code:
procedure DeclarePlayers;
begin
HowManyPlayers := 1; //How many Players
NumberOfPlayers(HowManyPlayers);
CurrentPlayer :=0; //Starting Player
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
end;
Procedure ChopTree;
begin
if not LoggedIn then
Exit;
MakeCompass('N');
repeat
if FindObjCustom(x, y, ['Wil', 'low'], [1989969, 3760987, 2844763], 7) then
begin
Mouse(x,y,0,0,false);
Wait(500+(random(150)));
ChooseOption('hop')
AntiBan;
Writeln('Found Tree!');
end else
Writeln('Tree Not Found!');
AntiBan;
AntiBan;
AntiBan;
until( InvFull )
end;
begin
Chopping
end.
Now Random Finding happens well, when a Random Pops up, but you have to TELL your script to do AntiBan. Now notice how much AntiBan is in the above script. It AntiBans when chopping, like you do, move the mouse boredly etc, but also when it doesnt find the tree, it AntiBans until it does, or until the inventory is full.
Part Fifteen: Main Looping
From my tutorial
SCAR Code:
begin
SetupScript;
repeat
WalkToWillow;
ChopTree;
AntiBan;
WalkToBank;
Banking;
if (LoadsNum2=Loads) then
begin
NextPlayer(True);
LoadsNum2 := 0;
MakeCompass('S')
Writeln('Players Switched successfully')
end;
until (false)
end.
So, a little more complicated then it seems.
SCAR Code:
begin
SetupScript;
repeat
WalkToWillow;
ChopTree;
AntiBan;
WalkToBank;
Banking;
IT begins by doing SetupScript, then Repeats the WalkToWillow, ChopTree, AntiBanning, Walking to the Bank and Banking.
SCAR Code:
if (LoadsNum2=Loads) then
begin
NextPlayer(True);
LoadsNum2 := 0;
MakeCompass('S')
Writeln('Players Switched successfully')
If the LoadsNum2 = The Loads we setup to do at the constants at the start, it will begin by Logging in the Next Player, making sure that this player is True, IE, it will always repeat. It makes the LoadsNum2 = 0 again so that it doesnt logout instantly, and makes the compass south, writing in the Debug box "Players switched sucessfully'"
Things to make your script appealing
There are a few ways to make your script look sexy and appealing, and also to provide information and make it look official. The first part is signatures:
Part One: Signatures
Go here and get your signature text made up: http://www.network-science.de/ascii/
Now we can start our signature. It is pretty basic. Mine is like this:
SCAR Code:
procedure Signature;
begin
ClearDebug;
wait(250 + random(30));
writeln(' Torrents Willow Crusher&Banker V2.1 ');
wait(250 + random(30));
writeln(' _____ _ ');
wait(250 + random(30));
writeln('(_ _) ( )_ ');
wait(250 + random(30));
writeln(' | | _ _ __ _ __ __ ___ | ,_)');
wait(250 + random(30));
writeln(' | | / _`\ ( "__)( "__)/"__`\/" _ `\| | ');
wait(250 + random(30));
writeln(' | |( (_) )| | | | ( ___/| ( ) || |_ ');
wait(250 + random(30));
writeln(' (_)`\___/ (_) (_) `\____)(_) (_) \__)');
wait(500 + random(30));
end;
It begins, and ClearDeubg's, which means it clears the debug box from any previous information that was there. It then rolls down the signature (Try it in your SCAR). Mine rolls down because I didnt want it all appearing at once, but remove the waits and you can.
Part Two: Progress Reports
Progress reports are harder, but again not to difficult, this is mine:
SCAR Code:
procedure ToFProggy;
begin
ClearDebug;
Writeln(',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,');
Writeln('/\Please Post Progress Reports & Any problems /\ ');
Writeln('/\ From Wherever you got the script /\ ');
Writeln('//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ ');
Writeln('//\\Worked For: ' + TimeRunning + ' //\\');
Writeln('//\\Did: ' + IntToStr(LoadsNum)+ ' Loads //\\');
Writeln('//\\Broke: ' + IntToStr(BrokenAxes)+ ' Axes //\\');
Writeln('//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ ');
Writeln('//\\ Thanks for Using my Script :D //\\ ');
Writeln('```````````````````````````````````````````````');
end;
Now note it has IntToStr, which means it turns the integer number (So when it banks the LoadsNum gets a +1 in the script, declared as a variable) into a bit or readable text, and then my LoadsNum in brackets tells it what to get.
Part Three: Introductions
How are you going to know what to do without it? Your not. This is my introduction, but you can make it look however you want. All it has to do is explain what your script is for, how to run it, and where to set it up.
SCAR Code:
{//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\///
| Draynor Willow Crusher & Banker |
| By Torrent of Flame |
| Scar 3.14 SRL 4.0 Rev 14 |
| Version 2.0 |
| Chops Willows at Draynor and Banks them |
| Start from Draynor Bank |
| Start Logged Out |
| Replacement axes in first 2 bank slots |
| Axe equipped or in First slot |
| |
| How Many Loads at line 25 |
| Setup Player at lines 87-115 |
| SRL Stats at 65-66 |
| Bank Pin at 69 |
| SMART World at 71 |
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
Finally, Part 4: Version History
This helps to tell people what you have updated since the previous version, this again is pretty basic, but I thought I should include it. You can have brief notes like me, or have chunks of text explaining why every update took place:
SCAR Code:
{/\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
|Version 1.1 Includes |
| Anti-Ban |
| Anti-Random |
| Working Walking (Lol :D) |
| Complete Revision of Script - Sorted Unnecissary codes and BMP's |
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
|Version 1.2 Includes |
| Essential Repairs for Banking - Willow DTM was invalid, WillowBMP added |
| Banking Works! |
| Main Loop Fixed - Repeats after banking |
| |
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
|Version 1.3 Includes |
| Fixed Banking |
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
|Version 1.4 Includes |
| SRL Stats |
| Multi-Player |
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
|Version 1.5 Includes |
| BankPin Compatibility |
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
|Version 1.6 Includes |
| A Few Failsafes! |
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
|Version 1.7 Includes |
| Modified Anti-Ban |
| DTM's |
| SMART (Finally!) |
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ |
|Version 1.8 Includes |
| Willow DDTM |
| Axe Checker |
| Broken Axe Checker |
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
|Version 1.9 Includes |
| Fixed a few Bugs |
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
|Version 2.0 |
| Current Release! |
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\}
Thanks for reading! Dont forget to Repp++ or Rank the Thread!