You are still using A LOT of things from my WCer. Give credit where due.
SCAR Code:
TTree = record
Name : string;
Uptext : TStringArray;
Color : Integer;
Tol : Integer;
Hue : extended;
Sat : extended;
width : integer;
hight : integer;
Level : integer;
end;
SCAR Code:
TLocation = record
BankName : string;
WalkToBank : function: boolean;
WalkToTree : function: boolean;
TreesAvailable: Array of TTree;
end;
SCAR Code:
Procedure TakePic;
begin
TakeScreenshot(ScriptPath + ScriptName + IntToStr(PicN));
Inc(PicN);
Inc(Stats_CustomVars[2]);
end;
duh, RMDebug, wonder who that might be by.
SCAR Code:
Procedure RMDebug(str: string);
begin
// if not DebugMe then exit;
writeln(TheTime +' : '+Players[CurrentPlayer].Name+' : '+str);
end;
SCAR Code:
Function CheckAxe: boolean;
var
CT, i, x, y : Integer;
TC: TIntegerArray;
begin
SetLength(TC, 2);
CT := GetCurrentTab;
if CT = tab_inv then
TC := [tab_Inv, tab_Equip]
else
TC := [tab_Equip, tab_Inv];
for i:= 0 to 1 do
begin
GameTab(TC[i]);
if FindDTM(AxeDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Result := true;
begin
end;
Players[CurrentPlayer].Booleans[0] := (TC[i] = tab_Equip);
if Players[CurrentPlayer].Booleans[0] then
RMDebug('Axe is Equipped')
else
RMDebug('Axe in Inv');
exit;
end;
end;
if i > 1 then
begin
LogOut;
Players[CurrentPlayer].Active := false;
Players[CurrentPlayer].Rand := 'No Axe';
end;
end;
SCAR Code:
Function LoadTree(which: string): TTree;
begin
case lowercase(which) of
'ivy':
with Result do
begin
Name := 'ivy';
UpText := ['p Iv', 'Ivy'];
Color := 2508085;
Tol := 3;
Hue := 0.18;
Sat := 0.22;
width := 62;
hight := 10;
Level := 68;
end;
end;
end;
SCAR Code:
Function LoadLocation(which: string): TLocation;
begin
case lowercase(which) of
'power':
with Result do
begin
BankName := '';
WalkToBank := @Empty;
WalkToTree := @Empty;
TreesAvailable := [ LoadTree('ivy') ];
end;
end;
end;
SCAR Code:
Function CheckTreeAndLoc(Loc: TLocation; Tree: TTree) : boolean;
var
i : integer;
begin
With loc do
for i:= 0 to High(TreesAvailable) do
begin
Result := (Tree.Name = TreesAvailable[i].Name);
if Result then break;
end;
end;
SCAR Code:
function FindTree(which: TTree; var fx, fy: Integer): Boolean;
var
arP: TPointArray;
ararP: T2DPointArray;
tmpCTS, i, arL: Integer;
P: TPoint;
begin
RMDebug('FindTree');
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(which.Hue, which.Sat);
if not(FindColorsTolerance(arP, which.Color, MSX1, MSY1, MSX2, MSY2, which.Tol)) then
begin
Writeln('Failed to find the color, no object found - '+Which.Name);
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
ararP := TPAtoATPAEx(arP, which.width, which.hight);
SortATPAFromFirstPoint(ararP, Point(MSCX, MSCY));
arL := High(ararP);
for i := 0 to arL do
begin
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
if (WaitUptextMulti(which.UpText, 250)) then
begin;
Result := True;
GetMousePos(fx, fy);
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
begin
Writeln('FindObject could not find object - '+which.Name);
Exit;
end;
end;
SCAR Code:
Function FollowTree(which: TTree; var x, y: integer):boolean;
var
Color, Time, Count : integer;
begin
RMDebug('FollowTree');
Result := WaitUpTextMulti(Which.UpText, 500);
GetMousePos(x,y);
Color := GetColor(x, y);
Time := GetSystemTime + 5000;
Count := InvCount;
repeat
wait(25);
if not SimilarColors(GetColor(x, y), color, 10) then
if not FindColorTolerance(x, y, Color, x - 12, y - 12, x + 12, y + 12, 10) then
begin
Result := false;
exit;
end;
if InvCount > Count then break;
until(GetSystemTime > Time)
wait(Random(200));
MMouse(x, y, 5, 5);
GetMousePos(x, y);
end;
SCAR Code:
{Function WaitUntilCut(which: TTree; x, y:integer): boolean;
var
Color, Time, x2, y2, Counts, NextCount: integer;
ThaResult : Boolean;
begin
RMDebug('WaitUntilCut');
Writeln('WaitUntilCut');
Result := true;
GetMousePos(x,y);
Color := GetColor(x, y);
Time := GetSystemTime + (5+Random(3))*1000;
NextCount := InvCount + 1;
repeat
AntiRandoms;
AntiBan;
if ClickContinue(false, false) then
Inc(Stats_CustomVars[5]);
if GetSystemTime > Time then
begin
Time := GetSystemTime + (5+Random(3))*1000;
GetMousePos(x2, y2);
if Distance(x, y, x2, y2) > 10 then
MMouse(x, y, 3, 3);
if not WaitUpTextMulti(Which.UpText, 500) then
begin
RMDebug('WaitUntilCut - No Text');
Result := false;
break;
end;
SwitchWorlds;
end;
wait(250);
if not SimilarColors(GetColor(x, y), Color, 15) then
if not FindColorTolerance(x, y, Color, x - 7, y - 7, x + 7, y + 7, 15) then
begin
RMDebug('WaitUntilCut - no color');
Result := false;
break;
end;
wait(250);
if InvFull then
begin
RMDebug('WaitUntilCut - InvFull');
Result := false;
break;
end;
{if not WaitInvCount(NextCount, 250) then
begin
Inc(Counts);
if Counts > (Players[CurrentPlayer].Integers[2] / 500) then
begin
RMDebug('WaitUntilCut - NoInvCount');
Result := false;
break;
end;
end else begin
NextCount := InvCount + 1 ;
Counts := 0;
end; }
{wait(750);
until(False);
end;}
SCAR Code:
Function ChopTree(which: TTree): boolean;
var x, y, T:integer;
Location :string;
begin
if not LoggedIn then Exit;
Location := Players[CurrentPlayer].Loc;
Result := true;
FindNormalRandoms;
wait(random(500));
RMDebug('chop tree');
if not FindTree(which, x, y) then
begin
T := GetSystemTime;
repeat
AntiRandoms;
case Random(2) of
0: Wait(200 + Random(500));
1: SleepAndMoveMouse(400 + Random(1000));
end;
If (GetSystemTime - T > 60000) then
begin
writeln('couldn''t find tree?');
Result := false;
exit;
end;
until FindTree(which, x, y);
end;
if FindTree(which, x, y) then
begin
case Random(5) of
0..3: Mouse(x, y, 0, 0, True);
4:
begin
Mouse(x, y, 0, 0, False);
if (not WaitOption('ine R', 250)) then Exit;
end;
end;
if not WaitUntilCut(which, x, y) then Exit;
end;
Proggy;
Writeln('End of Chop Tree');
Writeln('Done Chop Ivy, +1');
end;
SCAR Code:
Procedure TakeCareOfStuff(bank: boolean);
var
i, c, x, y : integer;
TB : TBox;
begin
if not InvFull then exit;
FindNormalRandoms;
TakePic;
GameTab(tab_Inv);
Inc(Players[CurrentPlayer].Banked);
if Players[CurrentPlayer].Booleans[0] then
begin
if Bank then
DepositAll
else
DropAll;
exit;
end;
for i:= 1 to 28 do
begin
if not ExistsItem(i) then continue;
TB := InvBox(i);
if not FindDTM(AxeDTM, x, y, TB.x1, TB.y1, TB.x2, TB.y2) then
if Bank then
Deposit(i, i, true)
else
DropItem(i);
end;
FindNormalRandoms;
end;
SCAR Code:
Procedure SwitchPlayers;
var t, r: integer;
begin
begin
if (PlayersActive > 1)or(not LoggedIn) then
begin
LogOut;
NextPlayer(Players[CurrentPlayer].Active);
PlayerSetup;
exit;
end;
IncEx(Players[CurrentPlayer].Worked, TimeFromMark(RestTime));
Disguise('working');
PlayerSetup;
end;
end;
~RM