PDA

View Full Version : [Cooking] [SRL] Alkharid_Trout_Cooker



RSPS Scripter
04-14-2019, 11:53 AM
Dear Villavu members,

this script will cook all your raw trouts in Alkharid.

Requirements:

Simba 1.3 SRL/OSRS ---> https://villavu.com/forum/showthread.php?t=118223

15 Cooking Level

Instructions:

you can find the Instructions in the script.

you can find the script here and in this Attchement 28639

program Alkharid_Trout_Cooker;
{$H-} //{================================================= ================================================== =====================]
{$define SMART}//----------->|This will open Oldschool runescape in S.M.A.R.T so you still can use your own mouse. |
{$I SRL/OSR.simba} //|If you dont want to use S.M.A.R.T then add the ' // ' like this for example ---> //{$DEFINE SMART} <--- |
{$I RSWalker/Walker.simba} //[================================================== ================================================== ====================}
{================================================= =============================]
| Alkharid Trout Cooker V1 |
| |
| Steps to use: |
| 1. For longer runs you need to declare login details bellow. |
| 2. Make sure the Raw trout is in the X slot in the bank or |
| you can change the slot number at line 328. |
| 3. Start the script in Alkahrid-Bank, and run setup. |
[================================================== ============================}
var
Walker: TRSWalker; // Used for RSWalker (to walk paths)
Range_Path, Bank_path: TPointArray; // Paths to walk
Antiban: TAntiban; // Used for Antiban procedures

//Player info
const
LOGIN_NAME = ''; //Username/Email
LOGIN_PASS = ''; //Password
RS_WORLD = -1; //Desired World (-1 = Random)
IS_MEMBER = false; //True if your player is a Member

procedure setupAntiban();
begin
Antiban.Init(SKILL_COOKING);
{================================================= =============================]
| Break and Antiban Settings |
| Run every Lasts for? Logout chance Variation (0..1)|
[================================================== ============================}
Antiban.AddBreak([80*ONE_MINUTE, 25*ONE_MINUTE, 0.05, 0.25]);
Antiban.AddTask([@Antiban.HoverPlayers, ONE_MINUTE*9, 0.33]);
Antiban.AddTask([@Antiban.CheckSkill, ONE_MINUTE*13, 0.33]);
end;

const
BANK_TILE := Point(282, 700);
RANGE_TILE := Point(298, 652);

Var
TroutDTM := DTMFromString('mrAAAAHic42BgYJjGxMDQAcQTmCDshUC8BI inA3E/EHMxMjAIAzEHEDMA8R8gxQykBYBYBIibstMgEjiwHAN+gFsnBM MAABHQB5c=');
BurntDTM := DTMFromString('mlwAAAHicY2dgYJjKxMAwDYg7ofRcIF4CxA uBOICRgcEDiGOAOAqIA4HYG4hdgNjSxASomxEHxg1w6UDSBQBl 4wcl');
RawTrout := DTMFromString('mggAAAHicY2NgYJjKxMAwDYgXAvESKLsDiM sZGRhygDgDiPOBuA6I64F457q1QF2MWDB2gE0lQjUAQtcIfQ== ');

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 Progress();
begin
ClearDebug();
WriteLn('{===============================]');
WriteLn('|- |');
WriteLn('|- Script Runtime : ', SRL.MsToTime(GetTimeRunning, Time_Bare),' |');
WriteLn('|- |');
WriteLn('[===============================}');
end;

Procedure myAntiban;
begin
if not SRL.isLoggedIn() then
Exit;

SRL.DismissRandom(); //Dismiss random events if any are found
Antiban.DoAntiban(); //Do the antiban
end;

procedure WalkTo(Path: TPointArray);
begin
myAntiban();
Walker.WalkPath(Path);
end;

// Deposits all the fish in our inventory, cooked, raw and burnt.
function BankCookedBurnedFish(): boolean;
var
dtms, slots: TIntArray;
dtm: Int32;
t: TCountDown;
text: String;
tt: TTimeMarker;
begin
tt.Start();
text := 'We are in the bank!';
while Distance(Walker.getMyPos(), BANK_TILE) > 14 do
begin
Walkto(Bank_path);

if tt.getTime() > (30 * ONE_SECOND) then
Exit(false)
else
writeln(text);
end;
Minimap.SetCompassAngle(RandomRange(100, 90), False);
for 0 to 2 do
if BankScreen.Open(blAlKharid) then
Wait(850,1250)
else
Wait(75,150);

if not BankScreen.IsOpen() then
TerminateScript('No bank');

dtms := [TroutDTM, BurntDTM, RawTrout];
for dtm in dtms do
begin
slots := Inventory.FindDTM(dtm);
if Length(slots) > 0 then
begin
Case (Random(2)) of
0: BankScreen.Deposititem(slots[0], True);
1: BankScreen.DepositAll();
end;
Wait(75,150);

t.Init(2000);
while (not t.IsFinished) and Inventory.IsSlotUsed(slots[0],False) do
Wait(70,160);
end;
end;
end;
// Waits while we are cooking.
// Cooking is determined by checking if the number of raw fish in our inventory
// is reducing. It must reduce by at least 1 within 15.5 seconds.
function WaitCooking(): Boolean;
var
c, currCount: Int32;
t: TCountDown;
begin
SRL.DismissRandom();
if Chatbox.GotLevelUp then
begin
Minimap.SetCompassAngle(RandomRange(100, 90), False);
end;
myAntiban(); //Do antiban
c := Inventory.Count(RawTrout);
t.Init(15500);
repeat
if Chatbox.GotLevelUp then
Break;
currCount := Inventory.Count(RawTrout);
if currCount <> c then
begin
c := currCount;
t.Restart(15500);
end;

if (c = 21) then
begin
Case (Random(30)) of
0:
begin
keyDown(40);
wait(RandomRange(500, 1100));
keyUp(40);
wait(RandomRange(310, 865));
MainScreen.SetAngle(True);
end;
1: Antiban.HoverPlayers;
2:
begin
Antiban.CheckSkill;
wait(RandomRange(500, 1100));
Antiban.LoseFocus;
end;
3: Antiban.RandomCompassNESW;
4: Antiban.LoseFocus;
5: Antiban.Patience;
end;
end;

if (c = 10) then
begin
Case (Random(30)) of
0:
begin
keyDown(40);
wait(RandomRange(500, 1100));
keyUp(40);
wait(RandomRange(310, 865));
MainScreen.SetAngle(True);
end;
1: Antiban.HoverPlayers;
2: Antiban.CheckSkill;
3: Antiban.RandomCompassNESW;
4: Antiban.LoseFocus;
5: Antiban.Patience;
end;
end;

if (c = 0) then
begin
Case (Random(2)) of
0:
begin
wait(randomRange(1650, 2230));
BankCookedBurnedFish();
end;
1:
begin
wait(randomRange(750, 1250));
BankCookedBurnedFish();
end;
end;
end;
Wait(70);
until t.IsFinished() or (c = 0);
Result := True;
end;


function CookRawFish(): Boolean;
var
idx: Int32;
text: String;
tt: TTimeMarker;
arr: TIntArray;
rect: TRectangle;
Objs: T2DPointArray;
Range: TPointArray;
FoundRange: Boolean;
begin
myAntiban(); //Do antiban
Inventory.Open();
wait(randomRange(750, 1650)); //Have a realistic wait time before we actually do anything
if (not Inventory.Contains(RawTrout)) then
Exit;

tt.Start();
text := 'We are in the Alkharid Kebab Bar!';
while Distance(Walker.getMyPos(), RANGE_TILE) > 14 do
begin
Walkto(Range_path);

if tt.getTime() > (30 * ONE_SECOND) then
Exit(false)
else
writeln(text);
end;
Minimap.SetCompassAngle(RandomRange(100, 90), False);
wait(randomRange(250, 750));
repeat
arr := Inventory.FindDTM(RawTrout);
if(arr = []) then Break;

FoundRange := False;

srl.FindColors(Range, CTS2(804210, 8, 0.03, 0.47), MainScreen.GetBounds);
Objs := Range.Cluster(5);
Objs.FilterSize(16, __GT__);
Objs.SortByMiddle(Mainscreen.GetMiddle);

Inventory.Use(arr[0]);
for Range in Objs do
begin
rect := Range.MinAreaRect();
mouse.Move(rect);

Wait(60,100); //wait for game to refresh

wait(randomRange(75, 250));
if MainScreen.IsUpText('Range') then
mouse.Click(mouse_Left)
else if MainScreen.IsUpText('options') then
begin
if not ChooseOption.Select('Range') then
begin
Wait(60,200);
Continue;
end
end else
continue;
wait(randomRange(1650, 2230));
if chatBox.findTextOnLines(['reach'], [1..2]) then
begin
TerminateScript;
end
Chatbox.ClickButtonId('How many', 1, 'Cook', 3000);
wait(randomRange(750, 1650));
Antiban.LoseFocus;
if WaitCooking() then
Break;
end;
until False;
end;

function BankGrabRawFish(): boolean;
var
text: String;
tt: TTimeMarker;
begin
tt.Start();
text := 'We are in the bank!';
while Distance(Walker.getMyPos(), BANK_TILE) > 14 do
begin
Walkto(Bank_path);

if tt.getTime() > (10 * ONE_SECOND) then
Exit(false)
else
begin
Logout.ClickLogout;
Players.LoginCurrent();
end;
end;
writeln(text);
myAntiban(); //Do antiban
BankScreen.Open(blAlKharid); //Open bank using SRL's built in banker function
if BankScreen.IsOpen(6000) then //If bank screen is open sometime within the 5 sec wait
if Inventory.IsFull() then
begin
BankScreen.DepositAll(); //Deposit all
end;
begin
wait(randomRange(750, 1650)); //Have a realistic wait time before we actually do anything
if bankscreen.Withdraw(14, 28, ['Raw trout']) then
begin
wait(randomRange(750, 1650)); //Have a realistic wait time before we actually do anything
CookRawFish();
end else
begin
writeln('out of raw food');
TerminateScript;
end;
end;
end;



// Runs the bot
//
procedure Run();
begin
MainScreen.SetAngle(True);

while srl.IsLoggedIn() do
begin
if (not Inventory.Contains(RawTrout)) then
begin
Progress();
BankGrabRawFish();
end else
CookRawFish();
end;
end;

function setUp(): boolean
begin
{$IFDEF SMART} // If we are using SMART, then...
Smart.EnableDrawing := True; // let us draw on SMART
{$ENDIF} // end SMART IF
SRL.Setup([]); // Setup SRL to allow us to acces it's functions.
setupAntiban(); //Setup our antiban
declarePlayers(); // Declare the player we are using
Walker.Init('world[4_6].png'); // Setup RSWalker by initializing the map we want to use.
Range_path := [RANGE_TILE]; // The path that we plan to walk (Range_path = Al Kharid kebab range)
Bank_path := [BANK_TILE]; // The path that we plan to walk (Bank_path = Al Kharid Bank)
AddOnTerminate(@Walker.Free); // automatic free once script shuts down
Walker.skipClose := 30; // how close to the target point before we try to click the next point.
if (not SRL.isLoggedIn) then // If not logged in then..
begin
Players.LoginCurrent(); // Log player in
MainScreen.setAngle(True); // Sets the camera angle to the highest point
end;
Result := True;
end;

procedure Free();
begin
Walker.Free();
FreeDTMs([TroutDTM, BurntDTM, RawTrout]);
end;

begin //Main

if setUp then //Calls the setup of the script

writeln('We are set up and ready to go!');

repeat
Run();
AddOnTerminate(@Free);
until(True);

end.


Kind Regards
RSPS Scripter