Torrent of Flame
2008-03-03 14:46:19
Thanks Hermpie for making my ChopTree not just close haha.
If you like this tutorial please Rep++
I thought it would be a nice idea to make a tutorial on Banking&Chopping that is up to date, as alot of the chopping tutorials are out of date.
Im taking apart some of my Crusher&Banker Script to show you the basics of making a cutting&banking script.
It wont include walking, etc. This is because this is a Chopping&Banking guide.
Start the script with your program's name.
Program MyWillowBankerDeclare what you wish for the script to include…
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/WoodCutting.scar}WoodCutting because it is a woodcutting script, but SRL will be explained later on.
Then Declare your x, y co-ordinates.
var x, y: integer;And declare your Constants(Explained later on)
const
YourPin:='0000' The procedure for ChopTree is as follows;
Procedure ChopTree;
begin
MakeCompass('S');
repeat
if FindObjCustom(x, y, ['Wil', 'low'], [1989969, 3760987, 2844763], 7) then
begin
Mouse(x,y,0,0,false);
repeat
Wait(100 + (random(150)));
ChooseOption('hop')
until(InvFull)
end;
until(InvFull)
end;This requires some explanation, so lets break it down bit by bit.
I named the procedure ChopTree, as this is what it does.
Now it says "MakeCompass('S')" which means as it says, it will make the compass face south. This works for my script because it starts in the bank and it will find the willows easier if you have it facing south, but this can be changed as required.
repeat - repeats the procedure until the inventory is full.
if FindObjCustom(x, y, ['Wil', 'low'], [1989969, 3760987, 2844763], 7) then
beginThis means that it looks for the Object "Willow" with the specified colours with a tolerance of 7, tolerance meaning it searches for anything within 7 of the colours. If it finds the Willow it will begin the next part.
Mouse(x,y,0,0,false);This means that the mouse will find where the "FindObjCustom" found the willows on the x, y axis, and with a 0 tolerance, will hover over the tree, as it is set to "false" so it wont click.
repeat
Wait(100 + (random(150)));
ChooseOption('hop')
until(InvFull)This means that it will repeat the next part, which waits 100 + a random 150, and then clicks "Chop", but you leave out the capital to get 'hop'. It will repeat the chop clicking until your inventory is full.
end;
until(InvFull)
end;The first end ends the "Mouse…" procedure, the repeat will repeat the whole procedure until the inventory is full, and the last end ends the whole procedure.
Next we move on to the Banking Procedure.
function Banking: Boolean;
begin
if (InvFull) then
begin
MakeCompass('N')
Wait (300 + random(160));
OpenBankQuiet('db');
if (PinScreen) then
InPin(YourPin);
if(FindColorSpiral(x, y, 4155248, 547, 206, 734, 464))then
begin
Mouse(x, y, 4, 3, false);
ChooseOption('All');
end;
CloseBank;
Wait(150 + random (278));
MakeCompass('S');
end;
end;This is a little more complicated then the chopping procedure, but we will break this down aswell.
First, we start out function this time, as it is programed to do a specific funtion.
It begins by saying If(InvFull) so it will only bank if the inventory is full. It will make the compass face north, and wait about 460.
OpenBankQuiet('db');
if (PinScreen) then
InPin(YourPin);OpenBankQuiet is a little more laggy, but will open the bank more like a human would, and the 'db' stands for "Draynor Bank" so 'veb' would stand for "Varrock East Bank"
if (PinScreen) then - this means that if the script picks up the Pin Screen then it will "InPin(YourPin)" so as enters your pin for you. (YourPin would be the constant we declared earlier.)
if(FindColorSpiral(x, y, 4155248, 547, 206, 734, 464))thenThis means that if looks for the colour 4155248(The willow logs) between the coordinates of your inventory which are the 4 numbers after, then means that it should do …. after the colour has been found.
begin
Mouse(x, y, 4, 3, false);
ChooseOption('All');
end;This means it will begin the following. It looks for the colour, and when found it hovers over the willow log in the inventory, and chooses the option 'All' and then ends the part.
CloseBank;
Wait(150 + random (278));
MakeCompass('S');
end;
end;
This Closes the bank after the logs have been deposited, waits about 400, and then makes the compass south ready for the walk back to the willows in my script. The ends again just end the procedure.
Procedure MainLoop;
SetupSRL;
repeat
ChopTree;
Banking;
until(false)
end.The main loop is something every script needs. We call the procedure "MainLoop" for obvious reasons. SerupSRL sets up SRL for us, which is why we need {.include SRL/SRL.scar} at the start of the script.
Repeat repeats the "ChopTree" and "Banking" until(false) meaning until the script is stopped manually. The End. finished the script completley.
Put all of this together, and imagine that we have the bank right on top of the willows, and you will get a full script.
Program MyWillowBanker&Cutter;
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/WoodCutting.scar}
var x, y: integer;
const
YourPin:='0000'
Procedure ChopTree;
begin
if not LoggedIn then
Exit;
MakeCompass('S');
repeat
if FindObjCustom(x, y, ['Wil', 'low'], [1989969, 3760987, 2844763], 7) then
begin
Mouse(x,y,0,0,false);
repeat
Wait(100 + (random(150)));
ChooseOption('hop')
until(InvFull)
end;
until(InvFull)
end;
function Banking: Boolean;
begin
if (InvFull) then
begin
MakeCompass('N')
Wait (300 + random(160));
OpenBankQuiet('db');
if (PinScreen) then
InPin(YourPin);
if(FindColorSpiral(x, y, 4155248, 547, 206, 734, 464))then
begin
Mouse(x, y, 4, 3, false);
ChooseOption('All');
end;
CloseBank;
Wait(150 + random (278));
MakeCompass('S');
end;
end;
Procedure MainLoop;
begin
repeat
SetupSRL;
ChopTree;
Banking;
until(false)
end.