SRL Archive - RS3 Outdated / Broken Scripts

Al-Kharid Cooking


footballjds

2013-12-11 17:29:02

Al-Kharid cooker

Follow this guide to setup RuneScape for botting

This script only supports one-item cooking at the moment.(default option must also be 'use')

If this script gets heavy use I'll add progress reporting and make it more AIO.

There is no failsafe for running out of supplies so, bot smart.

You must place the cook_spot.png in the correct location.

Get the script:

The Mayor

2013-12-11 17:35:01

Nice, you're pushing out quite a few scripts lately. The RS3 scripts section will be full in no time!

footballjds

2013-12-11 17:43:52

From: The Mayor
Nice, you're pushing out quite a few scripts lately. The RS3 scripts section will be full in no time!


ehh, none of em are really getting used, so they'll die sooner or later

Hoodz

2013-12-11 17:46:26

Gz on release! Next: slayer? Since you are posting so many scripts right now.

bonsai

2013-12-11 19:04:37

From: footballjds

[RANT]
local_var_TPA := global_var_TPA;
invertTPA(local_var_TPA);

global_var_TPA gets inverted as well!!!
[/RANT]


Yeah, someone mentioned recently assigning arrays to each other like that is like assigning pointers, it does not make a copy.


local_var_TPA := global_var_TPA.copy();
invertTPA(local_var_TPA);

Thanatos

2013-12-11 19:15:06

I plan on using your fisher and this. Right now I'm gradually getting all my skills to 99 and fishing and cooking are two of them. So thank you very much my good sir.

As for usage, people jump to Ashamans scripts since he's so fancy. Take him out and you'll win :)

footballjds

2013-12-12 09:33:26

From: bonsai
Yeah, someone mentioned recently assigning arrays to each other like that is like assigning pointers, it does not make a copy.


local_var_TPA := global_var_TPA.copy();
invertTPA(local_var_TPA);


it may have been Kevin and I if you're referring to a convo that happened in SRL SKYPE.

From: Thanatos
I plan on using your fisher and this. Right now I'm gradually getting all my skills to 99 and fishing and cooking are two of them. So thank you very much my good sir.

As for usage, people jump to Ashamans scripts since he's so fancy. Take him out and you'll win :)


Ashaman is cool, I wouldn't dream of taking a part of the community out. That being said, I want more people HERE. So I'll continue to make scripts that will get used.

Max

2013-12-15 02:29:34

Will test thanks

Ian

2013-12-18 13:35:38

@footballjds; I think you forgot to include the SPS map.

footballjds

2013-12-18 14:36:49

From: BMWxi
@footballjds; I think you forgot to include the SPS map.


thanks!

haha, so much for that guy "testing it" ;)

lersner

2013-12-23 17:39:56

From: footballjds
ehh, none of em are really getting used, so they'll die sooner or later


Maybe you could spend more time on writing the thread like adding the functions, add requirements etc. So it looks more attracting

whitevans1

2014-01-04 22:07:16

I am using your script when i am cooking sharks it goes to the range. It will open it up and then hover over the shark icon instead of selecting the cook button.

footballjds

2014-01-05 12:01:03

From: whitevans1
I am using your script when i am cooking sharks it goes to the range. It will open it up and then hover over the shark icon instead of selecting the cook button.


that is weird.

So it never cooks?

whitevans1

2014-01-05 16:31:50

Nope just kinda lags out at the cooking spot.

Looks like I was just having trouble with sharks. lobs are doing fine.

ardentboy28

2014-01-28 18:41:34

When I am using lobster, the bot uses lobster on the range, but it just hovers around and says "failed to find any text matches".

whitevans1

2014-01-29 23:59:30

From: ardentboy28
When I am using lobster, the bot uses lobster on the range, but it just hovers around and says "failed to find any text matches".


It works fine for me with sharks and rocktail. Make sure you are using the old school layout and all that good stuff!

Oh I forgot… I changed line 4 in the code to
{$i sps/lib/sps-rs3.simba}

Unreal

2014-01-30 23:50:00

when im trying to cook lobsters it seems it doesn't click on the cook button

rzerox

2014-01-31 01:13:59

From: Unreal
when im trying to cook lobsters it seems it doesn't click on the cook button

Are you running Old School Layout otherwise post the debug of whats happening so the developer of the script can assist you with this.

MuffinMan

2014-02-04 09:41:05

Exception in Script: File "sps/sps-rs3.simba" not found at line 4, column 5

footballjds

2014-02-04 10:54:41

From: MuffinMan
Exception in Script: File "sps/sps-rs3.simba" not found at line 4, column 5


oh no, script needs updated

Thanatos

2014-02-04 11:41:16

From: MuffinMan
Exception in Script: File "sps/sps-rs3.simba" not found at line 4, column 5


You can find the fix to your problem if you look through what other users have posted.

seniorjulio

2014-02-04 11:45:02

ok yeah first {sps/sps-rs3.simba} needs to be {$I SPS/lib/SPS-RS3.Simba} at line 4. second i am having the same problem as alot of people on here. It does everything perfectly up until it has to click on the cook button after clicking on range.(i am using lobbies) my error message is:
—- Options found: [Use Raw lobster -> Range, Examine Range, Cancel]
—- Found option "-> Range" in "Use Raw lobster -> Range" %clicks the lobbies with the range fine
– chooseOption.select() result = true
—- Waiting while the player is moving…
– chooseOption._select(): %here's where i think the trouble is happening
—- chooseOption.isOpen(): result = true
—- Options found: [Cancel]
—— chooseOption.close(): Succesfully closed the menu %fails and exits the menu
—- Failed to find any text matches
– ChooseOption._select() result = false
– cook_walk.getPlayerPos(): result = {X = 90, Y = 98}, took 47 ms %then walks back to bank
– cook_walk.getPlayerPos(): result = {X = 90, Y = 98}, took 32 ms

I think the problem area with the script is somewhere right after line 127, Im not very good with java code so I'm afraid to manually change it. Any fixes or help please??

footballjds

2014-02-04 11:53:58

From: seniorjulio
ok yeah first {sps/sps-rs3.simba} needs to be {$I SPS/lib/SPS-RS3.Simba} at line 4. second i am having the same problem as alot of people on here. It does everything perfectly up until it has to click on the cook button after clicking on range.(i am using lobbies) my error message is:
—- Options found: [Use Raw lobster -> Range, Examine Range, Cancel]
—- Found option "-> Range" in "Use Raw lobster -> Range" %clicks the lobbies with the range fine
– chooseOption.select() result = true
—- Waiting while the player is moving…
– chooseOption._select(): %here's where i think the trouble is happening
—- chooseOption.isOpen(): result = true
—- Options found: [Cancel]
—— chooseOption.close(): Succesfully closed the menu %fails and exits the menu
—- Failed to find any text matches
– ChooseOption._select() result = false
– cook_walk.getPlayerPos(): result = {X = 90, Y = 98}, took 47 ms %then walks back to bank
– cook_walk.getPlayerPos(): result = {X = 90, Y = 98}, took 32 ms

I think the problem area with the script is somewhere right after line 127, Im not very good with java code so I'm afraid to manually change it. Any fixes or help please??


i'll fix these issues now

footballjds

2014-02-04 13:58:43

updated and added ability to use directX plugin.

script tested and worked fine for me for a few runs.

ardentboy28

2014-02-05 03:08:50

I am using lobsters, and the script fails to click the button "cook" after it uses my lobster on the range.

I think line 127

if productionScreen.isOpen then exit(productionScreen.clickStart);


is not working. I think the script never enters that line.

footballjds

2014-02-05 08:18:17

From: ardentboy28
I am using lobsters, and the script fails to click the button "cook" after it uses my lobster on the range.

I think line 127

if productionScreen.isOpen then exit(productionScreen.clickStart);


is not working. I think the script never enters that line.


get teamviewer and PM me your info. Is think your graphics settings are off.

MuffinMan

2014-02-05 12:35:44

Fixed the problem but nothing happens after i load up it, I enabled SMART but nothing happens :S

footballjds

2014-02-05 12:58:47

From: MuffinMan
Fixed the problem but nothing happens after i load up it, I enabled SMART but nothing happens :S


runescape isn't setup correctly…

ardentboy28

2014-02-05 13:31:26

I followed the graphics setup exactly as written here

http://villavu.com/forum/showthread.php?t=107365

and tried the script with both lobster and tuna, but it is not working.

My SPS and SRL are both updated to the latest version.

Maybe, it is because I disabled use_directx? I disabled it because when i enable, the screen keeps flickering.
or do I have to do something about the <rant> thingy?

but still, thank you for kindly answering my questions.

footballjds

2014-02-05 13:33:29

From: ardentboy28
I followed the graphics setup exactly as written here

http://villavu.com/forum/showthread.php?t=107365

and tried the script with both lobster and tuna, but it is not working.

Maybe, it is because I disabled use_directx? I disabled it because when i enable, the screen keeps flickering.
or do I have to do something about the <rant> thingy?

but still, thank you for kindly answering my questions.


i suggest using directX but if you wwant to you'll need to open runescape in a browser and switch to directX first.

ardentboy28

2014-02-05 13:41:58

I just sent you a PM

footballjds

2014-02-05 13:49:56

From: ardentboy28
I just sent you a PM


Glad we got everything straightened out.

I locked ardentboy's interface layout.
I reset it to old-school even though it already was.
I drug the "subscribe" button off of the mainscreen onto the chat box so it'd be out of the way.

The script is now fully functional. If anyone ever wants teamviewer help don't hesitate to ask.

ardentboy28

2014-02-05 13:50:54

WORKING FLAWLESSLY

footballjds is amazingly kind and actually used teamviewer to help me fix the problem.

(make sure you lock the interface)

Thanks!!!

footballjds

2014-02-05 22:29:59

the latest version of the script is up. I'm using github now so make sure you always check for the latest!

Kampf Gewehr

2014-02-12 14:58:39

Okay DirectX didn't work for me, d3d9.dll didn't function correctly. Set it up to use OpenGL instead, runs fine, except… walks to the furnace to cook, right clicks, then waits a moment, neglects to actually select "cook", and then walks to the bank, dumps the raw fish in the bank, and heads back to the furnace with another raw load, and brings them back just the way they came. Not sure how to fix this.

footballjds

2014-02-12 15:51:07

From: Kampf Gewehr
Okay DirectX didn't work for me, d3d9.dll didn't function correctly. Set it up to use OpenGL instead, runs fine, except… walks to the furnace to cook, right clicks, then waits a moment, neglects to actually select "cook", and then walks to the bank, dumps the raw fish in the bank, and heads back to the furnace with another raw load, and brings them back just the way they came. Not sure how to fix this.


resolved your setup issues over teamviewer.

Kampf Gewehr

2014-02-12 15:55:49

From: footballjds
resolved your setup issues over teamviewer.


You're the man!

Kampf Gewehr

2014-02-17 14:08:23

From: ardentboy28
I followed the graphics setup exactly as written here

http://villavu.com/forum/showthread.php?t=107365

and tried the script with both lobster and tuna, but it is not working.

My SPS and SRL are both updated to the latest version.

Maybe, it is because I disabled use_directx? I disabled it because when i enable, the screen keeps flickering.
or do I have to do something about the <rant> thingy?

but still, thank you for kindly answering my questions.


Hey, try the DirectX plugin found here http://villavu.com/forum/showthread....light=d3d9.dll

ardentboy28

2014-03-24 01:03:57

This script fails to cook again. I think this happened after the graphics update a few weeks ago.

Kampf Gewehr

2014-03-26 21:07:31

From: ardentboy28
This script fails to cook again. I think this happened after the graphics update a few weeks ago.


Yeah it's been out of commission for more than a month now. Shame too, there aren't any other F2P cookers out there. Hopefully football gets a chance to update this sometime. I've got 150k fish from 99 fishing that have been stinking up my bank.

killercrashy

2014-04-06 11:11:48

After some tweaking I managed to fix the script - the range colour needed an update. I know I played with some timings to make it more human-like; however, I forgot if it is this version.

program cooking;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I sps/lib/sps-rs3.simba}

var
_totalEXP, food_cooked, food_burnt: integer;
cook_walk: TSPSArea;
paths: T2DPointArray;

const
USE_DirectX = false;

procedure declarePlayers;
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
bankPin := '';
password := '';
integers[0] := 1;//slot containing food to cook
extendeds[0]:= 120;//exp per item
isActive := true;
isMember := false;
world := -1;
end;
currentPlayer := 0;
end;

procedure initPaths;
begin
cook_walk.setup('cook_spot', '', __DEFAULT_ACCURACY, __DEFAULT_TOLERANCE, 0.7);
setLength(paths, 3);
//to bank
paths[0] := [Point(90, 164), Point(94, 171), Point(102, 178), Point(114, 173), Point(117, 159), Point(119, 141), Point(114, 119), Point(110, 107), Point(95, 104)];

//to the north dock
paths[1] := [Point(97, 166), Point(97, 173), Point(98, 179), Point(123, 180), Point(126, 152), Point(114, 136), Point(112, 116), Point(98, 106)];

//to the south dock
paths[2] := [Point(94, 166), Point(118, 162), Point(118, 144), Point(104, 124), Point(97, 109), Point(94, 104)];
end;

function location: TPoint;
var
places: TPointArray;
bankD, rangeD: integer;
begin
result := cook_walk.getPlayerPos;
players[currentPlayer].location := '';
if result.equals([-1, -1]) then exit;

rangeD := distance(result, Point(95, 104));
bankD := distance(result, Point(90, 164));

if (rangeD < 15) then players[currentPlayer].location := 'range' else
if (bankD < 15) then players[currentPlayer].location := 'bank';
status(players[currentPlayer].location);
end;

function walk(bank: boolean): boolean;
var
our_path: TPointArray;
ourPos: TPoint;
threshold: integer;
n: integer;
begin
ourPos := location;
if ourPos.equals([-1, -1]) then exit;

our_path := paths[random(length(paths))].copy;
if bank then invertTPA(our_path);

threshold := getSystemTime + randomRange(45000, 65000);
repeat
if cook_walk.walkPath(our_path) then minimap.waitPlayerMoving();
wait(randomRange(250, 500));
ourPos := location;
until ((distance(our_path[high(our_path)], ourPos) < 12)) or (getSystemTime > threshold);
result := (threshold > getSystemTime);
end;

//this function returns the closest point in the array to the center of the arra
function TPointArray.centerPoint(): TPoint;
var
tmpArray: TPointArray;
begin
if length(self) < 1 then exit;
tmpArray := self;
tmpArray.sortFromPoint(self.getMiddle);
result := tmpArray[0];
end;


//This just ensures that the option window gets closed
function TRSChooseOption.close2(): boolean;
var
t: integer;
begin
t := getSystemTime + randomRange(2000,3000);
while (t > getSystemTime) do if self.isOpen then self.close else exit(true);
end;

//This function will find all colors close to the range color and split them into
//TPA's by width and height, a use range function will call this one
function findRange: T2DPointArray;
var
rangeTPA: TPointArray;
begin
if findColorsTolerance(rangeTPA, 4146611, mainscreen.getBounds, 4, colorSetting(2, 0.06, 0.53)) then
result := rangeTPA.toATPA(15, 15);
sortATPAFromMidPoint(result, mainscreen.playerPoint);
end;

function useRange: boolean;
var
range: T2DPointArray;
pont: TPoint;
i, h, timer: integer;
begin
range := findRange;
if (length(range) < 1) then exit;
h := high(range);
for i := 0 to h do
begin
if productionScreen.isOpen then exit(productionScreen.clickStart);
if (length(range[i]) < 5) then continue;
pont := range[i].centerPoint;
mouse(pont.rand(-3, 3), Mouse_Right, Mouse_Human);
if chooseOption.select(['-> Range'], randomRange(1000, 4000)) then
begin
minimap.waitPlayerMoving();
timer := getSystemTime + randomRange(3000, 6000);
repeat
wait(randomRange(100, 400));
until (productionScreen.isOpen) or (getSystemTime > timer);
end;
end else chooseOption.close2;
end;

function doneButton: boolean;
var
bluePoints: TPointArray;
blueArea: TBox;
begin
blueArea := [244,197, 335, 223];
findColorsTolerance(bluePoints, 13278759, blueArea, 44);
result := length(bluePoints) > 145;
end;

procedure whileCooking;
var
blkCount: TPointArray;
count, threshold: integer;
begin
threshold := getSystemTime + randomRange(70000, 80000);
repeat
wait(randomRange(255, 555));
if doneButton then
begin
threshold := getSystemTime + randomRange(2500, 3500);
repeat
wait(randomRange(255, 555));
if not(doneButton) then exit;
until (getSystemTime > threshold);
end;
until (getSystemTime > threshold);
end;

//This function will find all colors close to the banker color and split them into
//TPA's by width and height, a use bank function will call this one
function findBankers: T2DPointArray;
var
bankerTPA: TPointArray;
begin
if findColorsTolerance(bankerTPA, 2450798, mainscreen.getBounds, 14, colorSetting(2, 0.09, 1.31)) then
result := bankerTPA.toATPA(15, 15);
sortATPAFromMidPoint(result, mainscreen.playerPoint);
end;

function useBank: boolean;
var
bankers: T2DPointArray;
pont: TPoint;
i, h, timer: integer;
begin
bankers := findBankers;
if (length(bankers) < 1) then exit;
h := high(bankers);
for i := 0 to h do
begin
if (length(bankers[i]) < 5) then continue;
pont := bankers[i].centerPoint;
mouse(pont.rand(-3, 3), Mouse_Right, Mouse_Human);
if chooseOption.select(['Bank Banker', 'Bank Bank', 'nk Banker'], randomRange(1000, 4000)) then
begin
minimap.waitPlayerMoving();
timer := getSystemTime + randomRange(3000, 6000);
repeat
wait(randomRange(100, 400));
until (bankscreen.isOpen) or (pinscreen.isOpen) or (getSystemTime > timer);
if pinscreen.isOpen then pinScreen.enter(players[currentPlayer].bankPin);
if bankscreen.isOpen then exit(true);
end else chooseOption.close2;
end;
end;

function cook_count: TPoint
var
i, invcount, x, y: integer;
clrFound: boolean;
begin
tabBackpack.open;
invcount := tabBackpack.count;
clrFound := findColor(x, y, 65535, tabBackpack.getBounds);
case invcount of
0: result := [0, 0];
1..27: result := [invcount-1, 29-invcount];
28: if clrFound then result := [27, 1] else result := [28, 0];
end;
end;

procedure printProgress;
var
secondsElapsed, expPHour, totalEXP: extended;
food: TPoint;
begin
food := cook_count;

food_cooked := food_cooked + food.x;
food_burnt := food_burnt + food.y;

totalEXP := food_cooked * players[currentPlayer].extendeds[0];
secondsElapsed := (getTimeRunning/1000);
expPHour := (totalEXP * 60 * 60) / secondsElapsed;

smartImage.clearArea(intToBox(576, 200, 798, 278));
smartImage.drawBox(intToBox(576, 200, 798, 278), true, 7890014);

smartImage.DrawText('Run Time: ' + msToTime(GetTimeRunning, TIME_SHORT), Point(618, 224), upchars, false, 1376386);
smartImage.DrawText('EXP/Hour: ' + toString(round(expPHour)), Point(618, 234), upchars, false, 1376386);
smartImage.DrawText('Total EXP: ' + toString(totalEXP), Point(618, 244), upchars, false, 1376386);
smartImage.DrawText('Items cooked: ' + toString(food_cooked), Point(618, 254), upchars, false, 1376386);
smartImage.DrawText('Items burnt: ' + toString(food_burnt), Point(618, 264), upchars, false, 1376386);
end;

function handleBanking: boolean;
begin
printProgress;
if waitFunc(@useBank, 100, randomRange(20000,30000)) then
begin
bankscreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
if bankscreen.withdraw(players[currentPlayer].integers[0], WITHDRAW_AMOUNT_ALL_BUT_ONE, ['']) then
result := bankscreen.close;
end;
end;

procedure prepareSelf;
begin
wait(random(500, 1500));
minimap.clickCompass;
wait(random(500, 1500));
mainscreen.setAngle(MS_ANGLE_HIGH);
wait(random(1, 1500));
end;

procedure mainLoop;
var
loc: TPoint;
begin

if not isLoggedIn then
begin
print('We''re not logged in. respawning client.');
wait(randomRange(5000, 10000));
smartReloadClient((5 * 60000) + random(15000));

if (waitClientReady()) then
begin
print('Client succesfully loaded after reload');
end else
begin
print('Client never reloaded after restart..', TDebug.FATAL);
terminateScript;
end;
if not players[currentPlayer].isActive then players.next(false);
if players[currentPlayer].login then prepareSelf;
if not isLoggedIn then
begin
writeln('Terminating, not logged in.');
terminateScript;
end;
end;

loc := location;
if loc.equals([-1, -1]) then exit;
wait(randomRange(1, 300));
if walk(true) then
if handleBanking then
if walk(false) then
if tabBackpack.mouseSlot(randomRange(10, 28), mouse_left) then
if useRange then whileCooking;
end;

begin

if USE_DirectX then smartPlugins := ['d3d9.dll'];

smartEnableDrawing := true;
setupsrl;
declarePlayers;
initPaths;

if not isLoggedIn then if players[currentPlayer].login then prepareSelf;

while players.getActive > 0 do mainLoop;
end.

Coh3n

2014-07-09 18:36:59

Thanks @killercrashy; your version is working for me. :)

fridaynitelights

2014-07-13 09:16:09

Been trying to use this script, though I guess it's no longer being maintained. Seem to be running into the problem of not cooking while at the range, and immediately running back to bank.

Coh3n

2014-07-13 11:01:32

From: fridaynitelights
Been trying to use this script, though I guess it's no longer being maintained. Seem to be running into the problem of not cooking while at the range, and immediately running back to bank.
That's because of the outdated range color. The version posted above should fix that.

lanadekat

2014-08-07 10:09:06

From: Coh3n
That's because of the outdated range color. The version posted above should fix that.

So still working now?
forum says you posted the message at : 07-13-2014
currently it's 07-08-2014 here :fiery:
damn I messed up with the months …
here we use day/month/year
in usa they use month/day/year

Wetish

2014-08-07 12:34:10

From: lanadekat
So still working now?
forum says you posted the message at : 07-13-2014
currently it's 07-08-2014 here :fiery:
damn I messed up with the months …
here we use day/month/year
in usa they use month/day/year


I updated the colors of the range and it worked well.

Use directx, lowest settings, and zoom all the way out.

Replace the function findRange with this. Its around line 105.
//This function will find all colors close to the range color and split them into
//TPA's by width and height, a use range function will call this one
function findRange: T2DPointArray;
var
rangeTPA: TPointArray;
begin
if findColorsTolerance(rangeTPA, 3162322, mainscreen.getBounds, 10, colorSetting(2, 0.16, 2.42)) then
result := rangeTPA.toATPA(15, 15);
sortATPAFromMidPoint(result, mainscreen.playerPoint);
end;

x3DNipS

2014-09-21 03:31:21

After clicking the range, it doesn't actually click the blue cook button so it sits there for second, hits the compass then heads back to the bank to repeat. :/

I would add the code error but i was messing with it earlier and decided to post my problem after closing rs, if need be ill add it tomorrow.

The Mayor

2014-10-23 03:38:56

From: x3DNipS
After clicking the range, it doesn't actually click the blue cook button so it sits there for second, hits the compass then heads back to the bank to repeat. :/

I would add the code error but i was messing with it earlier and decided to post my problem after closing rs, if need be ill add it tomorrow.


productionScreen wasn't getting recognised. This has a few quick fixes:


program cooking;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I sps/lib/sps-rs3.simba}

var
_totalEXP, food_cooked, food_burnt: integer;
cook_walk: TSPSArea;
paths: T2DPointArray;

const
USE_DirectX = false;

procedure declarePlayers;
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'un';
bankPin := '';
password := 'pw';
integers[0] := 10;//slot containing food to cook
extendeds[0]:= 120;//exp per item
isActive := true;
isMember := false;
world := -1;
end;
currentPlayer := 0;
end;

procedure initPaths;
begin
cook_walk.setup('cook_spot', RUNESCAPE_OTHER, __DEFAULT_ACCURACY, __DEFAULT_TOLERANCE, 0.7);
setLength(paths, 3);
//to bank
paths[0] := [Point(90, 164), Point(94, 171), Point(102, 178), Point(114, 173), Point(117, 159), Point(119, 141), Point(114, 119), Point(110, 107), Point(95, 104)];

//to the north dock
paths[1] := [Point(97, 166), Point(97, 173), Point(98, 179), Point(123, 180), Point(126, 152), Point(114, 136), Point(112, 116), Point(98, 106)];

//to the south dock
paths[2] := [Point(94, 166), Point(118, 162), Point(118, 144), Point(104, 124), Point(97, 109), Point(94, 104)];
end;

function location: TPoint;
var
places: TPointArray;
bankD, rangeD: integer;
begin
result := cook_walk.getPlayerPos;
players[currentPlayer].location := '';
if result.equals([-1, -1]) then exit;

rangeD := distance(result, Point(95, 104));
bankD := distance(result, Point(90, 164));

if (rangeD < 15) then players[currentPlayer].location := 'range' else
if (bankD < 15) then players[currentPlayer].location := 'bank';
status(players[currentPlayer].location);
end;

function walk(bank: boolean): boolean;
var
our_path: TPointArray;
ourPos: TPoint;
threshold: integer;
n: integer;
begin
ourPos := location;
if ourPos.equals([-1, -1]) then exit;

our_path := paths[random(length(paths))].copy;
if bank then invertTPA(our_path);

threshold := getSystemTime + randomRange(45000, 65000);
repeat
if cook_walk.walkPath(our_path) then minimap.waitPlayerMoving();
wait(randomRange(250, 500));
ourPos := location;
until ((distance(our_path[high(our_path)], ourPos) < 12)) or (getSystemTime > threshold);
result := (threshold > getSystemTime);
end;

//this function returns the closest point in the array to the center of the arra
function TPointArray.centerPoint(): TPoint;
var
tmpArray: TPointArray;
begin
if length(self) < 1 then exit;
tmpArray := self;
tmpArray.sortFromPoint(self.getMiddle);
result := tmpArray[0];
end;


//This just ensures that the option window gets closed
function TRSChooseOption.close2(): boolean;
var
t: integer;
begin
t := getSystemTime + randomRange(2000,3000);
while (t > getSystemTime) do if self.isOpen then self.close else exit(true);
end;

//This function will find all colors close to the range color and split them into
//TPA's by width and height, a use range function will call this one
function findRange: T2DPointArray;
var
rangeTPA: TPointArray;
begin
if findColorsTolerance(rangeTPA, 4146611, mainscreen.getBounds, 4, colorSetting(2, 0.06, 0.53)) then
result := rangeTPA.toATPA(15, 15);
sortATPAFromMidPoint(result, mainscreen.playerPoint);
end;

function TRSProductionScreen.isOpen(waitTime: integer = 0): boolean; override;
var
t: UInt64;
begin
result := false;
t := (getTickCount64() + waitTime);

while (not result) and (t >= getTickCount64()) do
begin
result := getColor(point(44, 66)) = 1388125;
wait(randomRange(20, 50));
end;
end;

function useRange: boolean;
var
range: T2DPointArray;
pont: TPoint;
i, h, timer: integer;
begin
range := findRange;
if (length(range) < 1) then exit;
h := high(range);
for i := 0 to h do
begin
if (length(range[i]) < 5) then continue;
pont := range[i].centerPoint;
mouse(pont.rand(-3, 3), Mouse_Right, Mouse_Human);
if chooseOption.select(['-> Range'], randomRange(1000, 4000)) then
begin
minimap.waitPlayerMoving();
writeLn(productionScreen.isOpen(1000) );
if productionScreen.isOpen(5000) then
begin
result := productionScreen.clickStart();
exit(true);
end;
end;
end else chooseOption.close2;
end;

function doneButton: boolean;
var
bluePoints: TPointArray;
blueArea: TBox;
begin
blueArea := [244,197, 335, 223];
findColorsTolerance(bluePoints, 13278759, blueArea, 44);
result := length(bluePoints) > 145;
end;

procedure whileCooking;
var
blkCount: TPointArray;
count, threshold: integer;
begin
threshold := getSystemTime + randomRange(70000, 80000);
repeat
wait(randomRange(255, 555));
if doneButton then
begin
threshold := getSystemTime + randomRange(2500, 3500);
repeat
wait(randomRange(255, 555));
if not(doneButton) then exit;
until (getSystemTime > threshold);
end;
until (getSystemTime > threshold);
end;

//This function will find all colors close to the banker color and split them into
//TPA's by width and height, a use bank function will call this one
function findBankers: T2DPointArray;
var
bankerTPA: TPointArray;
begin
if findColorsTolerance(bankerTPA, 2450798, mainscreen.getBounds, 14, colorSetting(2, 0.09, 1.31)) then
result := bankerTPA.toATPA(15, 15);
sortATPAFromMidPoint(result, mainscreen.playerPoint);
end;

function useBank: boolean;
var
bankers: T2DPointArray;
pont: TPoint;
i, h, timer: integer;
begin
bankers := findBankers;
if (length(bankers) < 1) then exit;
h := high(bankers);
for i := 0 to h do
begin
if (length(bankers[i]) < 5) then continue;
pont := bankers[i].centerPoint;
mouse(pont.rand(-3, 3), Mouse_Right, Mouse_Human);
if chooseOption.select(['Bank Banker', 'Bank Bank', 'nk Banker'], randomRange(1000, 4000)) then
begin
minimap.waitPlayerMoving();
timer := getSystemTime + randomRange(3000, 6000);
repeat
wait(randomRange(100, 400));
until (bankscreen.isOpen) or (pinscreen.isOpen) or (getSystemTime > timer);
if pinscreen.isOpen then pinScreen.enter(players[currentPlayer].bankPin);
if bankscreen.isOpen then exit(true);
end else chooseOption.close2;
end;
end;

function cook_count: TPoint
var
i, invcount, x, y: integer;
clrFound: boolean;
begin
tabBackpack.open;
invcount := tabBackpack.count;
clrFound := findColor(x, y, 65535, tabBackpack.getBounds);
case invcount of
0: result := [0, 0];
1..27: result := [invcount-1, 29-invcount];
28: if clrFound then result := [27, 1] else result := [28, 0];
end;
end;

procedure printProgress;
var
secondsElapsed, expPHour, totalEXP: extended;
food: TPoint;
begin
food := cook_count;

food_cooked := food_cooked + food.x;
food_burnt := food_burnt + food.y;

totalEXP := food_cooked * players[currentPlayer].extendeds[0];
secondsElapsed := (getTimeRunning/1000);
expPHour := (totalEXP * 60 * 60) / secondsElapsed;

smartImage.clearArea(intToBox(576, 200, 798, 278));
smartImage.drawBox(intToBox(576, 200, 798, 278), true, 7890014);

smartImage.DrawText('Run Time: ' + msToTime(GetTimeRunning, TIME_SHORT), Point(618, 224), upchars, false, 1376386);
smartImage.DrawText('EXP/Hour: ' + toString(round(expPHour)), Point(618, 234), upchars, false, 1376386);
smartImage.DrawText('Total EXP: ' + toString(totalEXP), Point(618, 244), upchars, false, 1376386);
smartImage.DrawText('Items cooked: ' + toString(food_cooked), Point(618, 254), upchars, false, 1376386);
smartImage.DrawText('Items burnt: ' + toString(food_burnt), Point(618, 264), upchars, false, 1376386);
end;

function handleBanking: boolean;
begin
printProgress;
if waitFunc(@useBank, 100, randomRange(20000,30000)) then
begin
bankscreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
if bankscreen.withdraw(players[currentPlayer].integers[0], WITHDRAW_AMOUNT_ALL_BUT_ONE, ['']) then
result := bankscreen.close;
end;
end;

procedure prepareSelf;
begin
wait(random(500, 1500));
minimap.clickCompass;
wait(random(500, 1500));
mainscreen.setAngle(MS_ANGLE_HIGH);
wait(random(1, 1500));
end;

procedure mainLoop;
var
loc: TPoint;
begin

if not isLoggedIn then
begin
print('We''re not logged in. respawning client.');
wait(randomRange(5000, 10000));
smartReloadClient((5 * 60000) + random(15000));

if (waitClientReady()) then
begin
print('Client succesfully loaded after reload');
end else
begin
print('Client never reloaded after restart..', TDebug.FATAL);
terminateScript;
end;
if not players[currentPlayer].isActive then players.next(false);
if players[currentPlayer].login then prepareSelf;
if not isLoggedIn then
begin
writeln('Terminating, not logged in.');
terminateScript;
end;
end;

loc := location;
if loc.equals([-1, -1]) then exit;
wait(randomRange(1, 300));
if walk(true) then
if handleBanking then
if walk(false) then
if tabBackpack.mouseSlot(randomRange(10, 28), mouse_left) then
if useRange then whileCooking;
end;

begin

if USE_DirectX then smartPlugins := ['d3d9.dll'];

smartEnableDrawing := true;
setupsrl;
declarePlayers;
initPaths;

if not isLoggedIn then if players[currentPlayer].login then prepareSelf;

while players.getActive > 0 do mainLoop;
end.

E: Crayfish @ level 1 cooking ;)
E2: Banker + range colour seem to change frequently. Need to pick a stable colour across multiple worlds.