JAD
04-11-2007, 11:25 PM
Update: Huge update, april 12th. Added a glossary and changed some things in the breaking apart the script part after the glossary. Please read it over if you haven't already and post feed back! That'd be awesome :) thanks.
This tutorial took me a LOT of time to write, so please, post FEEDBACK on it :D
When you have been learning to script for about a week or so, you may already know how to put together your first complicated, very useful script without even knowing it! In this tutorial, I will be using my script JADWillow, which is a willow anced now isn't it?" Well, I'm here to tell you, it really isn't! I am going to break this down as much as possible to help you understand how the script works. Heres what this script will demonstrate, and will hopefully teach you:
How to walk the map without walking near water/roads (wow, that sounds hard eh? :p)
The use of Anti Randoms in your script, and how/when they should be called for.
The use of Anti Ban and when you should be using that.
The use of player arrays/using multiplayer, which kind of goes along with Anti Randoms in a way.
The use of the almighty progress report. (which every good script should have in my opinion.)
The use of a LOT of fail safes. In this script, there will be a lot and you will be taught just how important they really are.
The use of opening a bank, depositing Items, closing the bank and some other things.
A nice and neat main loop.
Here is the glossary for just about every single command I use in this script, and what they do!
Note: I did not add parameters on the commands, though I will explain how the parameters should be used :) for every command I explain that has parameters, I will put a little example from my script on how I used it in there, then explain.
Glossary:
ActivateClient;
This will activate the client.
(in case you don't know) the client is the cross hair you drag on to runescape. So what this means, is if the user dragged the cross hair onto the runescape window correctly, it will activate that, boxing down SCAR.
usually used at the beginning of the main loop, before a repeat so that SCAR doesn't block the runescape screen.
AutoColorThis;
Heres how this is mostly used in my script:
GBankColor := AutoColorThis(BankBMP, 50, MMX1, MMY1, MMX2, MMY2);
So that is how I used it mostly. Heres what you fill the parameters in with.
GBankColor is where you fill in the color you want it to save it too, you must declare that as a variable though as I did in my script.
AutoColorThis is the command of course :p BankBMP is the bitmap which you also need to declare as a variable, and then put the picture in for it like BankBMP := ..etc. as I did in my script.
50 Is the maximum tolerance you want the command AutoColorThis to look for the bitmap with.
the rest is just parameters for where you want it to Auto Color it at. MM stands for mini map, so that would look for it on the minimap.
Once it does all this, if it finds the bitmap you made, it will save the color to the GBankColor variable (or whatever you made it, thats just what I used) This is great to use when you are walking somewhere without a road/water.
ChooseOption;
Heres how this is mostly used in my script:
[Size="3"]ChooseOption(x, y, 'All');
What you put between the '' is the option you want it to choose when right clicking on something like a log or something. And you just put the variables in front of it like so.
In this, it just chooses the Option All (Deposit All) for the banking.
ClearDebug;
This completely wipes out the whole debug of everything and makes it blank.
Very useful for when you are Writing a progress report, and you want a fresh one instead of more then 1 progress report, so you always get the current one.
CloseBank;
This command simply closes the bank window, clicking the the X on the runescape screen (which closes it :p)
Exit;
How this is used mostly in my script:
if(not(LoggedIn))then
Exit;
You may not know about logged in, if not, read about it below. What this does though, is if the user isn't logged in, it Exits the whole procedure/function you are in ignoring everything after it.
note: you do not have to use this with logged in, you can use it with a lot of other things too.
FindBitmap;
How it is mostly used in my script:
if (not (FindBitmap(BankBMP, x, y))) then
you should already know about if, then and not's. But heres what this does. FindBitmap is the command, which searches for the bitmap, results true if found.
Also if found, it saves the location of it to x,y (the variables) so you can make it click that location or something like that later.
BankBMP you would have to declare as a variable, and as a bitmap and you could name it whatever you want as long as the variable is the same.
FindColorTolerance;
How it is mostly used in my script:
if (FindColorTolerance(x, y, WillowColor, 160, 97, 516, 209, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 516, 209, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 516, 209, 3)) then
Well, heres what this does. FindColorTolerance looks for the color in a coordinates box with tolerance and saves the location of it to x,y (the variables). Here, I have it look for WillowColor, or WillowColorB, or WillowColorC which are all are constants.
the 160,97,516,209 is the coordinates box to look for the color in obviously. and the 3 after the coordinates box is the Tolerance to look for the color with.
Tolerance is used in case the color changes slightly, which Jagex does a lot to try to throw off our colors, causing us not to be able to auto. Luckily, we can look with tolerance! the higher the tolerance, the higher off it can go from the color. I like 3 as my tolerance.
note: you do not have to have all those or's, you could have it just look for 1 color. I have it do that so if it doesn't find 1 of the colors, it will still search for the next one.
FindDTM;
Heres how this is mostly used in my script:
if (FindDTM(Willow, x, y, 568, 209, 742, 460)) then
You should already know about if then else. FindDTM looks for the DTM you declared as a variable, and of course you declared the DTM text.
If you do not know how to make DTM's, read Yohojo's tutorial on it in the intermediate section of tutorial island (on SRL forums)
So in my script I called the DTM Willow. So if it finds that DTM in the coordinates box I made it look for it in (the inventory) it saves the location of it to x,y (the variable)
FindEnt;
Heres how this is mostly used in my script:
if (FindEnt(WillowColor)) then
You should already know about if then else. Now, FindEnt looks for an ent (the dancing tree that breaks your axe) and if it finds it, it results true.
the (WillowColor) is the color of the tree which you are chopping, and it uses that to check for the ent.
In my script I make it run away if it results true that the ent was found.
note: SRL's FindEnt (what we are talking about here and I have in my script) does not normally work. I am working on my own custom ent finding procedure, and you should make your own too if you want good ent detection.
FindNormalRandoms;
This finds and solves all the normal randoms (All talking randoms, Mystery box, lunch lady, fights....etc).
note: this does not solve all impossible to solve randoms. That includes evil bob and some others. For talking randoms, you need to use the Bitmap maker for your nick. Read about that below to learn more about that.
FixBank;
This simply scrolls the bank up to the top if it wasn't already.
Flag;
This repeats waiting until it doesn't find the red flag on the mini map. (when you click on the mini map, the red flag appears if you didn't already know :p)
HighestAngle;
This simply puts your charactor at the highest possible angle of view.
InvFull;
Heres how this is mostly used in my script (well, not mostly for this one, but this is the easiest example :p):
until (InvFull);
And what that does, is of course I have a repeat above it, it repeats the code until the Inventory is full. So pretty much, once the inventory is full, it results true.
This is used a lot in anything the chops/mines/fishes...etc. to detect When to bank/drop or whatever.
IsUpText;
Heres how this is mostly used in my script:
if (IsUpText('illow')) then
What this does is checks for the text in the upper left corner that you put between the '' .
I used this after moving the mouse to the color of the willow (and more things) then to check if the text in the upper corner says illow (AKA Willow, illow is shorter and you should try to avoid using Capitals)
So this is useful when moving the mouse to a color, and making sure that the color was of what you wanted (the willow in this case) because the color of the grass for instance could have some of the same colors as the willow.
LoggedIn;
This simply results true if an account is logged in. Mostly used in my script as:
if(not(LoggedIn))then
Exit;
note: If you do not know about exit, you should read about that above.
So this checks if your logged in, and if not it exits.
MakeCompass;
Heres how this is used mostly in my script:
MakeCompass('N');
So what MakeCompass does is just puts the compass to the angle you put between the '' . N for north, S for south, E for east and W for west.
note: It does not get the compass to a perfect angle, but it gets fairly close.
MMouse;
Heres how this is mostly used in my script:
MMouse(x,y,2,2);
So heres what this does. MMouse moves the mouse to specified location and does not click. x,y is the variables which a location should have been saved too by using FindColorTolerance or something like that (read above if you don't know about that)
The 2,2 are random pixels to go off by so the mouse doesn't always move to the exact same spot every time to keep more undetectable to Jagex.
Mouse;
Heres how this is mostly used in my script:
Mouse(x,y,2,2,true);
Now heres what that does. Mouse moves the mouse the same way MMouse does, the 2,2 are random pixels just like in MMouse. The only difference between MMouse and Mouse is that Mouse clicks, and MMouse doesn't.
The true in Mouse is for the clicking. True for left click, False for right click.
NextPlayer;
Heres how this is mostly used in my script:
NextPlayer(True);
What this does, is logs in the next player thats active in the player array.
Now, heres what the true/false would do. if you have NextPlayer(True), that would log in the next player and leave the Active option on the one you logged off of to true. So this means that the script would go over charactors multiple times, unless you terminate the script at a different time or something like that.
NextPlayer(False) Would switch charactors, and leave the Active option on the one you logged off of to false. So the next time that your script goes to the next player, the one you just logged off of would be false so it wouldn't log onto that one again.
I only use NextPlayer(False) if something went wrong (like that player got lost or something), and NextPlayer(True) if everything went well and you are just switching because the desired loads are done or something.
NickNameBMP
Heres how this is used:
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
Now, heres what this does. in FindNormalRandoms, to solve talking randoms you need this.
What this does, is creates a bitmap mask of the current player's .Nick in the DeclarePlayers procedure.
So just put this in your declare players procedure, and call for the procedure in the main loop before any repeat and you should be good to go.
OpenBankQuiet;
Heres how this is used mostly in my script:
OpenBankQuiet('eb');
What OpenBankQuiet does is opens the bank you put between the '' . (eb= edgevil bank, vwb would = varrock west bank...etc.)
The difference between OpenBankQuiet and something like OpenBank, is the OpenBankQuiet tends to lag a little bit, but it opens the bank without any weird mouse movements like thinking the bank is somewhere else when it isn't.
PopUp;
Here is how this is mostly used in my script:
PopUp('ontinue')
What this does, is if it finds the popup and the text ontinute (Continue) it would click what you put between the '' , in this case it would click 'ontinue'.
a pop up is something like when you get a level up or something like that.
RadialWalk;
Heres how this is mostly used in my script:
RadialWalk(GBankColor, 270, 290, 68, 2, 2);
In this script, I used auto color this for a bitmap and then saved that color to GBankColor. (if you don't know about autocolorthis, read about it near the top of the glossary)
The 270, 290 is the angle of the mini map you want to look for the color GBankColor in. Its just basic geometry. if those numbers were 90,180 , it would search the bottom right quarter of the mini map for that color...etc. Try using yakmans radial walking aid located in the SRL scripts folder.
the 68 is the radial, which is how far out from the center of the mini map it looks for the color (of course that goes alon with the 270,290)
the 2,2 are random pixels to click so the script doesn't click the same spot all the time. (just like in MMouse and Mouse)
RunAwayDirection;
Heres how this is used mostly in my script:
RunAwayDirection(DirToRun);
RunAwayDirection is usually used to run away from something, like a fight, ent...etc.
DirToRun is a constant I made that the user sets on which way to run if it finds a fight in this case.
So lets say the user set DirToRun to 'N'. the script would then run north if a fight was found, wait a little bit, and then use RunBack; (which I will explain right below this)
RunBack;
This is used with RunAwayDirection. Once it runs away from something like a fight, it will run back using this. So if it ran away in the direction north, it would run back south so it gets back to the same spot you were in.
SetupSRL;
This calls to setup the almighty include SRL. If you are using SRL, You need this in your main loop before any repeat (if you have any) for the script to work.
SleepAndMoveMouse;
This moves the mouse around randomly like a bored human would. heres how this is used mostly in my script:
SleepAndMoveMouse(9671 + random(1709));
This Moves the mouse around randomly like a bored human would every 9671-11380 milliseconds. Its good to add randomness to it like I did here or else it will be very detectable to Jagex.
SRLRandomsReport;
This writes in the debug the randoms your script has encountered. Normally used in the progress report procedure like I did.
TerminateScript;
This kills/ends the script. nothing else happens after this because the script stops :p
Wait;
Used like this
Wait(1000+random(500));
This just waits 1000-1500 milliseconds. Greatly advised to put a random in like so or it will be very detectable to Jagex.
Writeln;
Heres how it would be used:
Writeln('Hello world!');
It just writes in the debug box whatever you put between the '' .
If you do not understand any of the commands below, please look them up in the glossary and they should all be there :)
Now, lets begin!
Heres the script, it may freak you out at first, but don't worry! below I will explain Everything with extreme detail. Here you go:
{//-----------------------------------------------------------------------------\\
This script will chop willows at edgevil bank. Start ALL active players
at edgevil farthest east bank slot. Axes weilded or un weilded. This script
does NOT feature axe head finding, Will add soon. Do setup and do setup for
DeclarePlayers on lines 28-68. Please remember to post proggies where you
got this script :) Happy autoing!
//------------------------------------------------------------------------------\\}
program JADWillow;
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/WoodCutting.scar}
const
//------------------------------------------------------------------------------\\
//-------------------------------> Setup <--------------------------------------\\
//------------------------------------------------------------------------------\\
DirTorun = 'N';
Loads = 10; //Loads to do before switching players.
//------------------------------------------------------------------------------\\
//----> Auto Colors Only set these if the script is not finding the Willow <----\\
//------------------------------------------------------------------------------\\
WillowColor = 5398624; //Color of willow tree on Main Screen
WillowColorB = 3174496; //another color of willow on Main Screen
WillowColorC = 4293865; //another color of willow on Main Screen
//------------------------------> End Setup <-----------------------------------\\
// DO NOT TOUCH THESE! \\
var GrassColor, GrassBMP, BankBMP, GBankColor, Tries, Willow: Integer;
EntCount, LoadsNum, LoadsNumB, BushWater, BushWaterColor: Integer;
DidRandomHappen: Boolean;
// \\
{************************************************* *************************
----------> Setup Players here <----------
************************************************** ************************}
procedure DeclarePlayers;
begin
HowManyPlayers := 6; //Number of PLAYERS. active or not.
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0; //Player to start on.
//set all user names, passwords and nicks correctly please.
Players[0].Name := 'Jadseven';
Players[0].Pass := 'Password';
Players[0].Nick := 'dsev';
Players[0].Active := True;
Players[0].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[1].Name := 'UserName';
Players[1].Pass := 'Password';
Players[1].Nick := '3-4 letters of UserName';
Players[1].Active := False;
Players[1].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[2].Name := 'UserName';
Players[2].Pass := 'Password';
Players[2].Nick := '3-4 letters of UserName';
Players[2].Active := False;
Players[2].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[3].Name := 'UserName';
Players[3].Pass := 'Password';
Players[3].Nick := '3-4 letters of UserName';
Players[3].Active := False;
Players[3].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[4].Name := 'UserName';
Players[4].Pass := 'Password';
Players[4].Nick := '3-4 letters of UserName';
Players[4].Active := False;
Players[4].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[5].Name := 'UserName';
Players[5].Pass := 'Password';
Players[5].Nick := '3-4 letters of UserName';
Players[5].Active := False;
Players[5].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
end;
{ don't touch below unless you know what your doing! }
procedure Signature;
begin
ClearDebug;
writeln(' JAD willow chopper by yours truely:');
writeln(' __________ /\ ______ ');
writeln(' |__________| / \ | ____ \ ');
writeln(' | | / /\ \ | | \ \ ');
writeln(' ___ | | / /__\ \ | | \ \ ');
writeln(' \ \| | / /____\ \ | | / / ');
writeln(' \ | / / \ \ | |___/ / ');
writeln(' \____|/ / \ \|______/ ');
wait(3000 + random(750));
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Random Finding <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
function FindFastRandoms: Boolean; //By WT-Fakawi.
var
i: Integer;
begin
for i := 1 to 8 do
begin
case I of
1: if FindDead then
Result := True;
2: if FindMod then
Result := True;
3: if FindMime then
Result := True;
4: if FindMaze then
Result := True;
5: if FindQuiz then
Result := True;
6: if FindDemon then
Result := True;
7: begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].loc := 'No GameTab';
Logout;
Exit;
end;
end;
7: begin
if InBlack then
begin
Result := True;
Players[CurrentPlayer].loc := 'InBlack';
Logout;
Exit;
end;
end;
8: RC;
end;
wait(1);
end;
if (Result = true) then
DidRandomHappen := true;
end;
///////////////////////////////////////////////////////////////////////////
procedure FindRandoms;
begin
FindFastRandoms;
FindNormalRandoms;
if (FindNormalRandoms) then
DidRandomHappen := true;
if (FindEnt(WillowColor)) then
begin
RunAwayDirection(DirToRun);
Flag;
Wait(5000 + random(1500));
RunBack;
DidRandomHappen := true;
EntCount := EntCount + 1;
end;
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> JAD Proggy <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure JADProggy;
begin
ClearDebug;
Writeln(' Please Check out + register on me and pwnaz0rs forums at: ');
Writeln(' Uberbroproductions.net/forums ');
Writeln('[]=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ');
Writeln('|| JAD Progress report. Please remember to post ');
Writeln('|| proggies/bugs wherever you got this script :) ');
Writeln('[]-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ');
Writeln('|| Worked For : ' + ScriptTime2(2));
Writeln('|| Did ' + IntToStr(LoadsNum) + ' Loads ');
Writeln('|| Avoided ' + IntToStr(EntCount) + ' ents ');
Writeln('||=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ');
Writeln('||Thanks for using JAD Willow, happy autoing :) ');
SRLRandomsReport;
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Walking to Willow <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure WalkToWillow;
begin
MakeCompass('N');
GrassBMP := BitmapFromString(8, 10, 'z78DA33333177357433A' +
'335E9483439D8D4E3275D2D0CD1C841A61E006F046F69');
BushWater := BitmapFromString(1, 1, '183D00');
BushWaterColor := AutoColorThis(BushWater, 50, MMX1, MMY1, MMX2, MMY2);
RadialWalk(BushWaterColor, 75, 105, 70, 2, 2);
wait(6000 + random(1500));
Flag;
Wait(200 + random(100));
Tries := 0;
repeat
if(Tries = 40)then
begin
Writeln('Could not find willow... :( terminating script..');
TerminateScript;
end;
wait(300 + random(150));
Tries := Tries + 1;
until (FindColorTolerance(x, y, WillowColor, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 410, 340, 3));
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Walking to Bank <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure WalkToBank;
begin
if (InvFull) then
begin
MakeCompass('N');
BankBMP := BitmapFromString(7, 7, 'z78DAB370B430B230B0' +
'00938E469616966698A4B993B9B1B991050D54228B20EB422 6078' +
'34A00FBA54003');
if (not (FindBitmap(BankBMP, x, y))) then
begin
Mouse(627, 88, 8, 8, true);
Flag;
end;
GBankColor := AutoColorThis(BankBMP, 50, MMX1, MMY1, MMX2, MMY2);
RadialWalk(GBankColor, 270, 290, 68, 2, 2);
Flag;
wait(200 + random(100));
end;
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Willow Chopping <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
function ChopIt: Boolean;
begin
repeat
if (not (LoggedIn)) then
Exit;
if (FindColorTolerance(x, y, WillowColor, 160, 97, 516, 209, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 516, 209, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 516, 209, 3)) then
begin
MMouse(x, y, 3, 3);
if (IsUpText('illow')) then
begin
Mouse(x, y, 2, 2, true);
repeat
if (InvFull) or (PopUp('ontinue')) then
Exit;
if(DidRandomHappen = true) then
begin
DidRandomHappen:=False;
Mouse(x, y, 2, 2, true);
end;
FindRandoms;
SleepAndMoveMouse(9671 + random(1709));
FindRandoms;
until (not (FindColorTolerance(x, y, WillowColor, 160, 97, 410, 340, 3))) or
(not (FindColorTolerance(x, y, WillowColorB, 160, 97, 410, 340, 3)))or
(not (FindColorTolerance(x, y, WillowColorC, 160, 97, 410, 340, 3)));
repeat
if (InvFull) or (PopUp('ontinue')) then
Exit;
if(DidRandomHappen = true) then
begin
DidRandomHappen:=False;
Mouse(x, y, 2, 2, true);
end;
wait(750+random(250));
FindRandoms;
until (FindColorTolerance(x, y, WillowColor, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 410, 340, 3));
Result := True;
end;
end;
until (InvFull);
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Banking Willows <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
function BankIt: Boolean;
begin
if (InvFull) then
begin
Willow := DTMFromString('78DA63FCC4C4C0D0C9C8800A1819FE83490 68' +
'6FF40C0C8C08C550D8204D2AC40355308A86104AA994940CD 37A0' +
'7BE61050F31AA8A68F0835B3F0AB010040990CF0');
MakeCompass('S');
wait(250 + random(167));
OpenBankQuiet('eb');
Flag;
wait(500 + random(267));
FixBank;
if (FindDTM(Willow, x, y, 568, 209, 742, 460)) then
begin
Mouse(x, y, 3, 3, false);
ChooseOption(x, y, 'All');
Result := True;
if (Result = True) then
begin
LoadsNum := LoadsNum + 1;
LoadsNumB := LoadsNum + 1;
end;
end;
CloseBank;
wait(127 + random(278));
MakeCompass('N');
end;
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Main loop <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure SetupScript;
begin
Signature;
SetupSRL;
DeclarePlayers;
ActivateClient;
end;
///////////////////////////////////////////////////////////////////////////
begin
SetupScript;
repeat
WalkToWillow;
ChopIt;
WalkToBank;
BankIt;
if(LoadsNumB=Loads)then
begin
NextPlayer(True);
LoadsNumB:=0;
HighestAngle;
MakeCompass('N');
Writeln('Switched players successfully :)');
end;
JADProggy;
until (False);
end.
OK, now here we go with the explaining.
The Setup of a script
Now, for the introduction I have:
{//-----------------------------------------------------------------------------\\
This script will chop willows at edgevil bank. Start ALL active players
at edgevil farthest east bank slot. Axes weilded or un weilded. This script
does NOT feature axe head finding, Will add soon. Do setup and do setup for
DeclarePlayers on lines 28-68. Please remember to post proggies where you
got this script :) Happy autoing!
//------------------------------------------------------------------------------\\}
Now, this is very simple, yet important when making a script. Always have something at the beginning of your script that is very neat that says what to do for the script to run properly, and warnings on what the script doesn't have. And of course, you can make requests for proggies to be posted on your script :)
Also note that every new function/procedure in the whole script has comments that tell you what its doing, to make it easier to read through and get to what your looking for.
Now for the setup, heres what we have:
const
//------------------------------------------------------------------------------\\
//-------------------------------> Setup <--------------------------------------\\
//------------------------------------------------------------------------------\\
DirTorun = 'N';
Loads = 10; //Loads to do before switching players.
//------------------------------------------------------------------------------\\
//----> Auto Colors Only set these if the script is not finding the Willow <----\\
//------------------------------------------------------------------------------\\
WillowColor = 5398624; //Color of willow tree on Main Screen
WillowColorB = 3174496; //another color of willow on Main Screen
WillowColorC = 4293865; //another color of willow on Main Screen
//------------------------------> End Setup <-----------------------------------\\
// DO NOT TOUCH THESE! \\
var GrassColor, GrassBMP, BankBMP, GBankColor, Tries, Willow: Integer;
EntCount, LoadsNum, LoadsNumB, BushWater, BushWaterColor: Integer;
DidRandomHappen: Boolean;
// \\
Now we have the constants. Direction to run and loads to do before switching players (We'll talk about that later)
Its important to tell the user in comments where the setup is at and where it ends. And if you are using auto colors for the tree as we are here, I'd suggest putting comments between what the user needs to setup, and what the user could setup if the current colors aren't working.
As for the variables, I just had those there after the constants and told the user not to touch them. We will talk more about how I used those in the script later. Moving on..
Declare Players array.
Heres what we have:
{************************************************* *************************
----------> Setup Players here <----------
************************************************** ************************}
procedure DeclarePlayers;
begin
HowManyPlayers := 6; //Number of PLAYERS. active or not.
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0; //Player to start on.
//set all user names, passwords and nicks correctly please.
Players[0].Name := 'Jadseven';
Players[0].Pass := 'Password';
Players[0].Nick := 'dsev';
Players[0].Active := True;
Players[0].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[1].Name := 'UserName';
Players[1].Pass := 'Password';
Players[1].Nick := '3-4 letters of UserName';
Players[1].Active := False;
Players[1].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[2].Name := 'UserName';
Players[2].Pass := 'Password';
Players[2].Nick := '3-4 letters of UserName';
Players[2].Active := False;
Players[2].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[3].Name := 'UserName';
Players[3].Pass := 'Password';
Players[3].Nick := '3-4 letters of UserName';
Players[3].Active := False;
Players[3].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[4].Name := 'UserName';
Players[4].Pass := 'Password';
Players[4].Nick := '3-4 letters of UserName';
Players[4].Active := False;
Players[4].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[5].Name := 'UserName';
Players[5].Pass := 'Password';
Players[5].Nick := '3-4 letters of UserName';
Players[5].Active := False;
Players[5].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
end;
{ don't touch below unless you know what your doing! }
Take a look at the bottom of that. I have don't touch below unless you know what your doing in comments. I'd suggest putting that so the user knows its time to stop setting up and start the script :)
Then we have the Declare Players procedure. Now, the HowManyPlayers is How many players there are Active or not. If the script has 6 players (like here) and only 2 of those 6 are active, the HowManyPlayers still ='s 6 as you may already know.
Then we have the player arrays, the user name, password and nick name are used for the multiplayer which the user sets up so that when it goes to next player (if the next player is active) it will type in that user name + pass.
the
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
Is in the Glossary so if you don't know about that, look it up :)
In this, I have user name Jadseven and nick is dsev. It creates a bitmap mask of dsev and when somebody pops up and says Jadseven it knows to talk to that person in the randoms procedure (which he haven't gotten to yet, we'll talk about that in a minute) Moving on..
The signature
Well, this will be short lol :P and you should know how to do this. we have:
procedure Signature;
begin
ClearDebug;
writeln(' JAD willow chopper by yours truely:');
writeln(' __________ /\ ______ ');
writeln(' |__________| / \ | ____ \ ');
writeln(' | | / /\ \ | | \ \ ');
writeln(' ___ | | / /__\ \ | | \ \ ');
writeln(' \ \| | / /____\ \ | | / / ');
writeln(' \ | / / \ \ | |___/ / ');
writeln(' \____|/ / \ \|______/ ');
wait(3000 + random(750));
end;
This may not look like it says JAD on SRL forums because the spaces between text is kind of weird, but if you paste that into SCAR, it will say JAD in the procedure.
and later in the main loop, it will Writeln this, and wait a little over 3 seconds so the user has time to read your signature which you wasted so much time on lol.
Random Finding
Now, heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Random Finding <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
function FindFastRandoms: Boolean; //By WT-Fakawi.
var
i: Integer;
begin
for i := 1 to 8 do
begin
case I of
1: if FindDead then
Result := True;
2: if FindMod then
Result := True;
3: if FindMime then
Result := True;
4: if FindMaze then
Result := True;
5: if FindQuiz then
Result := True;
6: if FindDemon then
Result := True;
7: begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].loc := 'No GameTab';
Logout;
Exit;
end;
end;
7: begin
if InBlack then
begin
Result := True;
Players[CurrentPlayer].loc := 'InBlack';
Logout;
Exit;
end;
end;
8: RC;
end;
wait(1);
end;
if (Result = true) then
DidRandomHappen := true;
end;
///////////////////////////////////////////////////////////////////////////
procedure FindRandoms;
begin
FindFastRandoms;
FindNormalRandoms;
if (FindNormalRandoms) then
DidRandomHappen := true;
end;
The FindFastRandoms is NOT by me, that is by WT-Fakawi and it is used in a lot of peoples scripts :) although, if you use this in your script, don't think all your work is complete. this only checks for the things that FindNormalRandoms doesn't like mods, mime...etc.
Now in the FindRandoms; procedure, we call for FindFastRandoms, we don't call for it in the main loop, we just call for FindRandoms; which calls for FindFastRandoms because thats in that procedure :p
then we have FindNormalRandoms; this does Not solve the un solvable randoms called scape runes (evil bob...etc) FindFastRandoms looks for that though and logs out if it finds those. To learn more about FindNormalRandoms, look it up! :p
I then have
if(FindNormalRandoms) then
DidRandomHappen := true;
This just says if it finds normal randoms, then it makes that variable I declared above = true. Then in my chopping logs procedure, if it found a random, it doesn't keep waiting for the tree to be gone, instead, it solves the random then clicks the tree again (We'll get to that later once again) Moving on..
Progress report
Heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> JAD Proggy <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure JADProggy;
begin
ClearDebug;
Writeln(' Please Check out + register on me and pwnaz0rs forums at: ');
Writeln(' Uberbroproductions.net/forums ');
Writeln('[]=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ');
Writeln('|| JAD Progress report. Please remember to post ');
Writeln('|| proggies/bugs wherever you got this script :) ');
Writeln('[]-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ');
Writeln('|| Worked For : ' + ScriptTime2(2));
Writeln('|| Did ' + IntToStr(LoadsNum) + ' Loads ');
Writeln('|| Avoided ' + IntToStr(EntCount) + ' ents ');
Writeln('||=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ');
Writeln('||Thanks for using JAD Willow, happy autoing :) ');
SRLRandomsReport;
end;
First of all, this just says to check out me and pwnaz0r's awesome forums (which you should too :p) and then it says to post progress reports.
the Worked For : ' + ScriptTime2(2)); can always be used to check for how long the script has been going, and in this case, it writes in the debug of course how long its been going.
then it says how many loads it did. and how many ents it avoided. It displays this by how we added to the variables LoadsNum and things like that in the banking procedure. each time it banks, it adds 1 to LoadsNum and then it writes in the debug loads number.
Same for ent; each time it finds an ent, it adds 1 to ents and writes it in the debug.
Then we have SRLRandomsReport. To learn about that, look it up! :p Moving on..
Walking to the willow from bank
Now, heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Walking to Willow <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure WalkToWillow;
begin
MakeCompass('N');
GrassBMP := BitmapFromString(8, 10, 'z78DA33333177357433A' +
'335E9483439D8D4E3275D2D0CD1C841A61E006F046F69');
BushWater := BitmapFromString(1, 1, '183D00');
BushWaterColor := AutoColorThis(BushWater, 50, MMX1, MMY1, MMX2, MMY2);
RadialWalk(BushWaterColor, 75, 105, 70, 2, 2);
wait(6000 + random(1500));
Flag;
Wait(200 + random(100));
Tries := 0;
repeat
if(Tries = 40)then
begin
Writeln('Could not find willow... :( terminating script..');
TerminateScript;
end;
wait(300 + random(150));
Tries := Tries + 1;
until (FindColorTolerance(x, y, WillowColor, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 410, 340, 3));
end;
First of all, we make the compass face north so the walking doesn't get screwed up.
We Auto colorize the BushWaterColor so that we can radial walk using that color properly. Look it up if you don't know about AutoColorThis, because this is one of the most important things used for map walking.
note: This script does not use the GrassBMP yet, I had it in there because new version is going to use it.
So I took a bitmap of the BushWaterColor which is near the willow. It is the bush next to it with a little water in the bitmap so it doesn't click just any old bush :P
then you have BushWaterColor := AutoColorThis(BushWater, 50, MMX1, MMY1, MMX2, MMY2);
AutoColorThis picks the color from the bitmap BushWater, and saves it to BushWaterColor. I made the max tolerance 50, and it looks for it on the MM (mini map) because we have MMX1, MMY1...etc. which looks for things on the mini map of course.
Then we have it radial walk using the BushWaterColor which we auto colored.
I have it wait around 6 seconds after it clicks because the player kind of needs to walk back wards if you've ever been at the bank in edgevil, and when it walks backwards, the flag disappears for a minute, then re appears. if I didn't have it wait before waiting for the Flag to leave using the command Flag; (which just waits until the flag is gone) it would think the flag is gone when it really isn't.
Then I make the variable tries = 0. then the script repeats waiting about half a second until it finds the color of the willow color, but if it waited half a second for 40 times (20 seconds roughly) it will terminate the script because it did not click next to the willow. Moving on..
Walking to the bank from the Willow tree
Now heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Walking to Bank <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure WalkToBank;
begin
if (InvFull) then
begin
MakeCompass('N');
BankBMP := BitmapFromString(7, 7, 'z78DAB370B430B230B0' +
'00938E469616966698A4B993B9B1B991050D54228B20EB422 6078' +
'34A00FBA54003');
if (not (FindBitmap(BankBMP, x, y))) then
begin
Mouse(627, 88, 8, 8, true);
Flag;
end;
GBankColor := AutoColorThis(BankBMP, 50, MMX1, MMY1, MMX2, MMY2);
RadialWalk(GBankColor, 270, 290, 68, 2, 2);
Flag;
wait(200 + random(100));
end;
end;
now in this, if the inventory is full, it will do the rest of the procedure.
We Make the compass north, then we use the ground of the bank as a bitmap. The reason we don't just make it click the symbol of the bank is because half the time, the symbol isn't on the mini map.
if it doesn't find the bitmap of the ground of the bank, then it clicks a little east using Mouse with random pixels 8 by 8. This is a great fail safe in case it doesn't find the ground of the bank from what side of the willow its on.
Then it Flag;'s. Look it up if you don't know about flag :p
Then we have the normal thing like we did in the walking to the willow procedure which auto colors the Bank Bitmap, GBankColor is the variable of the color for the bank ground, it walks to it with radial walk, waits for flag to be gone, and does a little random waiting. Moving on..
Chopping the willow
Now heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Willow Chopping <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
function ChopIt: Boolean;
begin
repeat
if (not (LoggedIn)) then
Exit;
if (FindColorTolerance(x, y, WillowColor, 160, 97, 516, 209, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 516, 209, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 516, 209, 3)) then
begin
MMouse(x, y, 3, 3);
if (IsUpText('illow')) then
begin
Mouse(x, y, 2, 2, true);
repeat
if (InvFull) or (PopUp('ontinue')) then
Exit;
if(DidRandomHappen = true) then
begin
DidRandomHappen:=False;
Mouse(x, y, 2, 2, true);
end;
FindRandoms;
SleepAndMoveMouse(9671 + random(1709));
FindRandoms;
until (not (FindColorTolerance(x, y, WillowColor, 160, 97, 410, 340, 3))) or
(not (FindColorTolerance(x, y, WillowColorB, 160, 97, 410, 340, 3)))or
(not (FindColorTolerance(x, y, WillowColorC, 160, 97, 410, 340, 3)));
repeat
if (InvFull) or (PopUp('ontinue')) then
Exit;
if(DidRandomHappen = true) then
begin
DidRandomHappen:=False;
Mouse(x, y, 2, 2, true);
end;
wait(750+random(250));
FindRandoms;
until (FindColorTolerance(x, y, WillowColor, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 410, 340, 3));
Result := True;
end;
end;
until (InvFull);
end;
First of all, we check if the player is logged in, if no player is logged in, then it exits.
Then, if it finds 1 of 3 colors of the willow which we put in the constants, it Moves the mouse to the willow (hopefully lol), Looks for the text illow and clicks there if that text is up.
then it begins waiting until the willow is gone. there are a lot of fail safes in there in case something happens while its waiting. for fail safes we have:
if the inventory is full before it chops down the tree, or it finds the pop up continue (level up) then it exits.
if the variable DidRandomHappen ='s true (as we had in the randoms procedure) then it clicks the willow again, and makes DidRandomHappen= false so it doesn't always think a random happens while chopping which would be a huge problem.
Now those are all some pretty good fail safes to ensure that chopping goes smooth.
Then it does the FindRandoms procedure. It repeats Sleeping and moving the mouse until it doesn't find the willow colors(AKA the tree is gone).
Then it repeats waiting around 1 second and does random checking until it finds the willow again. then it keeps repeating all these things until the inventory is full, then it does the walk to bank procedure which we talked about above. Moving on..
Depositing the willows into the bank
Now heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Banking Willows <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
function BankIt: Boolean;
begin
if (InvFull) then
begin
Willow := DTMFromString('78DA63FCC4C4C0D0C9C8800A1819FE83490 68' +
'6FF40C0C8C08C550D8204D2AC40355308A86104AA994940CD 37A0' +
'7BE61050F31AA8A68F0835B3F0AB010040990CF0');
MakeCompass('S');
wait(250 + random(167));
OpenBankQuiet('eb');
Flag;
wait(500 + random(267));
FixBank;
if (FindDTM(Willow, x, y, 568, 209, 742, 460)) then
begin
Mouse(x, y, 3, 3, false);
ChooseOption(x, y, 'All');
Result := True;
if (Result = True) then
begin
LoadsNum := LoadsNum + 1;
LoadsNumB := LoadsNum + 1;
end;
end;
CloseBank;
wait(127 + random(278));
MakeCompass('N');
end;
end;
OK, so if the inventory is full, it does everything else in the function.
So I made a willow DTM, and did all that stuff you need to do for a DTM as you would know if you looked it up! :p
Now for the banking we make the compass south because thats better for finding the bank for this particular bank.
Then we open the bank quietly, while its walking to the bank booth we have it Flag; , and wait about half a second.
Now we Fix the bank, look for the Willow DTM in the coordinates I made for the inventory, and then it right clicks the willow, chooses option All (Deposit All) then the result=true (of the function)
if the result ='s true, we have LoadsNum=LoadsNum + 1; and LoadsNumB=LoadsNumB + 1; The reason we have 2, is for when we switch players, we want the script to check if the loads is at whatever the user sets loads too.
lets say for example the user sets the loads to 10. Once the script gets to 10 loads, its not ever going to = 10 loads again after switching players, so we need to make it start over with the loads counting.
so in the main loop (we are getting kind of a little ahead) we have it make LoadsNumB = 0 again. The reason we have LoadsNum then, is because we still want it to display our progress report with the correct number of loads for all charactors.
Then we Close the bank, wait a very little amount of time then make the compass north again for walking back to the willow and repeating. Moving on..
The Main loop (includes multi player)
Now heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Main loop <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure SetupScript;
begin
Signature;
SetupSRL;
DeclarePlayers;
ActivateClient;
end;
///////////////////////////////////////////////////////////////////////////
begin
SetupScript;
repeat
WalkToWillow;
ChopIt;
WalkToBank;
BankIt;
if(LoadsNumB=Loads)then
begin
NextPlayer(True);
LoadsNumB:=0;
HighestAngle;
MakeCompass('N');
Writeln('Switched players successfully :)');
end;
JADProggy;
until (False);
end.
Now take a look at the setup for the script. We have that there so our main main loop looks more neat and we don't need that all in there, we can just call for SetupScript. Then we have our main loop.
after it sets up the script, it repeats walking to the willow, chopping the willow, walking to the bank and banking the willows.
Then, if LoadsNumB = Loads the user set, then it switches players and make LoadsNumB = 0 again, makes user at highest angle, Makes compass North, Writes in the debug that you switched players.
Then after that, we have it do JADProggy, and in the JADProggy procedure, we have it clear the debug so that each time we display a progress report, the only one there is the fresh one and not the past ones which are of no use now. it does all that until the user stops it manually.
Well thats it. this tutorial took me a long time so please feel free to post comments/feed back/suggestions on it. Thanks :)
This tutorial took me a LOT of time to write, so please, post FEEDBACK on it :D
When you have been learning to script for about a week or so, you may already know how to put together your first complicated, very useful script without even knowing it! In this tutorial, I will be using my script JADWillow, which is a willow anced now isn't it?" Well, I'm here to tell you, it really isn't! I am going to break this down as much as possible to help you understand how the script works. Heres what this script will demonstrate, and will hopefully teach you:
How to walk the map without walking near water/roads (wow, that sounds hard eh? :p)
The use of Anti Randoms in your script, and how/when they should be called for.
The use of Anti Ban and when you should be using that.
The use of player arrays/using multiplayer, which kind of goes along with Anti Randoms in a way.
The use of the almighty progress report. (which every good script should have in my opinion.)
The use of a LOT of fail safes. In this script, there will be a lot and you will be taught just how important they really are.
The use of opening a bank, depositing Items, closing the bank and some other things.
A nice and neat main loop.
Here is the glossary for just about every single command I use in this script, and what they do!
Note: I did not add parameters on the commands, though I will explain how the parameters should be used :) for every command I explain that has parameters, I will put a little example from my script on how I used it in there, then explain.
Glossary:
ActivateClient;
This will activate the client.
(in case you don't know) the client is the cross hair you drag on to runescape. So what this means, is if the user dragged the cross hair onto the runescape window correctly, it will activate that, boxing down SCAR.
usually used at the beginning of the main loop, before a repeat so that SCAR doesn't block the runescape screen.
AutoColorThis;
Heres how this is mostly used in my script:
GBankColor := AutoColorThis(BankBMP, 50, MMX1, MMY1, MMX2, MMY2);
So that is how I used it mostly. Heres what you fill the parameters in with.
GBankColor is where you fill in the color you want it to save it too, you must declare that as a variable though as I did in my script.
AutoColorThis is the command of course :p BankBMP is the bitmap which you also need to declare as a variable, and then put the picture in for it like BankBMP := ..etc. as I did in my script.
50 Is the maximum tolerance you want the command AutoColorThis to look for the bitmap with.
the rest is just parameters for where you want it to Auto Color it at. MM stands for mini map, so that would look for it on the minimap.
Once it does all this, if it finds the bitmap you made, it will save the color to the GBankColor variable (or whatever you made it, thats just what I used) This is great to use when you are walking somewhere without a road/water.
ChooseOption;
Heres how this is mostly used in my script:
[Size="3"]ChooseOption(x, y, 'All');
What you put between the '' is the option you want it to choose when right clicking on something like a log or something. And you just put the variables in front of it like so.
In this, it just chooses the Option All (Deposit All) for the banking.
ClearDebug;
This completely wipes out the whole debug of everything and makes it blank.
Very useful for when you are Writing a progress report, and you want a fresh one instead of more then 1 progress report, so you always get the current one.
CloseBank;
This command simply closes the bank window, clicking the the X on the runescape screen (which closes it :p)
Exit;
How this is used mostly in my script:
if(not(LoggedIn))then
Exit;
You may not know about logged in, if not, read about it below. What this does though, is if the user isn't logged in, it Exits the whole procedure/function you are in ignoring everything after it.
note: you do not have to use this with logged in, you can use it with a lot of other things too.
FindBitmap;
How it is mostly used in my script:
if (not (FindBitmap(BankBMP, x, y))) then
you should already know about if, then and not's. But heres what this does. FindBitmap is the command, which searches for the bitmap, results true if found.
Also if found, it saves the location of it to x,y (the variables) so you can make it click that location or something like that later.
BankBMP you would have to declare as a variable, and as a bitmap and you could name it whatever you want as long as the variable is the same.
FindColorTolerance;
How it is mostly used in my script:
if (FindColorTolerance(x, y, WillowColor, 160, 97, 516, 209, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 516, 209, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 516, 209, 3)) then
Well, heres what this does. FindColorTolerance looks for the color in a coordinates box with tolerance and saves the location of it to x,y (the variables). Here, I have it look for WillowColor, or WillowColorB, or WillowColorC which are all are constants.
the 160,97,516,209 is the coordinates box to look for the color in obviously. and the 3 after the coordinates box is the Tolerance to look for the color with.
Tolerance is used in case the color changes slightly, which Jagex does a lot to try to throw off our colors, causing us not to be able to auto. Luckily, we can look with tolerance! the higher the tolerance, the higher off it can go from the color. I like 3 as my tolerance.
note: you do not have to have all those or's, you could have it just look for 1 color. I have it do that so if it doesn't find 1 of the colors, it will still search for the next one.
FindDTM;
Heres how this is mostly used in my script:
if (FindDTM(Willow, x, y, 568, 209, 742, 460)) then
You should already know about if then else. FindDTM looks for the DTM you declared as a variable, and of course you declared the DTM text.
If you do not know how to make DTM's, read Yohojo's tutorial on it in the intermediate section of tutorial island (on SRL forums)
So in my script I called the DTM Willow. So if it finds that DTM in the coordinates box I made it look for it in (the inventory) it saves the location of it to x,y (the variable)
FindEnt;
Heres how this is mostly used in my script:
if (FindEnt(WillowColor)) then
You should already know about if then else. Now, FindEnt looks for an ent (the dancing tree that breaks your axe) and if it finds it, it results true.
the (WillowColor) is the color of the tree which you are chopping, and it uses that to check for the ent.
In my script I make it run away if it results true that the ent was found.
note: SRL's FindEnt (what we are talking about here and I have in my script) does not normally work. I am working on my own custom ent finding procedure, and you should make your own too if you want good ent detection.
FindNormalRandoms;
This finds and solves all the normal randoms (All talking randoms, Mystery box, lunch lady, fights....etc).
note: this does not solve all impossible to solve randoms. That includes evil bob and some others. For talking randoms, you need to use the Bitmap maker for your nick. Read about that below to learn more about that.
FixBank;
This simply scrolls the bank up to the top if it wasn't already.
Flag;
This repeats waiting until it doesn't find the red flag on the mini map. (when you click on the mini map, the red flag appears if you didn't already know :p)
HighestAngle;
This simply puts your charactor at the highest possible angle of view.
InvFull;
Heres how this is mostly used in my script (well, not mostly for this one, but this is the easiest example :p):
until (InvFull);
And what that does, is of course I have a repeat above it, it repeats the code until the Inventory is full. So pretty much, once the inventory is full, it results true.
This is used a lot in anything the chops/mines/fishes...etc. to detect When to bank/drop or whatever.
IsUpText;
Heres how this is mostly used in my script:
if (IsUpText('illow')) then
What this does is checks for the text in the upper left corner that you put between the '' .
I used this after moving the mouse to the color of the willow (and more things) then to check if the text in the upper corner says illow (AKA Willow, illow is shorter and you should try to avoid using Capitals)
So this is useful when moving the mouse to a color, and making sure that the color was of what you wanted (the willow in this case) because the color of the grass for instance could have some of the same colors as the willow.
LoggedIn;
This simply results true if an account is logged in. Mostly used in my script as:
if(not(LoggedIn))then
Exit;
note: If you do not know about exit, you should read about that above.
So this checks if your logged in, and if not it exits.
MakeCompass;
Heres how this is used mostly in my script:
MakeCompass('N');
So what MakeCompass does is just puts the compass to the angle you put between the '' . N for north, S for south, E for east and W for west.
note: It does not get the compass to a perfect angle, but it gets fairly close.
MMouse;
Heres how this is mostly used in my script:
MMouse(x,y,2,2);
So heres what this does. MMouse moves the mouse to specified location and does not click. x,y is the variables which a location should have been saved too by using FindColorTolerance or something like that (read above if you don't know about that)
The 2,2 are random pixels to go off by so the mouse doesn't always move to the exact same spot every time to keep more undetectable to Jagex.
Mouse;
Heres how this is mostly used in my script:
Mouse(x,y,2,2,true);
Now heres what that does. Mouse moves the mouse the same way MMouse does, the 2,2 are random pixels just like in MMouse. The only difference between MMouse and Mouse is that Mouse clicks, and MMouse doesn't.
The true in Mouse is for the clicking. True for left click, False for right click.
NextPlayer;
Heres how this is mostly used in my script:
NextPlayer(True);
What this does, is logs in the next player thats active in the player array.
Now, heres what the true/false would do. if you have NextPlayer(True), that would log in the next player and leave the Active option on the one you logged off of to true. So this means that the script would go over charactors multiple times, unless you terminate the script at a different time or something like that.
NextPlayer(False) Would switch charactors, and leave the Active option on the one you logged off of to false. So the next time that your script goes to the next player, the one you just logged off of would be false so it wouldn't log onto that one again.
I only use NextPlayer(False) if something went wrong (like that player got lost or something), and NextPlayer(True) if everything went well and you are just switching because the desired loads are done or something.
NickNameBMP
Heres how this is used:
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
Now, heres what this does. in FindNormalRandoms, to solve talking randoms you need this.
What this does, is creates a bitmap mask of the current player's .Nick in the DeclarePlayers procedure.
So just put this in your declare players procedure, and call for the procedure in the main loop before any repeat and you should be good to go.
OpenBankQuiet;
Heres how this is used mostly in my script:
OpenBankQuiet('eb');
What OpenBankQuiet does is opens the bank you put between the '' . (eb= edgevil bank, vwb would = varrock west bank...etc.)
The difference between OpenBankQuiet and something like OpenBank, is the OpenBankQuiet tends to lag a little bit, but it opens the bank without any weird mouse movements like thinking the bank is somewhere else when it isn't.
PopUp;
Here is how this is mostly used in my script:
PopUp('ontinue')
What this does, is if it finds the popup and the text ontinute (Continue) it would click what you put between the '' , in this case it would click 'ontinue'.
a pop up is something like when you get a level up or something like that.
RadialWalk;
Heres how this is mostly used in my script:
RadialWalk(GBankColor, 270, 290, 68, 2, 2);
In this script, I used auto color this for a bitmap and then saved that color to GBankColor. (if you don't know about autocolorthis, read about it near the top of the glossary)
The 270, 290 is the angle of the mini map you want to look for the color GBankColor in. Its just basic geometry. if those numbers were 90,180 , it would search the bottom right quarter of the mini map for that color...etc. Try using yakmans radial walking aid located in the SRL scripts folder.
the 68 is the radial, which is how far out from the center of the mini map it looks for the color (of course that goes alon with the 270,290)
the 2,2 are random pixels to click so the script doesn't click the same spot all the time. (just like in MMouse and Mouse)
RunAwayDirection;
Heres how this is used mostly in my script:
RunAwayDirection(DirToRun);
RunAwayDirection is usually used to run away from something, like a fight, ent...etc.
DirToRun is a constant I made that the user sets on which way to run if it finds a fight in this case.
So lets say the user set DirToRun to 'N'. the script would then run north if a fight was found, wait a little bit, and then use RunBack; (which I will explain right below this)
RunBack;
This is used with RunAwayDirection. Once it runs away from something like a fight, it will run back using this. So if it ran away in the direction north, it would run back south so it gets back to the same spot you were in.
SetupSRL;
This calls to setup the almighty include SRL. If you are using SRL, You need this in your main loop before any repeat (if you have any) for the script to work.
SleepAndMoveMouse;
This moves the mouse around randomly like a bored human would. heres how this is used mostly in my script:
SleepAndMoveMouse(9671 + random(1709));
This Moves the mouse around randomly like a bored human would every 9671-11380 milliseconds. Its good to add randomness to it like I did here or else it will be very detectable to Jagex.
SRLRandomsReport;
This writes in the debug the randoms your script has encountered. Normally used in the progress report procedure like I did.
TerminateScript;
This kills/ends the script. nothing else happens after this because the script stops :p
Wait;
Used like this
Wait(1000+random(500));
This just waits 1000-1500 milliseconds. Greatly advised to put a random in like so or it will be very detectable to Jagex.
Writeln;
Heres how it would be used:
Writeln('Hello world!');
It just writes in the debug box whatever you put between the '' .
If you do not understand any of the commands below, please look them up in the glossary and they should all be there :)
Now, lets begin!
Heres the script, it may freak you out at first, but don't worry! below I will explain Everything with extreme detail. Here you go:
{//-----------------------------------------------------------------------------\\
This script will chop willows at edgevil bank. Start ALL active players
at edgevil farthest east bank slot. Axes weilded or un weilded. This script
does NOT feature axe head finding, Will add soon. Do setup and do setup for
DeclarePlayers on lines 28-68. Please remember to post proggies where you
got this script :) Happy autoing!
//------------------------------------------------------------------------------\\}
program JADWillow;
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/WoodCutting.scar}
const
//------------------------------------------------------------------------------\\
//-------------------------------> Setup <--------------------------------------\\
//------------------------------------------------------------------------------\\
DirTorun = 'N';
Loads = 10; //Loads to do before switching players.
//------------------------------------------------------------------------------\\
//----> Auto Colors Only set these if the script is not finding the Willow <----\\
//------------------------------------------------------------------------------\\
WillowColor = 5398624; //Color of willow tree on Main Screen
WillowColorB = 3174496; //another color of willow on Main Screen
WillowColorC = 4293865; //another color of willow on Main Screen
//------------------------------> End Setup <-----------------------------------\\
// DO NOT TOUCH THESE! \\
var GrassColor, GrassBMP, BankBMP, GBankColor, Tries, Willow: Integer;
EntCount, LoadsNum, LoadsNumB, BushWater, BushWaterColor: Integer;
DidRandomHappen: Boolean;
// \\
{************************************************* *************************
----------> Setup Players here <----------
************************************************** ************************}
procedure DeclarePlayers;
begin
HowManyPlayers := 6; //Number of PLAYERS. active or not.
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0; //Player to start on.
//set all user names, passwords and nicks correctly please.
Players[0].Name := 'Jadseven';
Players[0].Pass := 'Password';
Players[0].Nick := 'dsev';
Players[0].Active := True;
Players[0].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[1].Name := 'UserName';
Players[1].Pass := 'Password';
Players[1].Nick := '3-4 letters of UserName';
Players[1].Active := False;
Players[1].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[2].Name := 'UserName';
Players[2].Pass := 'Password';
Players[2].Nick := '3-4 letters of UserName';
Players[2].Active := False;
Players[2].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[3].Name := 'UserName';
Players[3].Pass := 'Password';
Players[3].Nick := '3-4 letters of UserName';
Players[3].Active := False;
Players[3].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[4].Name := 'UserName';
Players[4].Pass := 'Password';
Players[4].Nick := '3-4 letters of UserName';
Players[4].Active := False;
Players[4].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[5].Name := 'UserName';
Players[5].Pass := 'Password';
Players[5].Nick := '3-4 letters of UserName';
Players[5].Active := False;
Players[5].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
end;
{ don't touch below unless you know what your doing! }
procedure Signature;
begin
ClearDebug;
writeln(' JAD willow chopper by yours truely:');
writeln(' __________ /\ ______ ');
writeln(' |__________| / \ | ____ \ ');
writeln(' | | / /\ \ | | \ \ ');
writeln(' ___ | | / /__\ \ | | \ \ ');
writeln(' \ \| | / /____\ \ | | / / ');
writeln(' \ | / / \ \ | |___/ / ');
writeln(' \____|/ / \ \|______/ ');
wait(3000 + random(750));
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Random Finding <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
function FindFastRandoms: Boolean; //By WT-Fakawi.
var
i: Integer;
begin
for i := 1 to 8 do
begin
case I of
1: if FindDead then
Result := True;
2: if FindMod then
Result := True;
3: if FindMime then
Result := True;
4: if FindMaze then
Result := True;
5: if FindQuiz then
Result := True;
6: if FindDemon then
Result := True;
7: begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].loc := 'No GameTab';
Logout;
Exit;
end;
end;
7: begin
if InBlack then
begin
Result := True;
Players[CurrentPlayer].loc := 'InBlack';
Logout;
Exit;
end;
end;
8: RC;
end;
wait(1);
end;
if (Result = true) then
DidRandomHappen := true;
end;
///////////////////////////////////////////////////////////////////////////
procedure FindRandoms;
begin
FindFastRandoms;
FindNormalRandoms;
if (FindNormalRandoms) then
DidRandomHappen := true;
if (FindEnt(WillowColor)) then
begin
RunAwayDirection(DirToRun);
Flag;
Wait(5000 + random(1500));
RunBack;
DidRandomHappen := true;
EntCount := EntCount + 1;
end;
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> JAD Proggy <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure JADProggy;
begin
ClearDebug;
Writeln(' Please Check out + register on me and pwnaz0rs forums at: ');
Writeln(' Uberbroproductions.net/forums ');
Writeln('[]=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ');
Writeln('|| JAD Progress report. Please remember to post ');
Writeln('|| proggies/bugs wherever you got this script :) ');
Writeln('[]-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ');
Writeln('|| Worked For : ' + ScriptTime2(2));
Writeln('|| Did ' + IntToStr(LoadsNum) + ' Loads ');
Writeln('|| Avoided ' + IntToStr(EntCount) + ' ents ');
Writeln('||=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ');
Writeln('||Thanks for using JAD Willow, happy autoing :) ');
SRLRandomsReport;
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Walking to Willow <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure WalkToWillow;
begin
MakeCompass('N');
GrassBMP := BitmapFromString(8, 10, 'z78DA33333177357433A' +
'335E9483439D8D4E3275D2D0CD1C841A61E006F046F69');
BushWater := BitmapFromString(1, 1, '183D00');
BushWaterColor := AutoColorThis(BushWater, 50, MMX1, MMY1, MMX2, MMY2);
RadialWalk(BushWaterColor, 75, 105, 70, 2, 2);
wait(6000 + random(1500));
Flag;
Wait(200 + random(100));
Tries := 0;
repeat
if(Tries = 40)then
begin
Writeln('Could not find willow... :( terminating script..');
TerminateScript;
end;
wait(300 + random(150));
Tries := Tries + 1;
until (FindColorTolerance(x, y, WillowColor, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 410, 340, 3));
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Walking to Bank <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure WalkToBank;
begin
if (InvFull) then
begin
MakeCompass('N');
BankBMP := BitmapFromString(7, 7, 'z78DAB370B430B230B0' +
'00938E469616966698A4B993B9B1B991050D54228B20EB422 6078' +
'34A00FBA54003');
if (not (FindBitmap(BankBMP, x, y))) then
begin
Mouse(627, 88, 8, 8, true);
Flag;
end;
GBankColor := AutoColorThis(BankBMP, 50, MMX1, MMY1, MMX2, MMY2);
RadialWalk(GBankColor, 270, 290, 68, 2, 2);
Flag;
wait(200 + random(100));
end;
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Willow Chopping <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
function ChopIt: Boolean;
begin
repeat
if (not (LoggedIn)) then
Exit;
if (FindColorTolerance(x, y, WillowColor, 160, 97, 516, 209, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 516, 209, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 516, 209, 3)) then
begin
MMouse(x, y, 3, 3);
if (IsUpText('illow')) then
begin
Mouse(x, y, 2, 2, true);
repeat
if (InvFull) or (PopUp('ontinue')) then
Exit;
if(DidRandomHappen = true) then
begin
DidRandomHappen:=False;
Mouse(x, y, 2, 2, true);
end;
FindRandoms;
SleepAndMoveMouse(9671 + random(1709));
FindRandoms;
until (not (FindColorTolerance(x, y, WillowColor, 160, 97, 410, 340, 3))) or
(not (FindColorTolerance(x, y, WillowColorB, 160, 97, 410, 340, 3)))or
(not (FindColorTolerance(x, y, WillowColorC, 160, 97, 410, 340, 3)));
repeat
if (InvFull) or (PopUp('ontinue')) then
Exit;
if(DidRandomHappen = true) then
begin
DidRandomHappen:=False;
Mouse(x, y, 2, 2, true);
end;
wait(750+random(250));
FindRandoms;
until (FindColorTolerance(x, y, WillowColor, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 410, 340, 3));
Result := True;
end;
end;
until (InvFull);
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Banking Willows <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
function BankIt: Boolean;
begin
if (InvFull) then
begin
Willow := DTMFromString('78DA63FCC4C4C0D0C9C8800A1819FE83490 68' +
'6FF40C0C8C08C550D8204D2AC40355308A86104AA994940CD 37A0' +
'7BE61050F31AA8A68F0835B3F0AB010040990CF0');
MakeCompass('S');
wait(250 + random(167));
OpenBankQuiet('eb');
Flag;
wait(500 + random(267));
FixBank;
if (FindDTM(Willow, x, y, 568, 209, 742, 460)) then
begin
Mouse(x, y, 3, 3, false);
ChooseOption(x, y, 'All');
Result := True;
if (Result = True) then
begin
LoadsNum := LoadsNum + 1;
LoadsNumB := LoadsNum + 1;
end;
end;
CloseBank;
wait(127 + random(278));
MakeCompass('N');
end;
end;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Main loop <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure SetupScript;
begin
Signature;
SetupSRL;
DeclarePlayers;
ActivateClient;
end;
///////////////////////////////////////////////////////////////////////////
begin
SetupScript;
repeat
WalkToWillow;
ChopIt;
WalkToBank;
BankIt;
if(LoadsNumB=Loads)then
begin
NextPlayer(True);
LoadsNumB:=0;
HighestAngle;
MakeCompass('N');
Writeln('Switched players successfully :)');
end;
JADProggy;
until (False);
end.
OK, now here we go with the explaining.
The Setup of a script
Now, for the introduction I have:
{//-----------------------------------------------------------------------------\\
This script will chop willows at edgevil bank. Start ALL active players
at edgevil farthest east bank slot. Axes weilded or un weilded. This script
does NOT feature axe head finding, Will add soon. Do setup and do setup for
DeclarePlayers on lines 28-68. Please remember to post proggies where you
got this script :) Happy autoing!
//------------------------------------------------------------------------------\\}
Now, this is very simple, yet important when making a script. Always have something at the beginning of your script that is very neat that says what to do for the script to run properly, and warnings on what the script doesn't have. And of course, you can make requests for proggies to be posted on your script :)
Also note that every new function/procedure in the whole script has comments that tell you what its doing, to make it easier to read through and get to what your looking for.
Now for the setup, heres what we have:
const
//------------------------------------------------------------------------------\\
//-------------------------------> Setup <--------------------------------------\\
//------------------------------------------------------------------------------\\
DirTorun = 'N';
Loads = 10; //Loads to do before switching players.
//------------------------------------------------------------------------------\\
//----> Auto Colors Only set these if the script is not finding the Willow <----\\
//------------------------------------------------------------------------------\\
WillowColor = 5398624; //Color of willow tree on Main Screen
WillowColorB = 3174496; //another color of willow on Main Screen
WillowColorC = 4293865; //another color of willow on Main Screen
//------------------------------> End Setup <-----------------------------------\\
// DO NOT TOUCH THESE! \\
var GrassColor, GrassBMP, BankBMP, GBankColor, Tries, Willow: Integer;
EntCount, LoadsNum, LoadsNumB, BushWater, BushWaterColor: Integer;
DidRandomHappen: Boolean;
// \\
Now we have the constants. Direction to run and loads to do before switching players (We'll talk about that later)
Its important to tell the user in comments where the setup is at and where it ends. And if you are using auto colors for the tree as we are here, I'd suggest putting comments between what the user needs to setup, and what the user could setup if the current colors aren't working.
As for the variables, I just had those there after the constants and told the user not to touch them. We will talk more about how I used those in the script later. Moving on..
Declare Players array.
Heres what we have:
{************************************************* *************************
----------> Setup Players here <----------
************************************************** ************************}
procedure DeclarePlayers;
begin
HowManyPlayers := 6; //Number of PLAYERS. active or not.
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0; //Player to start on.
//set all user names, passwords and nicks correctly please.
Players[0].Name := 'Jadseven';
Players[0].Pass := 'Password';
Players[0].Nick := 'dsev';
Players[0].Active := True;
Players[0].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[1].Name := 'UserName';
Players[1].Pass := 'Password';
Players[1].Nick := '3-4 letters of UserName';
Players[1].Active := False;
Players[1].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[2].Name := 'UserName';
Players[2].Pass := 'Password';
Players[2].Nick := '3-4 letters of UserName';
Players[2].Active := False;
Players[2].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[3].Name := 'UserName';
Players[3].Pass := 'Password';
Players[3].Nick := '3-4 letters of UserName';
Players[3].Active := False;
Players[3].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[4].Name := 'UserName';
Players[4].Pass := 'Password';
Players[4].Nick := '3-4 letters of UserName';
Players[4].Active := False;
Players[4].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
Players[5].Name := 'UserName';
Players[5].Pass := 'Password';
Players[5].Nick := '3-4 letters of UserName';
Players[5].Active := False;
Players[5].Boolean1 := False; //Is Axe equiped? if not then put in FIRST inv slot
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
end;
{ don't touch below unless you know what your doing! }
Take a look at the bottom of that. I have don't touch below unless you know what your doing in comments. I'd suggest putting that so the user knows its time to stop setting up and start the script :)
Then we have the Declare Players procedure. Now, the HowManyPlayers is How many players there are Active or not. If the script has 6 players (like here) and only 2 of those 6 are active, the HowManyPlayers still ='s 6 as you may already know.
Then we have the player arrays, the user name, password and nick name are used for the multiplayer which the user sets up so that when it goes to next player (if the next player is active) it will type in that user name + pass.
the
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
Is in the Glossary so if you don't know about that, look it up :)
In this, I have user name Jadseven and nick is dsev. It creates a bitmap mask of dsev and when somebody pops up and says Jadseven it knows to talk to that person in the randoms procedure (which he haven't gotten to yet, we'll talk about that in a minute) Moving on..
The signature
Well, this will be short lol :P and you should know how to do this. we have:
procedure Signature;
begin
ClearDebug;
writeln(' JAD willow chopper by yours truely:');
writeln(' __________ /\ ______ ');
writeln(' |__________| / \ | ____ \ ');
writeln(' | | / /\ \ | | \ \ ');
writeln(' ___ | | / /__\ \ | | \ \ ');
writeln(' \ \| | / /____\ \ | | / / ');
writeln(' \ | / / \ \ | |___/ / ');
writeln(' \____|/ / \ \|______/ ');
wait(3000 + random(750));
end;
This may not look like it says JAD on SRL forums because the spaces between text is kind of weird, but if you paste that into SCAR, it will say JAD in the procedure.
and later in the main loop, it will Writeln this, and wait a little over 3 seconds so the user has time to read your signature which you wasted so much time on lol.
Random Finding
Now, heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Random Finding <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
function FindFastRandoms: Boolean; //By WT-Fakawi.
var
i: Integer;
begin
for i := 1 to 8 do
begin
case I of
1: if FindDead then
Result := True;
2: if FindMod then
Result := True;
3: if FindMime then
Result := True;
4: if FindMaze then
Result := True;
5: if FindQuiz then
Result := True;
6: if FindDemon then
Result := True;
7: begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].loc := 'No GameTab';
Logout;
Exit;
end;
end;
7: begin
if InBlack then
begin
Result := True;
Players[CurrentPlayer].loc := 'InBlack';
Logout;
Exit;
end;
end;
8: RC;
end;
wait(1);
end;
if (Result = true) then
DidRandomHappen := true;
end;
///////////////////////////////////////////////////////////////////////////
procedure FindRandoms;
begin
FindFastRandoms;
FindNormalRandoms;
if (FindNormalRandoms) then
DidRandomHappen := true;
end;
The FindFastRandoms is NOT by me, that is by WT-Fakawi and it is used in a lot of peoples scripts :) although, if you use this in your script, don't think all your work is complete. this only checks for the things that FindNormalRandoms doesn't like mods, mime...etc.
Now in the FindRandoms; procedure, we call for FindFastRandoms, we don't call for it in the main loop, we just call for FindRandoms; which calls for FindFastRandoms because thats in that procedure :p
then we have FindNormalRandoms; this does Not solve the un solvable randoms called scape runes (evil bob...etc) FindFastRandoms looks for that though and logs out if it finds those. To learn more about FindNormalRandoms, look it up! :p
I then have
if(FindNormalRandoms) then
DidRandomHappen := true;
This just says if it finds normal randoms, then it makes that variable I declared above = true. Then in my chopping logs procedure, if it found a random, it doesn't keep waiting for the tree to be gone, instead, it solves the random then clicks the tree again (We'll get to that later once again) Moving on..
Progress report
Heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> JAD Proggy <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure JADProggy;
begin
ClearDebug;
Writeln(' Please Check out + register on me and pwnaz0rs forums at: ');
Writeln(' Uberbroproductions.net/forums ');
Writeln('[]=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ');
Writeln('|| JAD Progress report. Please remember to post ');
Writeln('|| proggies/bugs wherever you got this script :) ');
Writeln('[]-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ');
Writeln('|| Worked For : ' + ScriptTime2(2));
Writeln('|| Did ' + IntToStr(LoadsNum) + ' Loads ');
Writeln('|| Avoided ' + IntToStr(EntCount) + ' ents ');
Writeln('||=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ');
Writeln('||Thanks for using JAD Willow, happy autoing :) ');
SRLRandomsReport;
end;
First of all, this just says to check out me and pwnaz0r's awesome forums (which you should too :p) and then it says to post progress reports.
the Worked For : ' + ScriptTime2(2)); can always be used to check for how long the script has been going, and in this case, it writes in the debug of course how long its been going.
then it says how many loads it did. and how many ents it avoided. It displays this by how we added to the variables LoadsNum and things like that in the banking procedure. each time it banks, it adds 1 to LoadsNum and then it writes in the debug loads number.
Same for ent; each time it finds an ent, it adds 1 to ents and writes it in the debug.
Then we have SRLRandomsReport. To learn about that, look it up! :p Moving on..
Walking to the willow from bank
Now, heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Walking to Willow <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure WalkToWillow;
begin
MakeCompass('N');
GrassBMP := BitmapFromString(8, 10, 'z78DA33333177357433A' +
'335E9483439D8D4E3275D2D0CD1C841A61E006F046F69');
BushWater := BitmapFromString(1, 1, '183D00');
BushWaterColor := AutoColorThis(BushWater, 50, MMX1, MMY1, MMX2, MMY2);
RadialWalk(BushWaterColor, 75, 105, 70, 2, 2);
wait(6000 + random(1500));
Flag;
Wait(200 + random(100));
Tries := 0;
repeat
if(Tries = 40)then
begin
Writeln('Could not find willow... :( terminating script..');
TerminateScript;
end;
wait(300 + random(150));
Tries := Tries + 1;
until (FindColorTolerance(x, y, WillowColor, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 410, 340, 3));
end;
First of all, we make the compass face north so the walking doesn't get screwed up.
We Auto colorize the BushWaterColor so that we can radial walk using that color properly. Look it up if you don't know about AutoColorThis, because this is one of the most important things used for map walking.
note: This script does not use the GrassBMP yet, I had it in there because new version is going to use it.
So I took a bitmap of the BushWaterColor which is near the willow. It is the bush next to it with a little water in the bitmap so it doesn't click just any old bush :P
then you have BushWaterColor := AutoColorThis(BushWater, 50, MMX1, MMY1, MMX2, MMY2);
AutoColorThis picks the color from the bitmap BushWater, and saves it to BushWaterColor. I made the max tolerance 50, and it looks for it on the MM (mini map) because we have MMX1, MMY1...etc. which looks for things on the mini map of course.
Then we have it radial walk using the BushWaterColor which we auto colored.
I have it wait around 6 seconds after it clicks because the player kind of needs to walk back wards if you've ever been at the bank in edgevil, and when it walks backwards, the flag disappears for a minute, then re appears. if I didn't have it wait before waiting for the Flag to leave using the command Flag; (which just waits until the flag is gone) it would think the flag is gone when it really isn't.
Then I make the variable tries = 0. then the script repeats waiting about half a second until it finds the color of the willow color, but if it waited half a second for 40 times (20 seconds roughly) it will terminate the script because it did not click next to the willow. Moving on..
Walking to the bank from the Willow tree
Now heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Walking to Bank <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure WalkToBank;
begin
if (InvFull) then
begin
MakeCompass('N');
BankBMP := BitmapFromString(7, 7, 'z78DAB370B430B230B0' +
'00938E469616966698A4B993B9B1B991050D54228B20EB422 6078' +
'34A00FBA54003');
if (not (FindBitmap(BankBMP, x, y))) then
begin
Mouse(627, 88, 8, 8, true);
Flag;
end;
GBankColor := AutoColorThis(BankBMP, 50, MMX1, MMY1, MMX2, MMY2);
RadialWalk(GBankColor, 270, 290, 68, 2, 2);
Flag;
wait(200 + random(100));
end;
end;
now in this, if the inventory is full, it will do the rest of the procedure.
We Make the compass north, then we use the ground of the bank as a bitmap. The reason we don't just make it click the symbol of the bank is because half the time, the symbol isn't on the mini map.
if it doesn't find the bitmap of the ground of the bank, then it clicks a little east using Mouse with random pixels 8 by 8. This is a great fail safe in case it doesn't find the ground of the bank from what side of the willow its on.
Then it Flag;'s. Look it up if you don't know about flag :p
Then we have the normal thing like we did in the walking to the willow procedure which auto colors the Bank Bitmap, GBankColor is the variable of the color for the bank ground, it walks to it with radial walk, waits for flag to be gone, and does a little random waiting. Moving on..
Chopping the willow
Now heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Willow Chopping <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
function ChopIt: Boolean;
begin
repeat
if (not (LoggedIn)) then
Exit;
if (FindColorTolerance(x, y, WillowColor, 160, 97, 516, 209, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 516, 209, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 516, 209, 3)) then
begin
MMouse(x, y, 3, 3);
if (IsUpText('illow')) then
begin
Mouse(x, y, 2, 2, true);
repeat
if (InvFull) or (PopUp('ontinue')) then
Exit;
if(DidRandomHappen = true) then
begin
DidRandomHappen:=False;
Mouse(x, y, 2, 2, true);
end;
FindRandoms;
SleepAndMoveMouse(9671 + random(1709));
FindRandoms;
until (not (FindColorTolerance(x, y, WillowColor, 160, 97, 410, 340, 3))) or
(not (FindColorTolerance(x, y, WillowColorB, 160, 97, 410, 340, 3)))or
(not (FindColorTolerance(x, y, WillowColorC, 160, 97, 410, 340, 3)));
repeat
if (InvFull) or (PopUp('ontinue')) then
Exit;
if(DidRandomHappen = true) then
begin
DidRandomHappen:=False;
Mouse(x, y, 2, 2, true);
end;
wait(750+random(250));
FindRandoms;
until (FindColorTolerance(x, y, WillowColor, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorB, 160, 97, 410, 340, 3)) or
(FindColorTolerance(x, y, WillowColorC, 160, 97, 410, 340, 3));
Result := True;
end;
end;
until (InvFull);
end;
First of all, we check if the player is logged in, if no player is logged in, then it exits.
Then, if it finds 1 of 3 colors of the willow which we put in the constants, it Moves the mouse to the willow (hopefully lol), Looks for the text illow and clicks there if that text is up.
then it begins waiting until the willow is gone. there are a lot of fail safes in there in case something happens while its waiting. for fail safes we have:
if the inventory is full before it chops down the tree, or it finds the pop up continue (level up) then it exits.
if the variable DidRandomHappen ='s true (as we had in the randoms procedure) then it clicks the willow again, and makes DidRandomHappen= false so it doesn't always think a random happens while chopping which would be a huge problem.
Now those are all some pretty good fail safes to ensure that chopping goes smooth.
Then it does the FindRandoms procedure. It repeats Sleeping and moving the mouse until it doesn't find the willow colors(AKA the tree is gone).
Then it repeats waiting around 1 second and does random checking until it finds the willow again. then it keeps repeating all these things until the inventory is full, then it does the walk to bank procedure which we talked about above. Moving on..
Depositing the willows into the bank
Now heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Banking Willows <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
function BankIt: Boolean;
begin
if (InvFull) then
begin
Willow := DTMFromString('78DA63FCC4C4C0D0C9C8800A1819FE83490 68' +
'6FF40C0C8C08C550D8204D2AC40355308A86104AA994940CD 37A0' +
'7BE61050F31AA8A68F0835B3F0AB010040990CF0');
MakeCompass('S');
wait(250 + random(167));
OpenBankQuiet('eb');
Flag;
wait(500 + random(267));
FixBank;
if (FindDTM(Willow, x, y, 568, 209, 742, 460)) then
begin
Mouse(x, y, 3, 3, false);
ChooseOption(x, y, 'All');
Result := True;
if (Result = True) then
begin
LoadsNum := LoadsNum + 1;
LoadsNumB := LoadsNum + 1;
end;
end;
CloseBank;
wait(127 + random(278));
MakeCompass('N');
end;
end;
OK, so if the inventory is full, it does everything else in the function.
So I made a willow DTM, and did all that stuff you need to do for a DTM as you would know if you looked it up! :p
Now for the banking we make the compass south because thats better for finding the bank for this particular bank.
Then we open the bank quietly, while its walking to the bank booth we have it Flag; , and wait about half a second.
Now we Fix the bank, look for the Willow DTM in the coordinates I made for the inventory, and then it right clicks the willow, chooses option All (Deposit All) then the result=true (of the function)
if the result ='s true, we have LoadsNum=LoadsNum + 1; and LoadsNumB=LoadsNumB + 1; The reason we have 2, is for when we switch players, we want the script to check if the loads is at whatever the user sets loads too.
lets say for example the user sets the loads to 10. Once the script gets to 10 loads, its not ever going to = 10 loads again after switching players, so we need to make it start over with the loads counting.
so in the main loop (we are getting kind of a little ahead) we have it make LoadsNumB = 0 again. The reason we have LoadsNum then, is because we still want it to display our progress report with the correct number of loads for all charactors.
Then we Close the bank, wait a very little amount of time then make the compass north again for walking back to the willow and repeating. Moving on..
The Main loop (includes multi player)
Now heres what we have:
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
----------> Main loop <----------
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/}
procedure SetupScript;
begin
Signature;
SetupSRL;
DeclarePlayers;
ActivateClient;
end;
///////////////////////////////////////////////////////////////////////////
begin
SetupScript;
repeat
WalkToWillow;
ChopIt;
WalkToBank;
BankIt;
if(LoadsNumB=Loads)then
begin
NextPlayer(True);
LoadsNumB:=0;
HighestAngle;
MakeCompass('N');
Writeln('Switched players successfully :)');
end;
JADProggy;
until (False);
end.
Now take a look at the setup for the script. We have that there so our main main loop looks more neat and we don't need that all in there, we can just call for SetupScript. Then we have our main loop.
after it sets up the script, it repeats walking to the willow, chopping the willow, walking to the bank and banking the willows.
Then, if LoadsNumB = Loads the user set, then it switches players and make LoadsNumB = 0 again, makes user at highest angle, Makes compass North, Writes in the debug that you switched players.
Then after that, we have it do JADProggy, and in the JADProggy procedure, we have it clear the debug so that each time we display a progress report, the only one there is the fresh one and not the past ones which are of no use now. it does all that until the user stops it manually.
Well thats it. this tutorial took me a long time so please feel free to post comments/feed back/suggestions on it. Thanks :)