SCAR Code:
{
The Cookerator 2008 SRL4[#13]
^Cooks basic foods in Edgeville or Falador.
^Setup players in correct banks.
^Players[#].booleans[0]:
True (Edgeville Bank)
False (Falador East Bank)
^Players[#].strings[0]:
'chicken'
'meat' (cooks all meats)
'shrimps'
'sardine'
'anchovies'
'herring'
'trout'
'pike'
'salmon'
'tuna'
'lobster'
'swordfish'
'all' (cooks ALL food found in bank)
-munk
}
program Cookerator2008;
{.include srl/srl.scar}
type FoodType = record
num : integer;
dtm : integer;
end;
var
x,y,s,minWait,minMark,burned,
bankFailsafe,Ebankers,Fbankers:integer;
foodName:array[0..11] of string;
stats:array[0..11] of integer;
Food:FoodType;
dtmSet:boolean;
const
SRLstatsID = '';
SRLstatsPW = '';
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //username
Players[0].Pass := ''; //password
Players[0].Nick := ''; //3-4 letters from your username
Players[0].strings[0] := 'all'; // food name
Players[0].booleans[0] := true; // Edgeville? (false = Falador)
Players[0].Loc := 'bank';
Players[0].Active := True;
end;
procedure cook; forward;
function activePlayers:integer;
var
i,c:integer;
begin
for i:=0 to howmanyplayers-1 do
begin
if players[i].active then inc(c);
end;
result:=c;
end;
procedure report;
var
i:integer;
begin
clearDebug;
writeln('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
for i:=0 to howmanyplayers-1 do
writeln('['+inttostr(i)+'] '+players[i].nick+' = '+left(booltostr(players[i].active),1)+' | Cooked '+intToStr(players[i].integers[0])+' | '+players[i].loc+' | '+players[i].rand);
writeln('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
writeln(' ');
writeln(' Cookerator 2008 by munk ');
writeln(' ');
writeln(' '+TimeRunning);
for i:=0 to 8 do
begin
if not(stats[i]=0) then
begin
writeln(' '+inttostr(stats[i])+' '+foodname[i]);
end;
end;
writeln(' burned '+inttostr(burned));
writeln(' ');
writeln('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
srlrandomsreport;
end;
procedure FNR;
var
t:integer;
begin
if (not(loggedIn)) then exit;
marktime(t);
if findNormalRandoms then
status('Random Handled!')
else
status('FindNormalRandoms took ' + inttostr(timefrommark(t)) +'ms');
end;
procedure SetFood;
var
theFood:string;
begin
status('Setting Food Type');
if (lowercase(Players[currentplayer].strings[0])='all') then
theFood:=foodName[Players[currentplayer].integers[1]]
else
theFood:=Players[currentplayer].strings[0];
if dtmSet then freeDTM(Food.dtm);
case LOWERCASE(theFood) of
'chicken': begin
Food.num := 0;
Food.dtm := DTMFromString('78DA638C6164605805C448E0C8B2250CFC401' +
'A24FA1F08189381AC25A86A20B2301248670159F308A8C903B256' +
'1050130B646D22A02608C85A43404D3490B510BF1A005AEF0D70');
end;
'meat': begin
Food.num := 1;
Food.dtm := DTMFromString('78DA63D463646070006224B05045944104488' +
'344FF0301A326906587AA06220B2381B43290E54C408D0A90E54D' +
'408D2190E54F408D3590E544400DC8BD16F8D50000F8CA082A');
end;
'shrimp','shrimps': begin
Food.num := 2;
Food.dtm := DTMFromString('78DA6314646260906364400693B28219F8813' +
'448F43F10300A01D5C8A0AA81C8C248202D01542341408D2C508D' +
'3201359240354A04D4F003D5A81250C34ED8CD007B5C06E3');
end;
'sardine': begin
Food.num := 3;
Food.dtm := DTMFromString('78DA63B46262609063644006E95B3318F8813' +
'448F43F10305A02D5C8A2AA81C8C248206D0A54A34C408D1D508D' +
'0201356E4035D2F8D5000004EE0772');
end;
'anchovies',
'anchovie',
'anchovy': begin
Food.num := 4;
Food.dtm := DTMFromString('78DA63FCCFC0C010CAC8800C9292B218F8813' +
'448F43F103082D404A3AA81C8C24820CD0A64851050C30664F913' +
'50C30F64F910614E0C0135BF81441401353F8144347E350083070' +
'C17');
end;
'herring': begin
Food.num := 5;
Food.dtm := DTMFromString('78DA638C6762605060644006BB376E64E007D' +
'220D1FF40C0180D54238BAA06220B23817418508D2A0135314035' +
'1A04D46402D5C813505304542347404D1E508D247E3500636909E' +
'7');
end;
'trout': begin
Food.num := 6;
Food.dtm := DTMFromString('78DA63D460646088006224B079C572067E200' +
'D12FD0F048C2A405618AA1A882C8C04D27240563C01356A405602' +
'0135BA40562C01355640963F0135E640961F7E350044DC09C5');
end;
'pike': begin
Food.num := 7;
Food.dtm := DTMFromString('78DA63F467646008036224105518CDC00FA44' +
'1A2FF8180D11B530D441646026957202B9E801A5F202B81809A44' +
'20CB9F809A3820CB8F809A10202B16BF1A00140409F8');
end;
'salmon': begin
Food.num := 8;
Food.dtm := DTMFromString('78DA632C67646008056224501FE8C1C00FA44' +
'1A2FF8180B10CC80A465503918591403A17C88A21A02607C88A25' +
'A0A604C84A20A0A69A08733A802C7F026A5A812C3FFC6A003F3D0' +
'BC8');
end;
'tuna': begin
Food.num := 9;
Food.dtm := DTMFromString('78DA639CCBC8C01001C44860DFD62D0CFC401' +
'A24FA1F0818670159C1A86A20B23012484F01B26208A8990C64C5' +
'1250B308C84A20A06605A69B31D4AC2542CD6A202B04BF1A00241' +
'80E22');
end;
'lobster': begin
Food.num := 10;
Food.dtm := DTMFromString('78DA633CC9C8C01004C448A0C44996811F488' +
'344FF0301E309202B10550D44164602E95D40561401354781AC50' +
'026A8E00593104D480DC1C4940CD29202B89809AF340563001359' +
'7802C6FFC6A009F170F1A');
end;
'swordfish': begin
Food.num := 11;
Food.dtm := DTMFromString('78DA637CC5C8C01004C448604DF556067E200' +
'D12FD0F048CCF31D540646124907E0064251250F301C80A26A0E6' +
'0790154540CD2F202B8C809A7F4056087E350015020EF7');
end;
else begin
writeln('ERROR: Invalid Food Type');
exit;
end;
end;
dtmSet:=true;
status('Food Type Successfully Set');
end;
procedure login;
begin
status('Logging In...');
bankFailsafe:=0;
if (not(loggedin)) then loginplayer;
wait(200);
FNR;
marktime(s);
makecompass('n');
setAngle(true);
{ if not(players[currentplayer].booleans[1]) then
begin
setBar('brightness',4);
players[currentplayer].booleans[1]:=true;
end; }
SetFood;
end;
procedure nolog;
begin
if (not(loggedin)) then exit;
begin
status('Idle too long...');
case random(4) of
0: idleTime(500+random(500),800+random(200),0.01);
1: gametab(random(14));
2: begin
mouse(random(msx2),random(msy2),0,0,false);
chooseOption('xamin');
end;
3: begin
if FindNPCChatText('gratu', ClickLeft) then
begin
FindNPCChatText('gratu', ClickLeft);
cook;
end else
writeln('hai.');
end;
end;
gametab(4);
end;
end;
function UTWait(maxtime:integer;txt:TstringArray):boolean;
var
t:integer;
begin
if (not(loggedIn)) then exit;
marktime(t);
while(timefrommark(t)<maxtime)do
begin
if IsUpTextMultiCustom(txt) then
begin
result:=true;
exit;
end;
wait(10+random(10));
end;
end;
function cookScreen:boolean;
var
mx,my:integer;
begin
result:=findtext(mx,my,'cook',npcchars,338,357,378,382);
end;
function waitUntilCookScreen:boolean;
var
i:integer;
begin
status('Waiting For Cooking Screen...');
for i:=1 to 30 do
begin
if cookScreen then
begin
result:=true;
status('Cooking Screen Found!');
exit;
end;
FNR;
wait(100+random(50));
end;
end;
procedure dropAllBurned;
var
i,len,z,col,burntColor:integer;
h,s,l:extended;
slot:TPoint;
slotBox:TBox;
var
P:array of Tpoint;
begin
for i:=1 to 28 do
begin
slotBox:=invbox(i);
slot:=itemcoords(i);
FindColorsSpiralTolerance(x,y,P,6250599,slot.x-10,slot.y,slot.x,slot.y+10,13);
len:=high(P);
for z:= 0 to len do
begin
col := GetColor(P[z].x,P[z].y);
ColorToHSL(col,h,s,l);
if (H < 4) and (H > 0) then
if (S < 4) and (S > 1) then
if (L < 43) and (L > 26) then
begin
burntColor := col;
break;
end;
end;
end;
for i:=1 to 28 do
begin
slotBox:=invBox(i);
if findColor(x,y,burntColor,slotBox.x1,slotBox.y1,slotBox.x2,slotBox.y2) then
begin
slot:=itemcoords(i);
mmouse(slot.x,slot.y,6,6);
if UTwait(500+random(500),['urnt']) then
begin
getMousePos(x,y);
mouse(x,y,0,0,false);
wait(50+random(50));
chooseOption('rop');
inc(burned);
end;
end;
end;
end;
function openDoorEdge:boolean;
var
i,len,mx,my:integer;
p,tmp:TpointArray;
colors:Array[0..5] of integer;
begin
colors[0]:=5274764;
colors[1]:=3366508;
colors[2]:=2175801;
colors[3]:=1780015;
colors[4]:=4615290;
colors[5]:=4285809;
fflag(0);
wait(800+random(200));
for i:=0 to 5 do
begin
findColorsSpiralTolerance(mscx,mscy,tmp,colors[i],msx1,msy1+30,msx2,msy2-30,3);
p:=combineTPA(p,tmp);
setArrayLength(tmp,0);
end;
p:=rearrangeandshortenarrayEx(p,20,20);
len:=high(p);
for i:=0 to len do
begin
mmouse(p[i].x,p[i].y,2,2);
if UTWait(100+random(100),['Door']) then
begin
if isUpText('lose') then
begin
result:=true;
exit;
end else
begin
if isUpText('pen') then
begin
getMousePos(mx,my);
mouse(mx,my,0,0,true);
fflag(0);
result:=true;
exit;
end;
end;
end;
end;
colorToleranceSpeed(1);
end;
function openDoorFally:boolean;
var
i:integer;
begin
if (not(loggedIn)) then exit;
status('Finding Door...');
fflag(0);
wait(500+random(300));
ColorToleranceSpeed(2);
x:=mscx;
y:=mscy;
for i:=1 to 15 do
begin
if FindColoredAreaTolerance(x,y,5796738,msx1,msy1,msx2,msy2,4,i) then
begin
mmouse(x,y,3,3);
if UTWait(100+random(100),['oor']) then
begin
if isUpText('lose') then
begin
result:=true;
exit;
end else
begin
if isUpText('pen') then
begin
getMousePos(x,y);
mouse(x,y,0,0,true);
fflag(0);
result:=true;
exit;
{ end else
begin
getMousePos(x,y);
mouse(x,y,0,0,false);
wait(10+random(40));
if chooseOption('Open') then }
end;
end;
end;
end;
end;
ColorToleranceSpeed(1);
end;
procedure WalkToStoveEdge;
var
i:integer;
begin
if (not(loggedIn)) then exit;
status('Walking To Stove...');
if findsymbol(x,y,'cook') then
begin
if rs_onMinimap(x,y-5) then
begin
status('Cook Symbol Found!');
mouse(x,y-5,7,7,true);
wait(2000);
fflag(random(5));
end else exit;
end else
begin
status('Cook Symbol not Found! Moving Closer...');
radialWalk(findVarrockRoadColor,265,300,55,2,2);
for i:=0 to 30 do
begin
if findsymbol(x,y,'cook') then
begin
status('Cook Symbol Found!');
mouse(x,y-9,7,7,true);
wait(2000);
fflag(random(5));
break;
end;
if i=30 then
begin
status('Cook Symbol Not Found!');
logout;
symbolAccuracy := 0.8;
exit;
end;
if (i mod 5 = 0)and(i<>0) then
symbolAccuracy := symbolAccuracy - 0.1;
wait(500);
end;
symbolAccuracy := 0.8;
end;
for i:=0 to 3 do
begin
if opendoorEdge then
begin
players[currentplayer].loc:='stove';
exit;
end;
end;
logout;
end;
procedure WalkToBankEdge;
var
i:integer;
begin
if (not(loggedIn)) then exit;
status('Walking To Bank...');
for i:=0 to 5 do
begin
if openDoorEdge then break;
end;
radialWalk(findVarrockRoadColor,140,70,63,2,2);
for i:=0 to 20 do
begin
if DTMrotated(Ebankers,x,y,mmx1,mmy1,mmx2,mmy2) then
begin
mouse(x-5,y-5,5,5,true);
status('Bank Found');
dropAllBurned;
fflag(0);
players[currentplayer].loc:='bank';
exit;
end;
wait(500);
if i=10 then radialWalk(findVarrockRoadColor,150,60,55,2,2);
end;
status('Bank Not Found!');
logout;
end;
procedure WalkToStoveFally;
var
i:integer;
p:TpointArray;
begin
if (not(loggedIn)) then exit;
status('Walking To Stove...');
if radialWalkEx(p,mmcx,mmcy,findWaterColor,0,270,200,65) then
for i:=0 to high(p) do
begin
if rs_OnMiniMap(p[i].x+10,p[i].y-40) then
if mfnf(p[i].x+10,p[i].y-40,4,4) then
begin
wait(5000);
fflag(random(11));
break;
end;
end;
for i:=0 to 30 do
begin
if findsymbol(x,y,'cook') then
begin
status('Cook Symbol Found!');
mouse(x+5,y-5,7,7,true);
wait(2000);
fflag(random(5));
break;
end;
if i=30 then
begin
status('Cook Symbol Not Found!');
logout;
symbolAccuracy := 0.8;
exit;
end;
if (i mod 5 = 0)and(i<>0) then
symbolAccuracy := symbolAccuracy - 0.1;
wait(500);
end;
symbolAccuracy := 0.8;
for i:=0 to 3 do
begin
if opendoorFally then
begin
players[currentplayer].loc:='stove';
exit;
end;
end;
logout;
end;
procedure WalkToBankFally;
var
i:integer;
p:TpointArray;
begin
if (not(loggedIn)) then exit;
status('Walking To Bank...');
for i:=0 to 3 do
begin
if opendoorFally then break;
end;
if radialWalkEx(p,mmcx,mmcy,findFallyRoadColor,0,90,160,65) then
for i:=0 to high(p) do
begin
if rs_OnMiniMap(p[i].x,p[i].y) then
if mfnf(p[i].x,p[i].y,4,4) then
begin
dropAllBurned;
wait(2000);
fflag(random(11));
break;
end;
end;
for i:=0 to 20 do
begin
if DTMrotated(Fbankers,x,y,mmx1,mmy1,mmx2,mmy2) then
begin
mouse(x,y-9,5,5,true);
status('Bank Found');
dropAllBurned;
fflag(0);
players[currentplayer].loc:='bank';
exit;
end;
wait(500);
if i=10 then radialWalk(findFallyRoadColor,70,160,55,2,2);
end;
status('Bank Not Found!');
logout;
end;
function findStove:boolean;
var
i,len:integer;
p:TpointArray;
pp:T2DpointArray;
begin
status('Finding Stove...');
findColorsSpiralTolerance(mscx,mscy,p,1385640,msx1,msy1,mscx+100,msy2,20);
pp:=splitTPAex(p,25,40);
len:=high(pp);
for i:=0 to len do
begin
if middleTPAex(pp[i],x,y) then
begin
mmouse(x,y,3,3);
if UTwait(250+random(250),['tove','ange']) then
begin
status('Stove Found!');
getmousepos(x,y);
mouse(x,y,0,0,true);
FNR;
fflag(0);
FNR;
result:=true;
exit;
end;
end;
end;
end;
procedure cook;
var
i,t,t2:integer;
foodPt:Tpoint;
slot:Tbox;
begin
if (not(loggedIn)) then exit;
status('Cooking...');
for i:=1 to 28 do
begin
slot:=invbox(i);
if findDTM(food.dtm,x,y,slot.x1,slot.y1,slot.x2,slot.y2) then
begin
stats[food.num]:=stats[food.num]+1;
reportVars[food.num]:=reportVars[food.num]+1;
players[currentplayer].integers[0]:=players[currentplayer].integers[0]+1;
end;
end;
marktime(t);
while(FindDTM(Food.dtm,foodPt.x,foodPt.y,mix1,miy1,mix2,miy2))do
begin
mouse(foodPt.x,foodPt.y,5,5,true);
wait(50+random(50));
if findStove then
begin
if waitUntilCookScreen then
begin
mouse(220,385,60,50,false);
wait(50+random(50));
if chooseOption('All') then
begin
marktime(t2);
repeat
FTWait(4);
if not(findDTM(food.dtm,x,y,mix1,miy1,mix2,miy2)) then break;
if clicktocontinue then break;
nolog;
until(timefrommark(t2)>60000);
end;
end;
end else
begin
if random(10)>3 then
mouse(foodPt.x,foodPt.y,8,8,true)
else
gametab(3);
end;
if timefrommark(t)>160000 then break;
FNR;
if findFight then
begin
status('Fight Found! Running.');
if players[currentplayer].booleans[0] then
begin
openDoorEdge;
runaway('n',true,1,10000+random(5000));
end else
begin
openDoorFally;
runaway('e',true,1,10000+random(5000));
end;
end;
wait(100+random(100));
end;
players[currentplayer].loc:='walktobank';
end;
procedure bank;
begin
if (not(loggedIn)) then exit;
if not(bankscreen) then FNR;
status('Banking...');
wait(500);
if findDtm(food.dtm,x,y,mix1,miy1,mix2,miy2) then
begin
players[currentplayer].loc:='WalkToStove';
exit;
end;
makecompass('n');
if not((bankscreen)or(pinscreen)) then
begin
if players[currentplayer].booleans[0] then
begin
if not(openBankFast('eb')) then
begin
status('No MS Bank Found');
logout;
exit;
end;
end else
begin
if not(openBankQuiet('feb')) then
begin
status('No MS Bank Found');
logout;
exit;
end;
end;
end;
if pinscreen then inPin(players[currentplayer].strings[0]);
wait(250+random(250));
deposit(1,28,True);
fixbank;
wait(250+random(250));
if findDTM(food.dtm,x,y,msx1,msy1,msx2,msy2) then
begin
mouse(x,y,5,5,false);
wait(100+random(100));
chooseOption('All');
wait(250+random(250));
end;
wait(500);
if findDtm(food.dtm,x,y,mix1,miy1,mix2,miy2) then
begin
players[currentplayer].loc:='WalkToStove';
BankFailsafe:=0;
end else
begin
inc(bankFailsafe);
if bankFailsafe>2 then
begin
if (lowercase(Players[currentplayer].strings[0])='all')and(players[currentplayer].integers[1]<11) then
begin
inc(players[currentplayer].integers[1]);
setFood;
end else
begin
closebank;
logout;
exit;
end;
end;
bank;
exit;
end;
closebank;
// report;
gametab(4);
end;
begin
SetupSrl;
ScriptID:='373';
if not(SRLstatsID = '') then SRLID := SRLstatsID;
if not(SRLstatsPW = '') then SRLPassword := SRLstatsPW;
declareplayers;
Ebankers:=DTMFromString('78DA63DCC9C8C0D0CD00064C108AE1CF1F080' +
'B28C3F01F0818770159CDB8D580E9FD40563D01353B80AC29F8D5' +
'00009B4E1104');
Fbankers:=DTMFromString('78DA634C626260B8C800068C108AE1CF1F263' +
'8FF3F1030A6E15703A6E308AB010054AE0D93');
foodName[0]:='chicken';
foodName[1]:='meat';
foodName[2]:='shrimp';
foodName[3]:='sardine';
foodName[4]:='anchovies';
foodName[5]:='herring';
foodName[6]:='trout';
foodName[7]:='pike';
foodName[8]:='salmon';
foodName[9]:='tuna';
foodName[10]:='lobster';
foodName[11]:='swordfish';
activateclient;
wait(1000);
login;
repeat
if not(loggedIn) then login;
if lowercase(players[currentplayer].loc)='bank' then bank;
if lowercase(players[currentplayer].loc)='walktostove' then
if Players[currentplayer].booleans[0] then
walkToStoveEdge
else
walkToStoveFally;
if lowercase(players[currentplayer].loc)='stove' then cook;
if lowercase(players[currentplayer].loc)='walktobank' then
if Players[currentplayer].booleans[0] then
walkToBankEdge
else
walkToBankFally;
if not(loggedIn) then
begin
status('Next Player...');
if activePlayers<=1 then break;
nextplayer(false);
report;
login;
end;
if timefrommark(s)>1800000 then
begin
logout;
if activePlayers=1 then
begin
minWait:=random(60000);
writeln('Only 1 Active Player | Waiting');
marktime(minMark);
repeat
wait(1000);
status(inttostr((minWait-timefrommark(minMark))/1000)+' seconds');
until(timefrommark(minMark)>minWait);
end;
nextplayer(true);
report;
login;
end;
until(activePlayers=0);
freeDTM(food.dtm);
clearDebug;
players[currentplayer].active:=false;
report;
writeln('post proggies/feedback! Thx for using! -munk');
end.