SCAR Code:
program FallyCowCruncher;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
{.include srl/srl/skill/fighting.scar}
var
x,y,a,i,LDBA,pf,CowsKilled,HidesPicked,LoadsDone,Tl: integer;
Player: boolean;
const
Debug = True;
YourSrlID = '';
YourSrlPassword = '';
procedure DeclarePlayers;
begin
HowManyPlayers := 4;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);
Players[0].Name := '';
Players[0].Pass := 'ng';
Players[0].Nick := 'h';
Players[0].Integers[1] :=0; //desired attack
Players[0].Integers[2] :=93; //desired strength
Players[0].Integers[3] :=0; //desired defense
Players[0].Integers[4] :=1; //How many loads before logging
Players[0].Integers[7] := 5; //avg seconds to kill a cow
Players[0].Active := True;
Players[1].Name := '';
Players[1].Pass := '';
Players[1].Nick := 'et';
Players[1].Integers[1] :=0; //desired attack
Players[1].Integers[2] :=90; //desired strength
Players[1].Integers[3] :=0; //desired defense
Players[1].Integers[4] :=1;
Players[1].Integers[7] := 5; //avg seconds to kill a cow
Players[1].Active := true;
Players[2].Name := '';
Players[2].Pass := '';
Players[2].Nick := 'id';
Players[2].Integers[1] :=0; //desired attack
Players[2].Integers[2] :=90; //desired strength
Players[2].Integers[3] :=0; //desired defense
Players[2].Integers[4] :=1;
Players[2].Integers[7] := 7; //avg seconds to kill a cow
Players[2].Active := True;
Players[3].Name := '';
Players[3].Pass := '';
Players[3].Nick := '';
Players[3].Integers[1] :=0; //desired attack
Players[3].Integers[2] :=0; //desired strength
Players[3].Integers[3] :=0; //desired defense
Players[3].Integers[4] :=1;
Players[3].Integers[7] := 5; //avg seconds to kill a cow
Players[3].Active := False;
end;
{
===========================================================================================}
{
============================================================================================}
function AttackMode:boolean;
var
b,att,str,def:integer;
begin
if not(loggedIn) then exit;
result:=true;
if (timefrommark(b)>30000)or(players[currentplayer].skill='') then
begin
GameTab(2);
wait(200);
att:=getskillinfo('attack',false);
str:=getskillinfo('strength',false);
def:=getskillinfo('defence',false);
if Debug then writeln(inttostr(att)+' attack');
if Debug then writeln(inttostr(str)+' strength');
if Debug then writeln(inttostr(def)+' defence');
Players[currentplayer].Skill := '';
marktime(b);
if att >= (players[CurrentPlayer].integers[1]) then
att := 100;
if str >= players[CurrentPlayer].integers[2] then
str := 100;
if def >= players[CurrentPlayer].integers[3] then
def := 100;
while (players[currentplayer].skill = '') do
begin
if att <= str then
if att <= def then
players[CurrentPlayer].skill := 'attack';
if str <= att then
if str <= def then
Players[CurrentPlayer].skill := 'strength';
if def <= att then
if def <= str then
Players[CurrentPlayer].skill := 'defence';
end;
end;
if debug then Writeln('attack style is ' + players[currentplayer].skill);
GameTab(1);
case lowercase(players[currentplayer].skill) of
'attack': setfightmode(1);
'strength': setfightmode(2);
'defence','defense': setfightmode(4);
end;
end;
{
==========================================================================================}
function underAttack(rx,ry:integer):boolean;
begin
if not(loggedIn) then exit;
if (findcolorspiral(x,y,65280,rx-15,ry-50,rx+15,ry+30))
or (findcolorspiral(x,y,255,rx-15,ry-50,rx+15,ry+30)) then
result:=true;
end;
{
==============================================================================================}
Procedure Proggy;
begin
Writeln('=====================================================================');
Writeln('FallyCowCruncher has been running for ' + Timerunning);
Writeln('~~~~~~~~~~~~~~~~~~~~~~~~');
Writeln('Players have killed ' + inttostr(CowsKilled) + ' Cows');
Writeln('and picked up ' + inttostr(hidespicked) + ' Cowhides');
Writeln('in a total of ' + inttostr(LDBA) + ' Loads');
for i := 0 to (HowManyPlayers - 1) do
begin
if Players[i].Active = true then
begin
if players[i].integers[5] > 0 then
begin
Writeln('');
Writeln(Players[i].name + ' has killed ' + inttostr(players[i].integers[5]) + ' Cows');
end;
if players[i].integers[6] > 0 then
begin
Writeln('and has picked ' + inttostr(players[i].integers[6]) + ' Hides');
end;
end;
end;
Writeln('===========================FallyCowCruncher==========================');
end;
{
================================================================================}
procedure FastFlag;
var
Time:integer;
begin
marktime(Time);
while (flagPresent) do
begin
if timefrommark(Time)>4000+ random(2000) then exit;
wait(300);
end;
end;
{
==============================================================================================}
//thank you Munk
function getMMgateColor:integer;
var
i,i2,c,col,lenTmp:integer;
p:TpointArray;
begin
for col:=200 to 254 do
begin
c:=0;
setArrayLength(p,0);
findColorsSpiralTolerance(mmcx,mmcy,p,col,mmx1,mmy1,mmx2,mmy2,0);
lenTmp:=length(p);
if lenTmp>0 then
begin
for i:=0 to lenTmp-1 do
for i2:=0 to lenTmp-1 do
begin
if not((p[i].x=p[i2].x)and(p[i].y=p[i2].y)) then
if (abs(p[i].x-p[i2].x)<2) and (abs(p[i].y-p[i2].y)<2) then
inc(c);
if c>2 then
begin
result:=col;
writeln('doorColor = '+inttostr(col));
exit;
end;
end;
end;
end;
writeln('ERROR: doorColor not found!');
end;
{
=============================================================================================}
//Thank you Munk
procedure SetRetaliate(ret:boolean);
var
i:integer;
begin
if not(loggedIn) then exit;
gametab(1);
for i:=1 to 5 do
begin
case getColor(600,390) of
4540745: if ret=true then mouse(600+random(100),370+random(20),0,0,true) else exit;
1711220: if ret=false then mouse(600+random(100),370+random(20),0,0,true) else exit;
end;
wait(200);
end;
end;
Procedure AntiBan;
begin
case random(8) of
3: HoverSkill(players[currentplayer].skill,false);
5: PickupMouse;
7: BoredHuman;
1: FindNormalrandoms;
4: FindNormalRandoms;
8: FindNormalRandoms
end;
end;
Procedure YellowDot;
var
thegatecolor : integer;
begin
if not(loggedin) then Exit;
makecompass('n');
x := 626;
y := 8;
TheGateColor := GetMMGateColor;
findcolorspiral(x,y,TheGateColor,MMx1,MMy1,MMx2,MMy2);
if FindColorSpiral(x,y,62965,MMX1,y,MMX2,MMY2) then
begin
Mouse(x,y,3,3,true);
Flag;
Wait(846);
end;
end;
{
============================================================================================}
Function CheckGateOpen(IntoPen:Boolean): Boolean;
var
GX, GY, K, P: Integer;
Color: array [0..2] of integer;
begin
MarkTime(k);
if IntoPen = true then
begin
Color[0] := 4610919;
Color[1] := 2636613;
Color[2] := 2373183
end else
begin
Color[0] := 4874349;
Color[1] := 2505028;
Color[2] := 2373183;
end;
MarkTime(p);
repeat
if FindObjCustom(GX, GY, ['ate','pen','ose'], [Color[0],color[1],color[2]],3) then
begin
if IsUpText('los') then
begin
Result := true;
end;
if IsUpText('pen') then
begin
Wait(100 + Random(100));
Mouse(GX, GY, 0, 0, False);
if chooseoption('pen') then
begin
FastFlag;
Result := True;
end;
end;
end;
if TimeFromMark(p)> 30000 then
begin
MakeCompass('s');
end;
if TimeFromMark(k) > 60000 then
begin
Logout;
NextPlayer(false);
Exit;
end;
until(Result = true);
end;
{
================================================================================}
Procedure FightSetup;
begin
begin
If not(loggedin) then Exit;
MakeCompass('n');
SetRun(true);
AttackMode;
SetRetaliate(true);
GameTab(4);
end;
end;
{
============================================================================================}
Procedure WhenToRun;
var
Hp: integer;
Begin
if (not(loggedin)) then exit;
FindNormalRandoms;
Wait(random(1000));
Wait2(1000, false);
Hp:=HpPercent;
if (Hp > 0) and (Hp < 50) then
begin
runaway('n',true,2,random(5000));
logout;
Proggy;
nextplayer(false);
Exit;
end;
end;
{
============================================================================== }
procedure LogIn;
begin
if not(loggedin) then
begin
LoginPlayer;
Loadsdone := 0
end;
Wait(500);
FindNormalRandoms;
SetAngle(true);
Tl := 0;
MakeCompass('n');
GameTab(5);
SetRun(false);
SetBar('Brightness',4);
end;
{
============================================================================================}
Function CollectHide: Boolean;
var
l,highest: integer;
hide: array [0..1] of integer;
H: Tpoint;
Hc,hc2: TpointArray;
Hca: T2dpointArray;
begin
if debug then writeln('now looking for some cowhides');
Hide[0] := 10461099;
Hide[1] := 13224656;
MarkTime(l);
repeat
if invfull then Exit;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(MSCx,MSCy,Hc,Hide[0],MSX1,MSY1,MSX2,MSY2,6);
wait(50);
FindColorsSpiralTolerance(MSCx,MSCy,Hc2,Hide[1],MSX1,MSY1,MSX2,MSY2,6);
wait(50);
If TimeFromMark(l) > 8000 then Break;
Hc:=CombineTPA(Hc,Hc2);
if length(Hc) > 0 then
begin
Hca := TPAToATPAEx(Hc,20,20);
Highest := High(Hca);
for i := 0 to highest do
if length(Hca[i]) > 20 then
begin
if debug then Writeln('found some Hide colors...');
H := MiddleTPA(Hca[i]);
if (h.x <> 0) and (h.y <> 0) then
begin
Mouse(h.x,h.y,5,5,False);
if Chooseoption('owhi') then
begin
if debug then writeln('Found hide at ' + inttostr(length(hca[i])) + ' length');
FastFlag;
FindNormalRandoms;
wait(300);
HidesPicked := HidesPicked + 1;
ReportVars[1] := ReportVars[1] + 1;
Result := true;
Break;
Players[CurrentPlayer].integers[6] := Players[CurrentPlayer].integers[6] + 1;
end else
if debug then writeln('wrong hidecolor found at ' + inttostr(length(hca[i])) + ' TPA length');
end;
wait(100 + random(300));
end;
end;
until(Result = true);
end;
{
============================================================================================}
Procedure KillDaCow;
var
p,z,m,d,f,thegatecolor: integer;
C: Tpoint;
Cow: T2dPointArray;
Colors:array [0..3] of TPointArray;
Color: array [0..3] of Integer;
begin
if not(loggedin) then exit;
Tl := 0;
Color[0] := 6848153;
Color[1] := 7635346;
Color[2] := 3952728;
Color[3] := 5331046;
FightSetup;
MarkTime(m);
MarkTime(f);
Marktime(d);
repeat
if TimeFromMark(m) >= 60000 then
begin
FightSetup;
MarkTime(m);
end;
if not loggedin then LoginPlayer;
FindColorsTolerance(Colors[0],Color[0],MSX1,MSY1,MSX2,MSY2,25);
FindColorsTolerance(Colors[1],Color[1],MSX1,MSY1,MSX2,MSY2,25);
FindColorsTolerance(Colors[2],Color[2],MSX1,MSY1,MSX2,MSY2,25);
FindColorsTolerance(Colors[3],Color[3],MSX1,MSY1,MSX2,MSY2,25);
begin
Colors[0]:= CombineTPA(Colors[0],Colors[1]);
Colors[2]:= CombineTPA(Colors[2],Colors[3]);
Colors[0]:= CombineTPA(Colors[0],Colors[2]);
MarkTime(p);
if length(Colors[0]) > 0 then
begin
Cow := TPAToATPAEx(Colors[0],40,40);
for i := 0 to high(cow) do
If Length(cow[i]) >= 250 then
begin
C := MiddleTPA(Cow[i]);
if (not(UnderAttack(c.x,c.y))) then
begin
if (c.x <> 0) and (c.y <> 0) then
begin
MMouse(c.x,c.y,10,10);
wait(50+random(100));
if isuptext('Cow') then
begin
Mouse(c.x,c.y,10,10,false);
wait(100);
if ChooseOption('Attack') then
begin
if debug then writeln('cowcolor found with length ' + inttostr(length(cow[i])));
wait(100);
FastFlag;
wait2(400+random(500),false);
MarkTime(z);
while TimeFromMark(z) < (Players[currentplayer].integers[7] * 1000) + random(2000) do
begin
WhenToRun;
FindNormalRandoms;
end;
Tl := 0;
CowsKilled := CowsKilled + 1;
ReportVars[0] := ReportVars[0] + 1;
Players[currentplayer].integers[5] := Players[currentplayer].integers[5] + 1;
Collecthide;
wait(100);
SrlRandomsReport;
MarkTime(d);
break;
end;
end else
begin
if debug then writeln('wrong cowcolor found with ' + inttostr(length(cow[i])));
end;
end;
end;
end;
end;
if Tl >= 3 then
begin
Logout;
Player := false;
Exit;
end;
if TimeFromMark(d) >= 25000 then
begin
if debug then writeln('cant find cow, moving...');
YellowDot;
MarkTime(d);
MarkTime(f);
Tl := Tl + 1;
end;
end;
if timefrommark(f) > 20000 then
begin
MakeCompass('n');
x := 626;
y := 8;
TheGateColor := GetMMGateColor;
if findcolorspiral(x,y,thegatecolor,mmx1,mmy1,mmx2,mmy2) then
if y > 85 then
begin
mouse(x,y - 3,1,1,true);
flag;
wait2(1500 + random (1000),true);
CheckGateOpen(true);
YellowDot;
MarkTime(d);
end;
MarkTime(f);
end;
Until(InvFull);
end;
{
============================================================================================}
Procedure Signature;
begin
Writeln('==================================');
Writeln('thank you for using...');
Writeln(' _____ ____ ____ ');
Writeln(' | ___| / ___| / ___|');
Writeln(' | |_ | | | |');
Writeln(' | _| | |___ | |___');
Writeln(' |_|alador \____|ow \____|runcher');
Writeln('============By Drizzt=============');
Writeln('');
end;
{
============================================================================================}
Procedure ScriptTerminate;
begin
if Debug = false then ClearDebug;
Signature;
Proggy;
end;
{
============================================================================================}
procedure BankStuff;
begin
GameTab(4);
if not(loggedin) then exit;
if (FindBank('feb')) then
begin
Wait(1000);
DepositAll;
Wait(1000);
CloseBank;
FindNormalRandoms;
end;
end;
{
============================================================================================}
procedure ToPen;
var
z,p,u,TheRoadColor,TheGateColor:integer;
begin
login;
Z:=0;
if not(invempty) then BankStuff;
Makecompass('n');
Repeat
TheRoadColor := findfallyroadColor;
Wait(500);
until(TheRoadColor > 0);
if radialwalk(TheRoadColor,180,270,40,1,1) then
begin
wait(500);
end else Exit;
MarkTime(z);
repeat
radialroadwalk(TheRoadColor,165,200,50,1,1);
AntiBan;
wait(200);
if TimeFromMark(z) > 120000 then
begin
Logout;
Player := false;
Exit;
end;
if (not(RadialWalk(TheRoadColor,165,200,50,1,1))) then
if (not(Findsymbolin(x,y,'tree',628,8,704,165))) then
begin
SymbolAccuracy := Symbolaccuracy -0.2;
If debug then Writeln('darn kid is standing on the symbol');
if debug then Writeln('decreasing accuracy');
end;
until(findsymbolin(x,y,'tree',628,8,704,165));
mouse(x + 7,y,10,5,true);
flag;
wait(1000);
P := 674;
U := 90;
TheGateColor := GetMMGateColor
if findcolorspiral(p,u,TheGateColor,mmx1,mmy1,mmx2,mmy2) then
begin
mouse(p + 1,u - 2,0,0,true);
if debug then writeln('going infront of the gate');
flag;
Antiban;
CheckGateOpen(True);
end;
if findcolorspiral(p,u,thegatecolor,mmx1,mmy1,mmx2,mmy2) then
begin
mouse(p,u + 15,10,10,true);
flag;
Setangle(True);
Z:= Z + 1;
end;
end;
{
============================================================================================}
procedure ToBank;
var
TheRoadColor,TheGateColor: Integer;
begin
if (not(loggedin)) then Exit;
if not(invfull) then exit;
if debug then writeln('have a full load, leaving for the bank');
FindNormalRandoms;
MakeCompass('n');
GameTab(5);
SetRun(false);
SetBar('Brightness',4);
x := 626;
y := 8;
TheGateColor := GetMMGateColor;
if findcolorSpiral(x,y,TheGateColor,mmx1,mmy1,mmx2,mmy2) then
begin
Mouse(x,y + 3,1,1,true);
Flag;
CheckGateOpen(false);
wait2(750,true);
if findsymbolin(x,y,'tree',548,9,627,165) then
begin
mouse(x - 5,y - 5,5,5,true);
flag;
wait(1000);
AntiBan;
end;
TheRoadColor := FindFallyRoadColor
RadialWalk(TheRoadColor,-50,0,60,2,2)
Wait(1000);
repeat
FindNormalRandoms;
RadialWalk(TheRoadColor,355,390,50,2,2);
if not(loggedin) then exit;
until(findsymbol(x,y,'bank') = true);
BankStuff;
LDBA := LDBA + 1;
LoadsDone := LoadsDone + 1;
if loadsdone >= Players[currentplayer].integers[4] then
begin
Proggy;
Logout;
Player := true;
Exit;
end;
end;
end;
{
============================================================================================
Main Loop-----------------------------------------------------------------------------------
============================================================================================}
begin
Player := True;
Signature;
SmartSetupEx(86,false,true);
SetTargetDC(smartGetDC);
SetupSRL;
ScriptID := '665';
SRLID := YourSRLID;
SRLPassword := YourSRLPassword
ActivateClient;
DeclarePlayers;
CowsKilled := 0;
HidesPicked := 0;
for I:= 0 to (HowManyPlayers - 1) do
begin
Players[I].integers[5] := 0;
Players[I].integers[6] := 0;
end;
repeat
pf := 0;
ToPen;
KillDaCow;
ToBank;
if not(loggedin) then NextPlayer(Player);
for i := 0 to (howmanyplayers - 1) do
if players[i].active = false then pf := pf + 1;
if pf = howmanyplayers then Exit;
until(False);
end.