SRL Archive - OSR Cooking

RFD Chest Wine Maker


Emarian

2021-01-18 10:18:23

I used this in conjunction with a custom runelite plugin that drew a solid color on any object. It can still be used with regular runelite plugins, but I'm not sure how effective it will be. I'm still learning and it's some of my first code, but it worked to get me 70 cooking for b gloves on my ironman.

program new;
{$I SRL/OSR.simba}

const
LOGIN_NAME = '';
LOGIN_PASS = '';
RS_WORLD = -1;
IS_MEMBER = true;

var
CurrWorld, InvCount, x, y: Integer;
OurWorlds: TIntegerArray;
ChestTPA, SinkTPA: TPointArray;

var
JugDTM := DTMFromString('mggAAAHicY2NgYJjOxMAwDYh7gHghEE8C4plArMbIwGAFxHpAbAjE8lCcl5YG1MUIxqKCgnC2HAM5AABy5wYu');
GrapeDTM := DTMFromString('mbQAAAHicY2VgYMhjYmBIAeJiIM6G4udA8WdA/AKI3wHxbSBu4U0GkowoWI6BBAAAcAQHvw==');
WaterDTM := DTMFromString('mggAAAHicY2NgYMhlYmBIB+IiIM4C4iQgzgDiu0C5+wwQ+hMQvwDi60BcUnYWSDJiYC4GcgAAlkkJnQ==');
AnyDTM := DTMFromString('mAAEAAHic42FgYJjOxMDQD8STgHgGEM8F4oVQPBOIJwJxDxSD2FsZGRg2AfF6KN4MxDuA+AgQnwTiE0B8CIj3A/F2IF7nZg+0hZFo/J+BfgAA1xESLQ==');

procedure declarePlayers();
begin
with Players.New()^ do
begin
LoginName := LOGIN_NAME;
Password := LOGIN_PASS;
IsActive := True;
IsMember := IS_MEMBER;
World := RS_WORLD;
end;
Players.SetCurrent(0);
end;

procedure ShopWaitLoop();
var
T: TTimeMarker;
begin
T.Start;
repeat
//if findColorTolerance(x, y, 2070783, 177, 34, 340, 47, 5) then
if not SRL.FindColors(SinkTPA, CTS2(7651357, 7, 0.28, 4.04), Mainscreen.GetBounds) then
Break;
WaitEx(120,25);
until(T.GetTime > RandomRange(5000,10000));
end;

procedure BankWaitLoop();
var
T: TTimeMarker;
begin
T.Start;
repeat
WaitEx(120,25);
until((BankScreen.IsOpen) or (T.GetTime > RandomRange(10000,20000)));
end;

procedure DepositWaitLoop();
var
InvCount2 : Integer;
T: TTimeMarker;
begin
T.Start;
repeat
if T.GetTime > RandomRange(1500,5000) then
Break;
WaitEx(350,50);
InvCount2 := Inventory.Count(AnyDTM);
until((InvCount2 < InvCount) or (T.GetTime > RandomRange(1500,5000)));
end;

procedure JugWaitLoop();
var
InvCount2 : Integer;
T: TTimeMarker;
begin
T.Start;
repeat
WaitEx(120,25);
InvCount2 := Inventory.Count(JugDTM);
until((InvCount2 > InvCount) or (T.GetTime > RandomRange(10000,20000)));
end;

procedure GrapeWaitLoop();
var
InvCount2 : Integer;
T: TTimeMarker;
begin
T.Start;
repeat
WaitEx(120,25);
InvCount2 := Inventory.Count(GrapeDTM);
until((InvCount2 > InvCount) or (T.GetTime > RandomRange(10000,20000)));
end;

procedure WaterWaitLoop();
var
T: TTimeMarker;
begin
T.Start;
repeat
WaitEx(120,25);
until((Inventory.Count(JugDTM) = 0) or (T.GetTime > RandomRange(30000,60000)));
end;

procedure CloseShop();
var
T: TTimeMarker;
begin
T.Start;
repeat
//if not findColorTolerance(x, y, 2070783, 177, 34, 340, 47, 5) then
if SRL.FindColors(SinkTPA, CTS2(7651357, 7, 0.28, 4.04), Mainscreen.GetBounds) then
Break;
Mouse.Move(IntToBox(477, 32, 495, 50));
mouse.Click(mouse_Left);
WaitEx(120,25);
until(T.GetTime > RandomRange(30000,60000));
end;

procedure WineWaitLoop();
var
T: TTimeMarker;
begin
T.Start;
repeat
WaitEx(120,25);
until((Inventory.Count(WaterDTM) = 0) or (T.GetTime > RandomRange(30000,60000)));
end;

procedure OpenChest();
var
T: TTimeMarker;
begin
T.Start;
if BankScreen.IsOpen then BankScreen.Close;
repeat
SRL.FindColors(ChestTPA, CTS2(7625947, 15, 0.18, 2.49), Mainscreen.GetBounds);
Mouse.Move(ChestTPA.Bounds);
if MainScreen.IsUpText('Bank') then mouse.Click(mouse_Left) else Mouse.Move(ChestTPA.Bounds);
BankWaitLoop;
until(BankScreen.IsOpen or (T.GetTime > RandomRange(10000,20000)));
end;

procedure recovery();
var
T: TTimeMarker;
begin
T.Start;
// ShopScreen.Close;
CloseShop();
OpenChest;

BankScreen.Withdraw(0, RandomRange(100000,9999999),,, BANK_BUTTON_QUANTITY_ALL);
BankScreen.Close;

repeat
SRL.FindColors(ChestTPA, CTS2(7625947, 15, 0.18, 2.49), Mainscreen.GetBounds);
Mouse.Move(ChestTPA.Bounds);
if ChooseOption.Select('Buy') then
Break;
until(T.GetTime > RandomRange(10000,20000));

ShopWaitLoop;

end;

function BuyItems(): Boolean;
begin

repeat
SRL.FindColors(ChestTPA, CTS2(7625947, 15, 0.18, 2.49), Mainscreen.GetBounds);
Mouse.Move(ChestTPA.Bounds);
if ChooseOption.Select('Buy') then
Break;
until(false);

wait(randomrange(1000,2000));
//ShopWaitLoop;

// if shopscreen open
//if findColorTolerance(x, y, 2070783, 177, 34, 340, 47, 5) then
if not SRL.FindColors(SinkTPA, CTS2(7651357, 7, 0.28, 4.04), Mainscreen.GetBounds) then
begin

if not findColorTolerance(x, y, 1548998, 568, 223, 591, 241, 65) then
recovery;

if Inventory.Count(JugDTM) < 13 then
repeat
case (Inventory.Count(JugDTM)) of
0:
begin
if ShopScreen.GetStackAmount(15) = 0 then
Break;
InvCount := Inventory.Count(JugDTM);
ShopScreen.BuyItem(15, 50);
JugWaitLoop;
end;
1..3:
begin
if ShopScreen.GetStackAmount(15) = 0 then
Break;
InvCount := Inventory.Count(JugDTM);
ShopScreen.BuyItem(15, 10);
JugWaitLoop;
end;
4..8:
begin
if ShopScreen.GetStackAmount(15) = 0 then
Break;
InvCount := Inventory.Count(JugDTM);
ShopScreen.BuyItem(15, 5);
JugWaitLoop;
end;
9..12:
begin
if ShopScreen.GetStackAmount(15) = 0 then
Break;
InvCount := Inventory.Count(JugDTM);
ShopScreen.BuyItem(15, 1);
JugWaitLoop;
end;
end;
until(Inventory.Count(JugDTM) = 13);

if Inventory.Count(GrapeDTM) < 13 then
repeat
case (Inventory.Count(GrapeDTM)) of
0..7:
begin
if not findColorTolerance(x, y, 65535, 259, 60, 279, 77, 5) then
ShopScreen.BuyItem(4, 1);
if ShopScreen.GetStackAmount(4) = 0 then
Break;
InvCount := Inventory.Count(GrapeDTM);
ShopScreen.BuyItem(4, 10);
GrapeWaitLoop;
end;
8:
begin
if not findColorTolerance(x, y, 65535, 259, 60, 279, 77, 5) then
ShopScreen.BuyItem(4, 1);
if ShopScreen.GetStackAmount(4) = 0 then
Break;
InvCount := Inventory.Count(GrapeDTM);
ShopScreen.BuyItem(4, 5);
GrapeWaitLoop;
end;
9..12:
begin
if not findColorTolerance(x, y, 65535, 259, 60, 279, 77, 5) then
ShopScreen.BuyItem(4, 1);
if ShopScreen.GetStackAmount(4) = 0 then
Break;
InvCount := Inventory.Count(GrapeDTM);
if ((ShopScreen.GetStackAmount(4)) < (13 - Inventory.Count(GrapeDTM))) then
ShopScreen.BuyItem(4, 5) else ShopScreen.BuyItem(4, 1);
GrapeWaitLoop;
end;
end;
until(Inventory.Count(GrapeDTM) = 13);

if (Inventory.Count(JugDTM) = 13) and (Inventory.Count(GrapeDTM) = 13) then
Result := True;

//ShopScreen.Close();
CloseShop();
end;
end;

procedure MainLoop();
var
arr: TIntArray;
T: TTimeMarker;
failsafe: Integer;
begin
repeat
if BuyItems() then
Break;

if (CurrWorld > RandomRange(110,118)) then
CurrWorld := 0;

// max is 119
OurWorlds := [302, 303, 304, 305, 306, 307, 309, 310, 311, 312, 313, 314, 315, 317, 318, 320, 321, 322, 323, 324, 327, 328, 329, 331, 332, 333, 334, 336, 338, 339, 340, 341, 342, 343, 344, 346, 347, 348, 350, 351, 352, 354, 355, 356, 357, 358, 359, 360, 362, 367, 368, 369, 370, 374, 375, 376, 377, 378, 386, 387, 388, 389, 390, 395, 421, 422, 424, 443, 444, 445, 446, 463, 464, 465, 466, 477, 478, 479, 480, 481, 482, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 531, 532, 533, 534, 535];
Logout.SwitchToWorld(OurWorlds[CurrWorld]);
CurrWorld := CurrWorld + 1;
until(false);

if not Inventory.IsOpen then
Inventory.Open;

arr := Inventory.FindDTM(JugDTM);
if(arr = []) then TerminateScript('Could not find jugs to fill with water');
Inventory.Use(arr[0]);

repeat
SRL.FindColors(SinkTPA, CTS2(7651357, 7, 0.28, 4.04), Mainscreen.GetBounds);
Mouse.Move(SinkTPA.Bounds);
if MainScreen.IsUpText('Sink', RandomRange(600,1500)) then
begin
mouse.Click(mouse_Left);
Break;
end;
until(false);

WaterWaitLoop;

arr := Inventory.FindDTM(WaterDTM);
if(arr = []) then TerminateScript('Could not find water jug');
Inventory.Use(arr[0]);

arr := Inventory.FindDTM(GrapeDTM);
if(arr = []) then TerminateScript('Could not find grapes');
Inventory.MouseSlot(arr[0]);
if MainScreen.IsUpText('Grapes', 1200) then
mouse.Click(mouse_Left);
if Chatbox.WaitButtonQuery('How many', 10000) then
Keyboard.PressKey(VK_SPACE);
WineWaitLoop;

repeat
OpenChest;
arr := Inventory.FindDTM(AnyDTM);
if(arr = []) then TerminateScript('Could not find mixed wines');
InvCount := Inventory.Count(AnyDTM);
if BankScreen.IsOpen then
begin
Inventory.MouseSlot(arr[0]);
mouse.Click(mouse_Left);
end;
DepositWaitLoop;
until((Inventory.Count <= 1));

BankScreen.Close;

end;

begin
SRL.Setup([]);

CurrWorld := 0;

if not Inventory.IsOpen then
Inventory.Open;

repeat
MainLoop;
until(false);

end.


// OurWorlds := [303, 304, 305, 306, 307, 309, 310, 311, 312, 313, 314, 315, 317, 318, 320, 321, 322, 323, 324, 327, 328, 329, 331, 332, 333, 334, 336, 338, 339, 340, 341, 342, 343, 344, 346, 347, 348, 350, 351, 352, 354, 355, 356, 357, 358, 359, 360, 362, 365, 367, 368, 369, 370, 374, 375, 376, 377, 378, 386, 387, 388, 389, 390, 395, 421, 422, 424, 443, 444, 445, 446, 463, 464, 465, 466, 477, 478, 479, 480, 481, 482, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 531, 532, 533, 534, 535]; // place any number of worlds in here