I dont know how well it works. Start in edge pick the colors. Or if it even compiles
Program EdgeCooker;
{.Include SRL\SRL.Scar}
Var
CurrentLoad, Dx, Dy, DTMBankers, DoorColor: Integer;
FishTP: TPoint;
Salmons, Trouts, Bank, Burn, Gained: Integer;
Const
LoadPerPlayer = 5;
DeBug = True;
//Pick colors!
RawTrout = 11185077; //NonCooked Trout(Raw)
RawSalmon = 6385323; //NonCooked Salmon(Raw)
//Pick colors!
CookedTrout = 7040901; //Cooked Trout
CookedSalmon = 1590989; //Cooked Salmon
// >> No Need To Pick << \\
Burnd = 4342343;
Procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
CurrentPlayer:= 0;
NumberOfPlayers(HowManyPlayers);
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Pin := 7410;
Players[0].Active:= True;
end;
Procedure WriteIt(W00tz0r: String);
Begin
If(DeBug)Then
Writeln(W00tz0r);
Status(W00tz0r);
End;
Function WaitR(Time : Integer) : Boolean;
Var Time1: Integer;
Begin
Marktime(time1)
Repeat
Wait(50);
If(FindTalk)Then
Result := True;
Until(result)or(TimeFromMark(Time1)>Time);
End;
Function FindFastRandoms: Boolean; //by WT-Fakawi
var
i: Integer;
begin
for i:=1 to 8 do
begin
case I of
1: If FindDead then
Result := True;
2: If FindMod then
Result := True;
3: If FindMime then
Result := True;
4: If FindMaze then
Result := True;
5: If FindQuiz then
Result := True;
6: If FindDemon then
Result := True;
7: begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].loc := 'No GameTab';
Logout;
Exit;
end;
end;
8: begin
if InBlack then
begin
Result := True;
Players[CurrentPlayer].loc := 'InBlack';
Logout;
Exit;
end;
end;
end;
wait(1);
end;
end;
Function JukGetDoorColor: Integer;
Var
DoorTPA: TPointArray;
X, Y, I: Integer;
Begin
FindColorsSpiralTolerance(X, Y, DoorTPA, 200, MMX1, MMY1, MMX2, MMY2, 50);
For I:= 0 To GetArrayLength(DoorTPA)-1 Do
Begin
If(GetColor(DoorTPA[i].X, DoorTPA[i].Y) > 200)And
(GetColor(DoorTPA[i].X, DoorTPA[i].Y) < 255)Then
If(GetColor(DoorTPA[i].X+1, DoorTPA[i].Y) > 200)And
(GetColor(DoorTPA[i].X+1, DoorTPA[i].Y) < 255)Then
If(GetColor(DoorTPA[i].X+2, DoorTPA[i].Y) > 200)And
(GetColor(DoorTPA[i].X+2, DoorTPA[i].Y) < 255)Then
If(GetColor(DoorTPA[i].X+3, DoorTPA[i].Y) > 200)And
(GetColor(DoorTPA[i].X+3, DoorTPA[i].Y) < 255)Then
Begin
Result:= GetColor(DoorTPA[i].X, DoorTPA[i].Y);
Break;
End;
If(GetColor(DoorTPA[i].X, DoorTPA[i].Y) > 200)And
(GetColor(DoorTPA[i].X, DoorTPA[i].Y) < 255)Then
If(GetColor(DoorTPA[i].X, DoorTPA[i].Y+1) > 200)And
(GetColor(DoorTPA[i].X, DoorTPA[i].Y+1) < 255)Then
If(GetColor(DoorTPA[i].X, DoorTPA[i].Y+2) > 200)And
(GetColor(DoorTPA[i].X, DoorTPA[i].Y+2) < 255)Then
If(GetColor(DoorTPA[i].X, DoorTPA[i].Y+3) > 200)And
(GetColor(DoorTPA[i].X, DoorTPA[i].Y+3) < 255)Then
Begin
Result:= GetColor(DoorTPA[i].X, DoorTPA[i].Y);
Break;
End;
End;
If(Result <> 0)Then
Writeln('Door Color: ' + IntToStr(Result))
Else Writeln('Couldnt Get Door Color');
End;
Function OpenTheDoor: Boolean;
Var
Tol, X, Y: Integer;
DoorSkip: TBoxArray;
Begin
Flag;
Tol:= 10;
Repeat
WaitR(300+Random(200));
If(FindColorSkipBoxArrayTolerance(X, Y, 1525855, MSX1, MSY1, MSX2, MSY2, Tol, DoorSkip))Then
Begin
MMouse(X, Y, 0, 0);
Wait(25);
If(IsUpText('Close'))Then
Begin
Result:= True;
Break;
End Else
If(IsUpText('Open'))Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, False);
Result:= ChooseOption('Open');
Flag;
End Else
Begin
If(IsUpText('Search'))Then
Begin
WaitR(10);
Mouse(MMCX, MMCY + 30, 3, 3, True);
WaitR(10);
Flag;
SetArrayLength(DoorSkip, 0);
End Else
Begin
SetArrayLength(DoorSkip, GetArrayLength(DoorSkip)+1);
DoorSkip[GetArrayLength(DoorSkip)-1].x1:= X - 10;
DoorSkip[GetArrayLength(DoorSkip)-1].Y1:= Y - 10;
DoorSkip[GetArrayLength(DoorSkip)-1].x2:= X + 10;
DoorSkip[GetArrayLength(DoorSkip)-1].Y2:= Y + 10;
End;
End;
End Else
Begin
Tol:= Tol + 1;
Mouse(MMCX, MMCY + 10, 3, 3, True);
WaitR(10);
Flag;
WaitR(10);
End;
WaitR(300+Random(200));
Until(Not Loggedin)Or(Result)Or(GetArrayLength(DoorSkip)-1 > 20);
End;
function RadialDoorWalk(TheColor: Integer; StartRadial, EndRadial: Integer; Radius:
Integer; Xmod, Ymod: Integer): Boolean;
var
mx, my: Integer;
begin
if (StartRadial = EndRadial) then
begin
WriteLn('WARNING: Using LinearRalk, StarRadial, and EndRadial are the same');
if LinearRoadWalk(TheColor, StartRadial, Radius, XMod, YMod) then
Result := True;
end else
if (radialwalkex(mx, my, 648, 83, thecolor, 0, startradial, endradial, radius)) then
begin
MouseFindNoFlag(mx, my+10, Xmod, Ymod);
Result := True;
FFlag(10);
end;
end;
Procedure WalkToStove;
Begin
If(Not Loggedin)Then Exit;
WriteIt('Walkting to Stove');
RoadColor:= FindRoadColor;
RadialRoadWalk(RoadColor, 293, 237, 40, 0, 0);
FindFastRandoms;
DoorColor:= JukGetDoorColor;
If(Not RadialDoorWalk(DoorColor, 360, 269, 75, 0, 0))Then
Begin
WriteIt('Couldnt find door on MM');
Logout;
Exit;
End;
WaitR(10);
FindFastRandoms;
WaitR(10);
Flag;
WaitR(500+Random(400));
If(OpenTheDoor)Then
WriteIt('Door Opened');
FindFastRandoms;
WriteIt('At Stove');
End;
Function FindBankers: Boolean;
var
a: Extended;
Begin
DTMBankers := DTMFromString('78DA63EC676260086040017FFE30318800694' +
'620FE0F048C2035A1A86AEEDE6580AB0101C6E9403581B8CD0101' +
'00147B0C9E');
If(FindDTMRotated(DTMBankers,Dx,Dy,MMX1,MMY1,MMX2,MMY2,0,360,0.1, a))Then
Result:= True;
FreeDTM(DTMBankers);
End;
Procedure WalkToBank;
Begin
If(Not Loggedin)Then Exit;
FindNormalRandoms;
WriteIt('Walkting to bank');
If(OpenTheDoor)Then
Begin
Writeln('Door Opened');
WaitR(10);
RoadColor:= FindRoadColor;
RadialRoadWalk(RoadColor, 82, 110, 60, 0, 0);
WaitR(10);
If(FindBankers)Then
Begin
Mouse(DX-5, DY, 3, 3, True);
Flag;
WaitR(500+Random(300));
Exit;
End Else
Repeat
WaitR(500+Random(300));
RadialRoadWalk(RoadColor, 85, 122, 25, 0, 0);
WaitR(10);
If(FindBankers)Then
Begin
Mouse(DX-5, DY, 3, 3, True);
WaitR(10);
Flag;
WaitR(500+Random(300));
Break;
End Else
Begin
Writeln('Couldnt find bank');
Logout;
Break;
End;
Until(Not Loggedin);
End;
End;
Procedure Setup;
Begin
ClearDeBug;
Writeln('Successfully compiled');
SetupSRL;
DeclarePlayers;
ActivateClient;
Wait(500);
If(Not Loggedin)Then
LoginPlayer;
NickNameBMP:= CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
End;
Procedure AutoRetaliate(Act: Boolean);
Begin
Gametab(1);
If(FindColorTolerance(Dx,Dy,2106255, 580, 364, 715, 394, 10))Then
Begin
If(Not Act)Then
Mouse(657, 376, 30, 10, True)
End Else
Begin
If(act)Then
Mouse(657, 376, 30, 10, True)
End;
End;
Procedure InitPlayer;
Begin
Writeln( IntToStr(NickNameBMP) + ' Is Playing.');
CurrentLoad:= 0;
MakeCompass('n');
HighestAngle;
AutoRetaliate(False);
SetRun(True);
SetChat('Off',1);
SetChat('Off',2);
SetChat('Off',4);
SetChat('Off',3);
End;
Function EasyBank: Boolean;
Var
Mark: Integer;
Begin
If(Not LoggedIn)Then Exit;
Flag;
Marktime(Mark);
Repeat
If(TimeFromMark(Mark)>25000)And(Not FlagPresent)Then
Begin
Writeln('Couldnt Find Bank..');
Players[CurrentPlayer].Loc := 'Bank(Not Found)';
Logout;
Exit;
End;
WaitR(500)
If(OpenBankQuiet('eb'))Then
WaitR(1000+Random(1000));
Flag;
Until(BankScreen)or(PinScreen)or(Not LoggedIn)
Wait(500+Random(250));
If(PinScreen)Then
Begin
InPin(IntToStr(Players[CurrentPlayer].Pin));
Wait(500+Random(250));
End;
If(BankScreen)Then
Begin
FixBank;
Result := True;
End Else
Begin
Writeln('Couldnt Find bank.');
Players[CurrentPlayer].Loc := 'Bank(Not Found)';
Logout;
End;
End;
Procedure Deposit2(FromItem,ToItem: integer);
Var
I: Integer;
aPoint: TPoint;
Begin
I := Fromitem;
For I := FromItem To ToItem Do
Begin
If(ExistsItem(I))Then
Begin
aPoint := ItemCoords(i);
Mouse(aPoint.x+Random(8)-Random(8), aPoint.y+Random(8)-Random(8), 0, 0, False);
Wait(10);
Chooseoption('ore All');
Wait(300+Random(500));
End;
End;
End;
Function CountFishes(Color, Tol: Integer): Integer;
Var
Dx, Dy, I: Integer;
ItemTp: TPoint;
Begin
GameTab(4);
For I:= 1 To 28 Do
Begin
ItemTP:= ItemCoords(I);
If(FindColorTolerance(Dx,Dy,Color,ItemTP.X-10,ItemTP.Y-10,ItemTP.X+10,ItemTP.Y+10, Tol))Then
Result:= Result + 1;
End;
End;
Procedure DoTheMath;
Var
Cooked2, Burnt, Cooked: Integer;
Begin
Cooked:= CountFishes( CookedTrout, 0 );
Cooked2:= CountFishes( CookedSalmon, 0 );
Burnt:= CountFishes( Burnd, 5);
Trouts:= Trouts + Cooked;
Salmons:= Salmons + Cooked2;
Bank:= Bank + 1;
Burn:= Burn + Burnt;
Gained:= Gained + (Cooked * 50) + (Cooked2 * 70);
SRLRandomsReport;
End;
Procedure GetFish;
Var
X, Y: Integer;
Begin
If(BankScreen)Then
Begin
MMouse( 85, 69, 10, 10);
Wait(25)
If(IsUpText('Withdraw 1 Raw'))Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, False);
ChooseOption('Withdraw All');
WriteIt('Got Fishes!');
End Else
Begin
WriteIt('No More Fishes');
CloseBank
Logout;
End;
End Else
Begin
WriteIt('Not in bank ..');
Logout;
Exit;
End;
End;
Procedure HandleBanking;
Begin
If(Not Loggedin)Then Exit;
DoTheMath
Flag;
Wait(1000+random(1000));
If(EasyBank)Then
Begin
Players[CurrentPlayer].Loc := 'Bank';
Deposit2(1,28);
GetFish;
CurrentLoad:= CurrentLoad + 1;
If(Not Loggedin)Then Exit;
CloseBank;
MakeCompass('n');
End;
End;
Function FindFish: Boolean;
Var
Dx, Dy, I: Integer;
ItemTp: TPoint;
Begin
GameTab(4);
For I:= 1 To 28 Do
Begin
ItemTP:= ItemCoords(I);
If(FindColor(Dx,Dy,RawTrout,ItemTP.X-10,ItemTP.Y-10,ItemTP.X+10,ItemTP.Y+10))Or
(FindColor(Dx,Dy,RawSalmon,ItemTP.X-10,ItemTP.Y-10,ItemTP.X+10,ItemTP.Y+10))Then
Begin
Result:= True;
FishTP.X:= Dx;
FishTP.Y:= Dy;
Exit;
End;
End;
End;
Function FindClosestColorSpiral(Hx, Hy, Color, Tolerance: Integer): Boolean;
Var
ColorPoints: TPointArray;
X, Y, C, I: Integer;
Begin
FindColorsSpiralTolerance(x, y, ColorPoints, Color, MSX1, MSY1, MSX2, MSY2, Tolerance);
C:= 999999;
For I:= 0 To GetArrayLength(ColorPoints)-1 Do
Begin
If(Distance(MSX2 / 2, MSY2 / 2, ColorPoints[I].X, ColorPoints[I].Y)<=C)Then
Begin
C:= Distance(MSX2 / 2, MSY2 / 2, ColorPoints[I].X, ColorPoints[I].Y)
HX:= ColorPoints[I].X;
HY:= ColorPoints[I].Y;
Result:= True;
End;
End;
End;
Function FindStove: Boolean;
Var
X, Y: Integer;
StoveBoxes: TBoxArray;
Begin
Repeat
Wait(300+Random(300));
If(FindColorSkipBoxArrayTolerance(X, Y, 858759, MSX1, MSY1, MSX2, MSY2, 10, StoveBoxes))Then
Begin
MMouse(X, Y, 3, 4);
Wait(25);
If(IsUpText('Stove'))Then
Begin
Result:= True;
WriteIt('Found Stove');
End Else
Begin
GetMousePos(X, Y);
SetArrayLength(StoveBoxes, GetArrayLength(StoveBoxes)+1);
StoveBoxes[GetArrayLength(StoveBoxes)-1].X1:= X - 10;
StoveBoxes[GetArrayLength(StoveBoxes)-1].Y1:= Y - 10;
StoveBoxes[GetArrayLength(StoveBoxes)-1].X2:= X + 10;
StoveBoxes[GetArrayLength(StoveBoxes)-1].Y2:= Y + 10;
End;
End Else
Begin
Mouse(MMCX, MMCY + 10, 3, 3, True);
Flag;
If(FindFish)Then
Begin
Mouse(FishTP.X, FishTP.Y, 4, 4, True);
WaitR(300+random(500));
End;
End;
Until(Result)Or(GetArrayLength(StoveBoxes)-1 > 20);
End;
Function StartCook: Boolean;
Var
Fx, Fy: Integer;
Begin
If(Not Loggedin)Then Exit;
GameTab(4);
If(FindFish)Then
Begin
Mouse(FishTP.X, FishTP.Y, 4, 4, True);
WaitR(300+random(500));
If(FindStove)Then
Begin
GetMousePos(FX, FY);
Mouse(Fx, Fy, 3, 3, True);
WaitR(50)
Flag;
WaitR(1500+Random(1500));
Result:= True;
End;
End;
WaitR(10)
If(Result)Then
Begin
WaitR(10)
Result:= False;
If(FindColor(FX, FY, 128, 143, 365, 167, 375))Then
Begin
Mouse(234, 392, 50, 50, False);
Result:= ChooseOption('Cook All');
End;
WaitR(10)
End;
End;
{
********************************************************************************
function GetNewXP(Skill: String): Integer;
Description: Returns current xp for a skill.
By: Masquerader And Edited by JUKKA.
More Description:
Addded:
If(Not findcolor(x, y, 10551295, 554, 205, 743, 465))Then
MMouse(t.x, t.y + 12, 5, 5);
To make it more "humanlike"
Removed the writeln to exp thing, annoying for this script.
********************************************************************************
}
function GetNewXp(skill: string): Integer;
var
Failsafe, textx, texty, x1, y1, x2, y2, LeftCorner, RightCorner, len, x, y: Integer;
xp: string;
t: TPoint;
begin
LeftCorner := DTMFromString('78DA63346164603006622C0026CA684A841A9' +
'03926449883A6E6FFFF0598E60411614E100173406A8289703301' +
'3500C6560919');
RightCorner := DTMFromString('78DA635CC2C8C0100CC458004C947131916A8' +
'250D5FCFFBF0055CD124C3558CD3121600E488D3101739610A9C6' +
'04BF1A00F7DF0C91');
Result := -1;
GameTab(2);
t := skilltocoords(skill);
If(Not findcolor(x, y, 10551295, 554, 205, 743, 465))Then
MMouse(t.x, t.y + 12, 5, 5);
MarkTime(FailSafe);
repeat
wait(10);
If(TimeFromMark(FailSafe)>8000)Then
Break;
until findcolor(x, y, 10551295, 554, 205, 743, 465);
wait(300 + Random(100))
if ((FindDtm(LeftCorner, x1, y1, 554, 205, 743, 465)) and (FindDtm(RightCorner, x2, y2, 554, 205, 743, 465))) then
if (istextinareaex(x1, y1, x2, y2, textx, texty, 'XP', 0, smallchars, False, True, 0, 2, 0)) then
begin
len := (x2 - textx - 22) div 7
xp := Trim(gettextatex(textx + 22, texty, 5, smallchars, False, False, 0, 3, 0, len, False, tr_digits))
try
Result := StrToInt(xp);
except
WriteLn('Failed to get XP');
end;
//WriteLn(Skill + ' = ' + IntToStr(Result));
end;
freedtm(leftcorner);
freedtm(rightcorner);
end;
Function Cooking: Boolean;
Var
Cook, CExp, CCExp: Integer;
Begin
MarkTime(Cook);
Repeat
If(Not Loggedin)Then Break;
CExp:= GetNewXp('cooking');
If(WaitR(2000+Random(500)))Then Break;
CCExp:= GetNewXp('cooking');
If(CExp < CCExp)Then
Result:= True;
If(Result)Then
Status('Still Cooking') Else Status('Not Cooking');
Until(TimeFromMark(Cook)>20000+Random(10000))Or(Not Result);
End;
Procedure CookFood;
Begin
If(Not Loggedin)Then Exit;
If(StartCook)Then
Begin
WriteIt('Started Cooking');
Repeat
If(Not Cooking)Then
StartCook;
Until(Not FindFish)Or(Not Loggedin);
FindNormalRandoms;
WriteIt('Finnished Cooking');
Exit;
End Else
If(Not FindFish)Then
Begin
FindNormalRandoms;
WriteIt('Finnished Cooking');
Exit;
End;
End;
Procedure ProgressReport;
Begin
Writeln('');
Writeln(' -------------------------------------- ');
Writeln(' Worked: ' + TimeRunning + '');
Writeln(' Cooked: ' + IntToStr(Trouts)+' Trouts');
Writeln(' Cooked: ' + IntToStr(Salmons)+ ' Salmons');
Writeln(' Burnt : ' + IntToStr(Burn)+' Foods');
Writeln(' Banked: ' + IntToStr(Bank)+' Loads');
Writeln(' Gained: ' + IntToStr(Gained)+' Exp');
Writeln(' -------------------------------------- ');
End;
Begin
Setup;
Repeat
InitPlayer;
Repeat
WalkToStove;
CookFood;
WalkToBank;
HandleBanking;
ProgressReport;
Until(CurrentLoad >= LoadPerPlayer)Or(Not Loggedin);
If(Loggedin)Then
NextPlayer(True)
Else NextPlayer(False);
Until(False);
End.