SRL Archive - RS3 Script Requests

Rogues Den Cooker


Becks

2010-12-07 13:36:43

Rogues Den Cooker (or GE Cooker)

Fastest way to get your cooking exp up. I feel like this would be used by many of the here members.

Need a members account? PM me i'll provide.

Thanks -Becks

Becks

2010-12-26 03:45:47

anyone?

KingKong

2010-12-26 03:52:38

I can do it, if you want me to do it(or atleast i can try)

Capricorn

2010-12-26 03:57:36

I can make up a quick base using reflection if you want.

TomTuff

2010-12-26 05:53:46

I actually have one that i've been working on. It's a bit buggy, needs some refinement.


program RoguesDenCooker;
{$DEFINE SMART}
{$i SRL\SRL.scar}
{$i Reflection\Reflection.simba}
{$i SRL\SRL\misc\debug.scar}


const
sWorld = 35; //smart world
sSigned = True; //signed client
MinABWait = 5000;//minimum wait between performing antiban (in miliseconds)


procedure DeclarePlayers;
begin
HowManyPlayers := 1; //How many players will you be using?
NumberOfPlayers(HowManyPlayers); //Don't touch
CurrentPlayer := 0; //Which player to start off with?

with Players[0] do
begin
Name := ''; //rs username
Pass := ''; //rs pass
Nick := ''; //Nickname for progress report
Pin := ''; //Bank pin
Active := True; //use player?
Integers[0] := 5; //What food to cook? 0 = Trout, 1 = Salmon, 2 = Tuna, 3 = Lobster, 4 = Swordfish, 5 = Monkfish, 6 = shark, 7 = rocktail
Integers[1] := 0; //number of food to cook. estimated 1300 food per hour. leave at 0 to run until it breaks
Integers[2] := 0 * 60 * 1000; //change first number for minutes to run. leave at 0 to run until it breaks.
//For now, the above 2 settings are useless.
end;
end;
////////////////////////////setup ends here////////////////////////////////////

procedure SetupNewPlayer;
begin
case Players[CurrentPlayer].Integers[0] of
0: //Trout
begin
with Players[CurrentPlayer] do
begin
Strings[0] := 'mggAAAHicY2NgYLBnYmDwAmJHILYAYjMgNgXiMEYGBn8gjgLiGCAOhbKXL5gP1MWEgXkYsANGHBgCAASCBZI=';//Raw DTM
Strings[1] := 'mggAAAHicY2NgYMhiYmCIB+IEIM4E4lwgLgHiYEYGhjAgjgHiKCCOAGJ/IE6LigDqYsLAPAzYASMODAEAOpIFxg==';//Cooked DTM
Strings[2] := 'w tr';//Raw uptext
Strings[3] := 'Tro';//Cooked uptext
Strings[4] := 'Trout';//Fish name
Integers[3] := 70;//EXP
Integers[4] := 335; //Raw ID (For reflection)
Integers[5] := 333; //Cooked ID (For reflection)
end;
end;
1: //Salmon
begin
with Players[CurrentPlayer] do
begin
Strings[0] := 'mggAAAHicY2NgYOhlYmDoA+JOIF4AxFOYIGIRjAwMMYwQ2g+Io4A4CIhXTJ0E1MWEgbkYsANGHBgCAN+VB20=';//Raw DTM
Strings[1] := 'mbQAAAHicY2VgYDjAxMCwB4g3A/E+ID4OxEGMDAz+QBwFxQFAvN1aGqiaCQXzMGACRiwYDAA1VgaU';//Cooked DTM
Strings[2] := 'w sa';//Raw uptext
Strings[3] := 'Sal';//Cooked uptext
Strings[4] := 'Salmon';//Fish name
Integers[3] := 90;//EXP
Integers[4] := 331; //Raw ID (For reflection)
Integers[5] := 329; //Cooked ID (For reflection)
end;
end;
2: //Tuna
begin
with Players[CurrentPlayer] do
begin
Strings[0] := 'mggAAAHicY2NgYPBggmBHILYCYlMoXcrIwFAFxA1A3AjEdUBcAsTtTY1AXUwYmIcBO2DEgSEAADy2Bhs=';//Raw DTM
Strings[1] := 'mggAAAHicY2NgYEhjYmCIB+IUIC4C4kogzgbiMkYGhlogbgTiKkYIvwGIE0KDgbqYMDAPA3bAiANDAACKjQag';//Cooked DTM
Strings[2] := 'w tu';//Raw uptext
Strings[3] := 'Tun';//Cooked uptext
Strings[4] := 'Tuna';//Fish name
Integers[3] := 100;//EXP
Integers[4] := 359; //Raw ID (For reflection)
Integers[5] := 361; //Cooked ID (For reflection)
end;
end;
3: //Lobster
begin
with Players[CurrentPlayer] do
begin
Strings[0] := 'mggAAAHicY2NgYJjFxMDQC8SdTBD2PCDuAOIKRgaGWiAuAuImIC5jhIiFGkoBdTFhYB4G7IARB4YAANVHBxw=';//Raw DTM
Strings[1] := 'mggAAAHicY2NgYDjExMCwD4iPAPEJIN4OxJuAuIyRgaEWiJuAuAaIq4C4FIhXhEoAdTFhYB4G7IARB4YAAHMQCJ8=';//Cooked DTM
Strings[2] := 'w lo';//Raw uptext
Strings[3] := 'Lob';//Cooked uptext
Strings[4] := 'Lobster';//Fish name
Integers[3] := 120;//EXP
Integers[4] := 377; //Raw ID (For reflection)
Integers[5] := 379; //Cooked ID (For reflection)
end;
end;
4: //Swordfish
begin
with Players[CurrentPlayer] do
begin
Strings[0] := 'mlwAAAHicY2dgYLBiYmAwA2IPIA4AYmsg9oaKzWFkYFgMxDOheAoQTwbi+UC8YuoaoG4mrJiHATdgxIOhAABzowgg';//Raw DTM
Strings[1] := 'mlwAAAHicY2dgYMhjYmBIAeJkII4H4jggLgfiUiCezMjAMA2IZwHxQiBeCmXPA+Ly0DqgbiasmJUBN2DEg6EAANERCJ4=';//Cooked DTM
Strings[2] := 'w sw';//Raw uptext
Strings[3] := 'Swo';//Cooked uptext
Strings[4] := 'Swordfish';//Fish name
Integers[3] := 140;//EXP
Integers[4] := 371; //Raw ID (For reflection)
Integers[5] := 373; //Cooked ID (For reflection)
end;
end;
5: //Monkfish
begin
with Players[CurrentPlayer] do
begin
Strings[0] := 'mggAAAHicY2NgYFjGysCwAIhnAvFGIF4HxNOA+DFQ7iYQPwPiF0D8AIjvAXG0rRGQZMLAPAzYASMODAEA9bAKJw==';//Raw DTM
Strings[1] := 'mggAAAHicY2NgYNjNzMBwBohPAPFWIN4MxPuB2I6JgcEGiF2A2BWIbYHYA4hjgtyBupgwMA8DdsCIA0MAAPHMBzQ=';//Cooked DTM
Strings[2] := 'w mo';//Raw uptext
Strings[3] := 'Mon';//Cooked uptext
Strings[4] := 'Monkfish';//Fish name
Integers[3] := 150;//EXP
Integers[4] := 7944; //Raw ID (For reflection)
Integers[5] := 7946; //Cooked ID (For reflection)
end;
end;
6: //Shark
begin
with Players[CurrentPlayer] do
begin
Strings[0] := 'mggAAAHicY2NgYHBgYmDwAeIAIDYBYnMgtgbi3YwMDDuA+BgQH2WE8I8DcVNNDVAXEwbmYcAOGHFgCAAAz7IHsQ==';//Raw DTM
Strings[1] := 'mggAAAHicY2NgYMhhYmBIAOIkIC4D4iogLgDiXYwMDKeAeDsUHwfik0Ac7mQI1MWEgXkYsANGHBgCABNJCA8=';//Cooked DTM
Strings[2] := 'w sh';//Raw uptext
Strings[3] := 'Sha';//Cooked uptext
Strings[4] := 'Shark';//Fish name
Integers[3] := 210;//EXP
Integers[4] := 383; //Raw ID (For reflection)
Integers[5] := 385; //Cooked ID (For reflection)
end;
end;
7: //Rocktail
begin
with Players[CurrentPlayer] do
begin
Strings[0] := 'mlwAAAHicY2dgYJjIxMCwAIjnAvFMIJ4ExF1QvJ+RgWEnEB8E4uNAfAKIDwPxXiBOnrEeqJsJK+ZhwA0Y8WAoAAAEnQs7';//Raw DTM
Strings[1] := 'mggAAAHicY2NgYNjDxMBwEoj3A/FmIN4JxGdAfEYIPgXEh4F4FxRvT88B6mLCwDwM2AEjDgwBAC2nCro=';//Cooked DTM
Strings[2] := 'w ro';//Raw uptext
Strings[3] := 'Roc';//Cooked uptext
Strings[4] := 'Rocktail';//Fish name
Integers[3] := 225;//EXP
Integers[4] := 15270; //Raw ID (For reflection)
Integers[5] := 15272; //Cooked ID (For reflection)
end;
end;
end;
end;

var
ABMark: Integer;
procedure Antiban;
begin
if (not(LoggedIn) or (TimeFromMark(ABMark) < MinABWait)) then
Exit;
if (Random(9) > 0) then
begin
case Random(9) of
1: ExamineInv;
2: BoredHuman;
3: RandomMovement;
4: PickUpMouse;
5: HoverSkill('cooking', False);
6: RandomRClick;
7: PickUpMouse;
8: RandomAngle(1);
9: HoverSkill('cooking', False);
0: RandomRClick;
end;
MarkTime(ABMark);
end;
end;


const //Reflection constants
FireTileX = 3043;
FireTileY = 4973;


function r_OpenBenedict: Boolean;
var
Benedict: TNPC;
BenedictPoint: TPoint;
begin
repeat
Benedict := GetNPC('Emerald Benedict');
if not(TileOnMS(Benedict.Tile, 0)) then
WalkToTile(Benedict.Tile, 4, 0);
Benedict := GetNPC('Emerald Benedict');
until(TileOnMS(Benedict.Tile, 0));
BenedictPoint := TileToMS(Benedict.Tile, 0);
Mouse(BenedictPoint.x - 2, BenedictPoint.y - 2, 4, 4, False);
if (r_WaitOption('ank', 1200)) then
Result := WaitFunc(@BankScreen, 20 + Random(15), 4000);
end;


function OpenBenedict: Boolean;
var
CTS, x, y, i, H: Integer;
TPA: TPointArray;
ATPA: array of TPointArray;
R: Boolean;
begin
if not(LoggedIn) then
Exit;
if BankScreen then
begin
Result := True;
Exit;
end;
CTS := GetColorToleranceSpeed;
SetColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.01374, 1.69810);
FindColorsTolerance(TPA, 7444680, MSX1, MSY1, MSX2, MSY2, 4);
SetColorToleranceSpeed(CTS);
DebugTPA(TPA, '');
if (Length(TPA) > 0) then
begin
ATPA := TPAtoATPAEx(TPA, 20, 30);
SortATPAFromFirstPoint(ATPA, IntToPoint(MSCX, MSCY));
DebugATPABounds(ATPA);
H := High(ATPA);
for i := 0 to H do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x - 3, y - 3, 6, 6);
if WaitUptext('ened', 1600) then
begin
ClickMouse2(False);
Result := WaitOption('ank', 1600);
end;
if Result then
Break;
end;
Result := WaitFunc(@BankScreen, 20 + Random(15), 4000);
end else
begin
R := True;
Result := r_OpenBenedict;
end;
if (not(R) and not(Result)) then
Result := r_OpenBenedict;
if Result then
Wait(1800 + Random(240));
end;


function r_CountRaws: Integer;
begin
Result := R_CountItemID(Players[CurrentPlayer].Integers[4]);
end;


function CountRaws: Integer;
var
RawDTM: Integer;
begin
if not(LoggedIn) then
Exit;
RawDTM := DTMFromString(Players[CurrentPlayer].Strings[0]);
Result := CountItems('dtm', RawDTM, []);
FreeDTM(RawDTM);
end;


function r_CountCooked: Integer;
begin
Result := R_CountItemID(Players[CurrentPlayer].Integers[5])
end;


function CountCooked: Integer;
var
CookedDTM: Integer;
begin
if not(LoggedIn) then
Exit;
CookedDTM := DTMFromString(Players[CurrentPlayer].Strings[1]);
Result := CountItems('dtm', CookedDTM, []);
FreeDTM(CookedDTM);
if (Result < 1) then
Result := r_CountCooked;
end;


function DoBank: Boolean; //no reflection backup, if someone wants to teach me interfaces then yay.
var
RawDTM, x, y, M: Integer;
begin
if (not(LoggedIn) or not(BankScreen)) then
Exit;
if Players[CurrentPlayer].Booleans[0] then //Booleans[0] = first run.
begin
IncEx(Players[CurrentPlayer].Integers[10], CountCooked);
end else
Players[CurrentPlayer].Booleans[0] := True;
DepositAll;
RawDTM := DTMFromString(Players[CurrentPlayer].Strings[0]);
if FindDTM(RawDTM, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
MMouse(x - 3, y - 3, 6, 6);
if WaitUptext(Players[CurrentPlayer].Strings[2], 1600) then
begin
ClickMouse2(False);
WaitOption('raw-A', 1600);
end;
end else
Writeln('could not find raw food DTM in bank!');
Closebank;
M := GetSystemTime + 4000;
while (GetSystemTime < M) do
begin
if (not(BankScreen)) then
begin
Result := True;
Break
end;
Wait(10 + Random(25));
end;
FreeDTM(RawDTM);
if Result then
begin
Inc(Players[CurrentPlayer].Banked);
if Players[CurrentPlayer].Booleans[1] then //Booleans[1] = first run.
begin
IncEx(Players[CurrentPlayer].Integers[11], CountRaws);
end else
Players[CurrentPlayer].Booleans[1] := True;
end;
end;


function ClickRaw: Boolean; //no reflection backup, if someone wants to teach me interfaces then yay.
var
RawDTM, x, y: Integer;
begin
if not(LoggedIn) then
Exit;
RawDTM := DTMFromString(Players[CurrentPlayer].Strings[0]);
if FindDTM(RawDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
MMouse(x - 4, y - 4, 8, 8);
if WaitUptext(Players[CurrentPlayer].Strings[2], 1600) then
begin
ClickMouse2(True);
Wait(300 + Random(35));
Result := (ActivatedItem > 0);
end;
end else
Writeln('could not find raw food DTM in inventory!');
FreeDTM(RawDTM);
end;


function r_ClickFire: Boolean;
var
FireTile: TTile;
FirePoint: TPoint;
begin
if not(LoggedIn) then
Exit;
FireTile := Tile(FireTileX, FireTileY);
if not(TileOnMS(FireTile, 0)) then
WalkToTile(FireTile, 3, 0);
FirePoint := TileToMS(FireTile, 0);
Mouse(FirePoint.x - 3, FirePoint.y - 3, 6, 6, false);
Result := r_WaitOption('> Fi', 1200);
end;


function ActionScreen: Boolean;
begin
Result := (CountColorTolerance(4477273, 85, 415, 95, 425, 10) > 65);
end;


function ClickFire: Boolean;
var
CTS, x, y, i, H: Integer;
TPA: TPointArray;
ATPA: array of TPointArray;
R: Boolean;
begin
if not(LoggedIn) then
Exit;
CTS := GetColorToleranceSpeed;
SetColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.10167, 1.61841);
FindColorsTolerance(TPA, 2730226, MSX1, MSY1, MSX2, MSY2, 5);
SetColorToleranceSpeed(CTS);
//Writeln(Length(TPA));
if (Length(TPA) > 0) then
begin
ATPA := TPAtoATPAEx(TPA, 30, 30);
DebugATPABounds(ATPA);
SortATPAFromFirstPoint(ATPA, IntToPoint(MSCX, MSCY));
H := High(ATPA);
for i := 0 to H do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x - 2, y - 2, 4, 4);
if WaitUptext('more', 800) then //there's always so many people, i'm just gonna check for "more" in "XX more options"
begin
ClickMouse2(False);
Result := WaitOption('> Fire', 1600); //
end;
if Result then
Break;
end;
end else
begin
R := True;
Result := r_ClickFire;
end;
if (not(R) and not(Result)) then
Result := r_ClickFire;
if Result then
Result := WaitFunc(@ActionScreen, 10 + random(15), 7000);
end;


function OutlineFound: Boolean;
begin
Result := (CountColorTolerance(10408935, 215, 387, 302, 400, 80) > 60);
end;


function ClickButton: Boolean;
var
CookedDTM, x, y: Integer;
begin
if not(LoggedIn) then
Exit;
Result := False;
R_FindRandoms;
CookedDTM := DTMFromString(Players[CurrentPlayer].Strings[0]);
if not(FindDTM(CookedDTM, x, y, MCX1, MCY1, MCX2, MCY2)) then
begin
FreeDTM(CookedDTM);
Exit;
end;
FreeDTM(CookedDTM);
MMouse(x - 4, y - 4, 8 , 8);
if (WaitFunc(@OutlineFound, 10 + Random(15), 8000)) then
begin
ClickMouse2(True);
Result := True;
end else
Writeln('didnt find the outline');
end;


function WaitCook: Boolean;
var
T, CookedDTM, RawCount: Integer;
begin
RawCount := CountRaws;
MarkTime(T); //68 seconds = one inventory (4 game ticks (.6 seconds) per cook * 28 = 67.2 seconds
while (TimeFromMark(T) < 68000 + Random(680)) do
begin
R_FindRandoms;
Antiban;
if LevelUp then
Inc(Players[CurrentPlayer].Integers[12]);
Wait(850 + Random(85));
end;
CookedDTM := DTMFromString(Players[CurrentPlayer].Strings[1]);
Result := (CountItems('dtm', CookedDTM, []) > 0); //randoms are a bitch.
FreeDTM(CookedDTM);
end;


procedure Die(Status: string);
begin
if not(LoggedIn) then
Exit;
if BankScreen then
CloseBank;
Logout;
Players[CurrentPlayer].Status := Status;
Writeln('Death because: ' + Players[CurrentPlayer].Status);
end;


procedure Report;
var
TotalCooked, Totalburnt, TotalXP, i: Integer;
xpHR, fishHR, bankHR: Int64;
begin
for i := 0 to High(Players) do
begin
IncEx(TotalCooked, Players[i].Integers[11]);
IncEx(TotalBurnt, Players[i].Integers[11] - Players[i].Integers[10]);
IncEx(TotalXP, Players[i].Integers[11] * Players[i].Integers[3]);
end; {123456789|123456789|123456789|123456789|123456789|123456789|12345678}
Writeln('');
Writeln('[====================================================================]');
Writeln('[ TomTuff''s Rogue''s Den Cooker ]'); //2 extra spaces from ''s
Writeln('[ Revision 01 ]');
Writeln('[====================================================================]');
Writeln('[ Overall Report ]');
Writeln('[ Ran for: ' + Padr(MsToTime(GetTimeRunning, Time_Formal), 55) + ']');
Writeln('[ Total fish cooked: ' + Padr(IntToStr(TotalCooked), 45) + ']');
Writeln('[ Total food burnt: ' + Padr(IntToStr(Totalburnt), 46) + ']');
Writeln('[ Exp gained: ' + Padr(IntToStr(TotalXP), 52) + ']');
Writeln('[====================================================================]');
for i := 0 to High(Players) do
begin
Writeln('[ Player ' + Padl(IntToStr(i), 2) + ': ' + Padr('', 55) + ']');
Writeln('[ Worked: ' + Padr(MSToTime(PlayerWorked(i), Time_Formal), 56) + ']');
Writeln('[ Type of food: ' + Padr(Players[i].Strings[4], 50) + ']');
if ((Players[i].Status <> '') and (not(Players[i].Active))) then
Writeln('[ Stopped Because: ' + Padr(Players[i].Status, 47) + ']');
Writeln('[ Exp gained: ' + Padr(Int64ToStr(Players[i].Integers[3] * Players[i].Integers[10]), 52) + ']');
xpHR := Ceil((Players[i].Integers[11] * Players[i].Integers[3] * 60 * 60 * 1000.0) / PlayerWorked(i));
Writeln('[ Exp/HR: ' + Padr(ToStr(xpHR), 56) + ']');
Writeln('[ Total food cooked: ' + Padr(IntToStr(Players[CurrentPlayer].Integers[11]), 45) + ']');
Writeln('[ Food cooked: ' + Padr(IntToStr(Players[CurrentPlayer].Integers[11]), 49) + ']');
Writeln('[ Food burnt: ' + Padr(IntToStr(Players[i].Integers[11] - Players[i].Integers[10]), 50) + ']');
Writeln('[ Levels gained: ' + Padr(IntToStr(Players[CurrentPlayer].Integers[12]), 49) + ']');
Writeln('[ Banked: ' + padl(Int64ToStr(Players[CurrentPlayer].Banked), 3) + ' Times' + Padr('', 47) + ']');
fishHR := Ceil(((Players[i].Integers[10]) * 60 * 60 * 1000.0) / PlayerWorked(i));
bankHR := Ceil(fishHr/28.0);
Writeln('[ Fish/HR: ' + Padr(Int64ToStr(fishHR), 53) + ']');
Writeln('[ Loads/HR: ' + Padr(Int64ToStr(bankHR), 52) + ']');
Writeln('[====================================================================]');
Writeln('');
end;
end;


begin
Smart_Members := True;
Smart_Server := sWorld;
Smart_Signed := sSigned;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
repeat
SetupNewPlayer;
SetAngle(True);
repeat
if OpenBenedict then
begin
if DoBank then
begin
if ClickRaw then
begin
if ClickFire then
begin
if ClickButton then
begin
if WaitCook then
begin
Report;
end else Die('could not wait to cook');
end else Die('could not click the cooking button');
end else Die('could not click the fire');
end else Die('could not click raw in inventory');
end else Die('could not handle banking');
end else Die('could not open Benedict');
Report;
until(not(LoggedIn));
NextPlayer(False);
until(AllPlayersInactive);
Report;
end.

KingKong

2010-12-26 06:04:54

Wouldn' it be a heck of lot of easier if you used record/types(whichever its called) to put all the info for the fishies in?

TomTuff

2010-12-26 12:32:33

From: kongking
Wouldn' it be a heck of lot of easier if you used record/types(whichever its called) to put all the info for the fishies in?


No?

**BANNED The Man

2010-12-26 12:43:33

From: kongking
Wouldn' it be a heck of lot of easier if you used record/types(whichever its called) to put all the info for the fishies in?


It would be more readable yes but no easier.
TomTuff, if you come on IRC or MSN, I can tell you about Ref banking…

-Boom

TomTuff

2010-12-26 12:52:09

From: Dynamite
It would be more readable yes but no easier.
TomTuff, if you come on IRC or MSN, I can tell you about Ref banking…

-Boom


I know reflection, I prefer color.

**BANNED The Man

2010-12-26 12:59:09

From: TomTuff
I know reflection, I prefer color.


Oh only cause it says in your script that there isn't a Ref backup because you don't know interfaces or something.
:)

-Boom

TomTuff

2010-12-26 13:08:34

From: Dynamite
Oh only cause it says in your script that there isn't a Ref backup because you don't know interfaces or something.
:)

-Boom


Thought you meant opening the bank lol

Becks

2010-12-26 14:40:54

Ah Thanks TomTuff

Stopped Because: could not click raw in inventory

Bugs:
Okay if the Banker is to far from the fire it clicks the lob then clicks to walk to the fire. un-selecting the lob and then clicks fire therefor cooking fails because it hasn't chose anything to cook. Then it logs out.

Sometimes there is lag when withdrawing and it will logout right away, a little wait would do good there.
I inserted Wait(500 + Random(55)); at the end of the Do Bank function it has seemed to do the trick.

Failsafes would be epic.