I've just updates my Teak Power Chopper. Corrected standards and added a proggy logging to a file. Please comment.
SCAR Code:
// This is an RS members script. It will power cut teak trees at ape atoll
// for the number of loads you specify at Players[0].Integers
// There is no check for randoms as you don't get any when
// in monkey form. Make sure axe is in inventory spot 1. This is the
// top left spot. Will not pick up birdnests. Included is a writing to a file
// for the saving of progress reports you can post. Just change the ProgFile
// name to the one you are using. Make sure it is in the same spot as this
// script.
// The Fire Making part is because I use an Inferno Adze to cut.
program TeakCutter;
{.include SRL/SRL.scar}
const
TeakTree = 6796443; //Use colour picker if it can't find teak trees
ProgFile = 'My Proggies.txt';
var
x, y, LoadsToDo: Integer;
CurrentLevel, LevelsGained: Integer;
StartWCExp, StartFMExp, FinishWCExp, FinishFMExp: Integer;
MyProggy, ProggyLength: Integer;
OldProggyText, DebugText: string;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Players[0].Integers[0] := 65; //number of loads to do
end;
procedure ReadProggy;
begin
if (FileExists(ScriptPath + ProgFile)) then
begin
MyProggy := OpenFile(ScriptPath + ProgFile, False);
if (MyProggy < 0) then
begin
WriteLn('Cannot Open File.');
end else
begin
ProggyLength := FileSize(MyProggy);
ReadFileString(MyProggy, OldProggyText, ProggyLength);
end;
end else
begin
WriteLn('No Such File Exists');
end;
CloseFile(MyProggy);
end;
procedure WriteProggy;
begin
if (FileExists(ScriptPath + ProgFile)) then
begin
MyProggy := RewriteFile(ScriptPath + ProgFile, False);
if (MyProggy < 0) then
begin
WriteLn('Cannot Open File.');
end else
begin
DebugText := GetDebugText; //gets the debug window text
Insert(DebugText, OldProggyText, ProggyLength); //adds new proggy to old proggy
WriteFileString(MyProggy, OldProggyText); //writes all to file
WriteFileString(MyProggy, TheDate(1) + ', ' + TheTime + ' ');
end;
end else
begin
WriteLn('No Such File Exists');
end;
CloseFile(MyProggy);
end;
procedure ProgressReport;
begin
ClearDeBug;
WriteLn(' ');
WriteLn(' ');
Writeln('[====================================================]');
Writeln('[===> Guyvers Teak Chopper') ;
Writeln('[===> Time script active '+ TimeRunning);
Writeln('[===> Number of loads done '+ IntToStr(LoadsToDo));
Writeln('[===> Starting Woodcutting Level ' + IntToStr(CurrentLevel));
Writeln('[===> Woodcutting EXP Start: ' + IntToStr(StartWCExp));
Writeln('[===> Woodcutting EXP Finish: ' + IntToStr(FinishWCExp));
Writeln('[===> Levels gained while running: ' +IntToStr(LevelsGained));
Writeln('[===================================================]');
Writeln('[===> FireMaking EXP Start: ' + IntToStr(StartFMExp));
Writeln('[===> FireMaking EXP Finish: ' + IntToStr(FinishFMExp));
Writeln('[===================================================]');
WriteLn(' ');
end;
procedure AntiBanme;
begin
case random(25) of // The larger the number the less AntiBann it does
0: GameTab(5 + Random(12));
1: BoredHuman;
2: begin
SetAngle(False); //Sets camera angle to low view
wait(10 + random(10));
SetAngle(True); //Sets camera angle to high view
end;
3: HoverSkill('Woodcutting', False);
4: GameTab(2 + Random(12));
5: RandomMovement;
6: RandomRClick;
7: PickUpMouse;
end;
end;
// Credit to Oceans 1 for this procedure
// I have modified it for teaks and added
// an autologout preventer
procedure ChopTeaks;
var
CurrentTime, Tries: Integer;
begin
if (InvFull) or (not (LoggedIn)) then Exit;
repeat
if (FindColorTolerance(x, y, TeakTree, MSX1, MSY1, MSX2, MSY2, 10)) then
begin
MMouse(x, y, 1, 1);
wait(45 + Random(500));
if IsUpText('eak') then
begin
CurrentTime := 120; //used to stop auto logout when cutting one tree
Mouse(x, y, 1, 1, True); //for a long time
FFlag(0);
repeat
CurrentTime := CurrentTime - 1;
wait(200 + Random(300));
until (InvFull) or not (IsUpText('eak'))or (CurrentTime = 0);
end;
end else
begin
Wait(550 + Random(450));
Tries := Tries + 1;
if (Tries = 5) then
begin
Writeln('Failed to find the Teak Tree, Exiting');
Exit;
end;
Tries := 0;
end;
until (InvFull) or (FindBlackChatMessage('Your inventory is too full to hold anymore logs.'));
end;
procedure DropTeaks;
var
i: Integer;
begin
for i:= 2 to 28 do
begin
DropItem(i);
end;
LoadsToDo := LoadsToDo + 1;
end;
//MAIN LOOP//
begin
SetupSRL;
ActivateClient;
DeclarePlayers;
//MoveToTray;
if not (LoggedIn) then
begin
LogInPlayer;
end;
LoadsToDo := 0;
SetAngle(True);
SetRun(True);
MakeCompass('N');
StartWCExp := GetXP('Woodcutting');
StartFMExp := GetXP('Firemaking');
CurrentLevel := GetSkillInfo('Woodcutting', False);
Wait(400 + Random(655));
repeat
ChopTeaks;
AntiBanMe;
DropTeaks;
AntiBanMe;
FinishWCExp := GetXP('Woodcutting');
FinishFMExp := GetXP('Firemaking');
LevelsGained := ((GetSkillInfo('Woodcutting', False)) - CurrentLevel);
ProgressReport;
until (LoadsToDo = Players[CurrentPlayer].Integers[0])
ReadProggy;
WriteProggy;
Logout;
end.