Simba Code:
program CookingGuilder;
{$DEFINE SMART}
{$i srl/srl.simba}
(*
{=====================================Change Log v0.4 ====================================}
//Edited Banking Detection
//Reverted back to object detection, colorspiraltolerance not working great
//Error fix
{=====================================Change Log v0.3 ====================================}
//Edited Failsafe system
//Added Option to speed up range and inv selection as requested
//Changed Inv Uptext Search Method to WaitUpText instead of IsUpText to stop looping bug
{=====================================Change Log v0.2 ====================================}
// Failsafes added (If Range not clicked will hop worlds),
// breaking system added - Made By Flight - slightly edited variable names
*)
//======================================Intro========================================
//I made this script as a semi stable Script that coos at the cooking guild
//It is fairly basic as i just bashed this together
//=======================================Setup========================================
//Just fill in the details of what you want to cook etc.
//currently works with any food that has the first option use and can be 1 click consumed
//Please post proggies and also some suggestions and errors
//
//===========================Declare Login Details here==============================
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Enter Username here
Players[0].Pass := ''; // Type Password Here
Players[0].Nick := ''; // Nickname = 3-4 lowercase letters of character name
Players[0].Active:= True; // Type True or dont bother running
Players[0].Pin := ''; // Leave Blank if none
end;
Const
{=========================Declare Settings Here=====================================}
{=========================General Settings=====================================}
Debug = True ;//True For details on where script is when its fucking up
RandomInvFoodSelect = True; // True if you want it to pick out a random item to use on range
//If True, Please state slots to start and end selection
StartInvSlot = 1 ;
EndInvSlot = 28 ;
//If False, Please state slot to Pick Item From
ItemSlot = 1 ;
//_____________________________________________________________________________
SimpleType = False ;(* True = 1st click without checking option - will be the faster option
False = Moves Mouse there and checks uptext- will be slightly slower*)
{=========================Banking Settings=====================================}
Tab = 1; //What Bank Tab is Your Stuff in? Keep all items in one.
RowNo = 0; //This is the row number where you food is, starting at 0 for first row
ColNo = 9;//This is the column number where you food is, starting at 0 for first column
FoodExp = 120;// Exp per food Cooked
FoodName = 'Lobster';//Just for Proggy purposes (Lobster, Tuna, Swordfish, etc.)
{=========Made color detection at first but was buggy so relies on uptext=======================}
{RawCol = 2112617; //Raw Food Color
RawTol = 15; // Raw Color Tolerance (leave it be if you don't even know what it is)
CookCol= 1594796 ; //Cooked food color
CookTol = 39; //Tolerance for cooked food color}
{================================Break settings============================================}
Breaking = True; //Are we going to take Breaks ( True / False )
SwitchWorlds = True; //Are we going to Hop worlds after breaks? ( True / False )
BreakIn = 140; //How long before we take a break? (minutes)
BreakFor = 30; //How long will we break for? (minutes)
Bir = 15; //Random minutes to add/subtract from how long until we break
Bfr = 15; //Random minutes to add/subjtract from break duraction
{**************************************************************************************************
Do Not Touch Below Or Risk Fucking It Up
***************************************************************************************************}
Version = 0.3 ;
var
x , y, Loads, ExpGained, Cooked: integer;
//Break variables
wb,xb,yb,zb,RealBTime,CurrentBTime,
BreakRounds,TotalBreaks: Integer;
//Failsafe vars
RangeClicked,Reset:boolean;
Rangemiss:integer;
{*******************************************************************************
Procedure HumanMMouse(eX, eY: Integer);
By: Flight
Description: Human-like miss-and-correct mouse movement
*******************************************************************************}
Procedure HumanMMouse(eX, eY, ranX, ranY: Integer);
var
randSpeed: extended;
X,Y,X2,Y2,A,Dist,MP: integer;
begin
A := MouseSpeed;
GetMousePos(X, Y);
Dist := Distance(X, Y, eX, eY);
MP := Round(Dist/150);
if MP < 0 then
MP := 1;
randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
X2 := RandomRange(eX-(A*MP), eX+(A*MP));
Y2 := RandomRange(eY-(A*MP), eY+(A*MP));
WindMouse(X, Y, X2, Y2, 11, 8, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);
GetMousePos(X, Y);
MMouse(eX, eY, ranX, ranY);
MouseSpeed := A;
end;
{*******************************************************************************
Procedure BrakeWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, targetArea: extended);
By: Flight
*******************************************************************************}
procedure BrakeWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, targetArea: extended);
var
veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist: extended;
lastX,lastY,MSP,W,maxStep,D: integer;
sqrt2,sqrt3,sqrt5: extended;
begin
MSP := MouseSpeed;
sqrt2:= sqrt(2);
sqrt3:= sqrt(3);
sqrt5:= sqrt(5);
repeat
dist:= hypot(xs - xe, ys - ye);
wind:= minE(wind, dist);
D := Random((Round(dist)/3));
if (D > 100) then
D := RandomRange(90, 100);
if (D < 5) then
D := RandomRange(5, 8);
maxStep := D;
if dist >= targetArea then
begin
windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
end else
begin
windX:= windX / sqrt2;
windY:= windY / sqrt2;
end;
veloX:= veloX + windX;
veloY:= veloY + windY;
If Dist>0 then //sorts out The divide by 0 error (and the world imploding every time it crashes)
begin
veloX:= veloX + gravity * (xe - xs) / dist;
veloY:= veloY + gravity * (ye - ys) / dist;
end;
if hypot(veloX, veloY) > maxStep then
begin
randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
veloMag:= sqrt(veloX * veloX + veloY * veloY);
veloX:= (veloX / veloMag) * randomDist;
veloY:= (veloY / veloMag) * randomDist;
end;
lastX:= Round(xs);
lastY:= Round(ys);
xs:= xs + veloX;
ys:= ys + veloY;
if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
MoveMouse(Round(xs), Round(ys));
W := (Random(100/MSP))*3;
if (W < 5) then
W := 5;
wait(W);
lastdist:= dist;
until(hypot(xs - xe, ys - ye) < 1)
if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
MoveMouse(Round(xe), Round(ye));
MouseSpeed := MSP;
end;
{*******************************************************************************
Procedure BrakeMMouse(eX, eY, ranX, ranY: Integer);
By: Flight
*******************************************************************************}
procedure BrakeMMouse(eX, eY, ranX, ranY: Integer);
var
randSpeed: extended;
X,Y: integer;
begin
randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
GetMousePos(X, Y);
BrakeWindMouse(X, Y, eX, eY, 9, 15, 10.0 / randSpeed, 15.0 / randSpeed, 10.0 * randSpeed);
end;
{*******************************************************************************
Function BreakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean;
His Breaking system
By: Flight
*******************************************************************************}
Function BreakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean;
Var
h,m,s,timeleft: integer;
begin
if not LoggedIn then Exit;
if (HowManyPlayers = 1) then
begin
timeleft:=(wb) + (yb) - GetTimeRunning ;
ConvertTIME(Timeleft,H,M,S);
Writeln('Time Until Break: '+IntToStr(h)+' Hours, '+Inttostr(m)+' Minutes and '+ IntToStr(s)+' Seconds');
if (GetTimeRunning < ((wb) + (yb) + BreakRounds)) then Exit
else
if (GetTimeRunning > ((wb) + (yb) + BreakRounds)) then
begin
RealBTime := ((xb+zb)/60000);
Writeln('Taking a break for about ' + IntToStr(RealBTime) + ' minutes.');
Logout;
MarkTime(CurrentBTime);
repeat
Wait(21000);
ConvertTime((xb+zb)-TimeFromMark(CurrentBTime), h, m, s);
ClearDebug;
Writeln('Breaktime left: '+IntToStr(h)+':'+IntToStr(m)+':'+IntToStr(s));
until(TimeFromMark(CurrentBTime)>(xb+zb));
Writeln('Logging in.');
if SwitchWorlds then
if LoginPlayerToLob then
ChangeWorld(RandomWorld(True, False))
else
LoginPlayer;
Wait(4000);
Result := LoggedIn;
ClickNorth(SRL_ANGLE_HIGH);
IncEx(BreakRounds, (wb) + (xb));
Inc(TotalBreaks);
Writeln('The next break will occur in about ' + IntToStr(BreakIn) + ' minutes.');
wb := (BreakIn * 60000);
xb := (BreakFor * 60000);
yb := RandomRange(-Bir * 60000, Bir * 60000);
zb := RandomRange(-Bfr * 60000, Bfr * 60000);
end;
end;
end;
procedure AntiBan();
begin
if(not(LoggedIn))then Exit;
FindNormalRandoms;
//If Debug then Writeln('AntiBan');
case (Random(1000)) of
0 : BrakeMMouse(RandomRange(MSX1,MSX2),RandomRange(MSY1,MSY2),4,4);
1 : HoverSkill('random', False);
2 : ExamineInv;
3 : MouseSpeed := (RandomRange(9,15));
4 : begin HoverSkill('Cooking', False); Wait(RandomRange(2000, 4000)); end;
5 : begin PickUpMouse; SleepAndMoveMouse(1500 + Random(500)); end;
6 : begin GameTab(tab_Stats); Wait(1500 + Random(500)); GameTab(tab_Inv); end;
7 .. 50 : begin BoredHuman; SetAngle(SRL_ANGLE_HIGH); end;
51 : Wait(RandomRange(750, 2000));
end;
end;
Procedure SelectFood;
begin
If SimpleType then
begin
If RandomInvFoodSelect then
InvMouse(ItemSlot,1)
else
InvMouse(RandomRange(StartInvSlot,EndInvSlot),1);
end else
Begin
repeat
if (GetCurrentTab <> 25) then
Gametab(tab_inv);
if RandomInvFoodSelect then
InvMouse(RandomRange(StartInvSlot,EndInvSlot),3)
else
InvMouse(ItemSlot,3);
if WaitUpText('Use',500) or FindNormalRandoms then
begin
ClickMouse2(true);
If Debug then Writeln('Food Clicked');
Break;
end else
ClickMouse2(False);
until chooseoption('se') ;
end;
end ;
Procedure Bank;
var
count:integer;
begin
SetAngle(SRL_ANGLE_HIGH);
//MakeCompass('w');
count := 0 ;
repeat
repeat
FindNormalRandoms;
if FindObjTPA(x, y, 5931683, 12, -1, 10, 10, 60, ['ank', 'oth']) or FindNormalRandoms then //6063011 tol 5 for client
begin
BrakeMMouse(x,y,4,4);
if WaitUpText('ank Bank',400) or FindNormalRandoms then
begin
ClickMouse2(true);
If Debug then Writeln('Bank Single Clicked');
end else
begin
repeat
HumanMMouse(x,y,4,4);
WaitUptext('ank Bank',3000);
ClickMouse2(False);
until ChooseOption('ank') or FindNormalRandoms ;
If Debug then Writeln('Bank Menu Clicked');
end;
end else MakeCompass('w');
wait(3000);
if Pinscreen or FindNormalRandoms then
begin
InPin(Players[currentplayer].Pin);
If Debug then Writeln('PinEntered');
end;
until BankScreen ;
DepositAll;
If Debug then Writeln('Deposited all');
Banktab(tab);
WithDraw(ColNo,Rowno,28);
If Debug then Writeln('Food Withdrawn');
CloseBank;
wait(1000);
Inc(count);
If (Count > 1) then If Debug then Writeln('Withrawing is fucking up, trying again');
if (Count > 3) then
TerminateScript;
until (Invcount = 28);
end;
procedure Afkcook;
begin
if(not(LoggedIn))then Exit;
FindNormalRandoms;
Case (Random(10)) of
1 : begin wait(1500+random(3000)); writeln('Afking'); end;
end;
end;
Procedure WorldHop;
begin
repeat
if LoginPlayerToLob then
ChangeWorld(RandomWorld(True, False));
until not loggedin;
LoginPlayer;
repeat until loggedin;
end;
Procedure Cook;
var
Found: boolean;
Fail: integer;
begin
repeat
SetAngle(SRL_ANGLE_HIGH);
If FindObjTPAMulti(x, y, [1977558, 1581995, 1581993], 27, -1, 5, 5, 10, ['aw', 'nge']) or FindNormalRandoms then
//If FindColorSpiralTolerance(x,y,1845443,354,74,398,190,30) or FindNormalRandoms then
begin
Found := true;
RangeClicked := False;
If Debug then Writeln('Range Found');
BrakeMMouse(x, y, 3, 3);
If WaitUptext('Range',500) or FindNormalRandoms then
begin
ClickMouse2(true);
MouseBox(250, 410, 261, 425, 2);
if WaitUpTextMulti(['ook', 'll'], 2500) or FindNormalRandoms then
begin
ClickMouse2(true);
RangeClicked := True;
If Debug then Writeln('Range Click Option Chosed');
end;
end else
begin
ClickMouse2(false);
ChooseOption('ange');
wait(1000 + random(300));
MouseBox(250, 410, 263, 425, 2);
if WaitUpTextMulti(['ook', 'll'], 2500) or FindNormalRandoms then
begin
ClickMouse2(true);
RangeClicked := True;
If Debug then Writeln('Range Menu Option Chosen');
end ;
end;
end else
begin
AntiBan;
Inc(Fail);
If Fail > 3 then
begin
Break;
If Debug then Writeln('YOU HAVE FUCKED UP THE SCRIPT-AKA range not found');
Playsound('D:\Simba\alarm.mp3'); //not working atm
TerminateScript;
end;
end;
until(Found);
wait(400+random(300));
end;
Procedure Cooking;
var
ts,Count:integer;
begin
count:=0;
MarkTime(ts);
GameTab(tab_Inv);
repeat
LevelUp;
if (count<10) then
AntiBan
else
FindNormalRandoms;
wait(2000 + random(600));
inc(count);
If Debug then Writeln('Count : '+IntToStr(Count));
if (GetCurrentTab <> 25) then
Gametab(tab_inv);
if (TimeFromMark(ts) > RandomRange(90000,110000)) then
Break;
if (Count>15) then
InvMouse(27,3);
FindNormalRandoms;
until WaitUpText('Eat',300) and ( TimeFromMark(ts) > 65000 ) ;
If Debug then Writeln('Load Done');
FindNormalRandoms;
//Afkcook;
inc(Loads);
Writeln('Loads: ' + ToStr(Loads) + ' Cooked' );
end;
Procedure Report;
begin
Cooked := Loads * 28;
ExpGained := (Cooked * FoodExp);
Writeln('#################Cooking Guilder-v0.5#################');
WriteLn('Time Running: '+TimeRunning);
Writeln('Exp Gained: ' + IntToStr(ExpGained));
Writeln('Exp/Hour: ' + IntToStr(Round((EXpGained/(GetTimeRunning/3600000.0)))));
Writeln(FoodName + ' Cooked: ' + IntToStr(Cooked));
Writeln(FoodName + 'Cooked/Hour: ' + IntToStr(Round(( Cooked/(GetTimeRunning/3600000.0)))));
Writeln('Please Post Proggies');
end;
Procedure Setup;
begin
{$IFDef Smart}
SRL_SixHourFix:= True;
{$ENDIF}
MouseSpeed := 12
wb := (BreakIn * 60000);
xb := (BreakFor * 60000);
yb := RandomRange(-Bir * 60000, Bir * 60000);
zb := RandomRange(-Bfr * 60000, Bfr * 60000);
ClearDebug;
SetupSRL;
DeclarePlayers;
//ChangeWorld(RandomWorld(True, False));
LoginPlayer;
end;
Label
STARTPOINT;
begin
Setup;
StartPoint:
Reset := false
ExitSquealOfFortune;
repeat
if not loggedin then
loginplayer;
until loggedin;
Writeln('Logged In');
repeat
Bank;
togglexpbar(True);
repeat
RangeMiss := 0;
repeat
SelectFood;
Cook;
if ( RangeMiss > 0 ) then Writeln('We Have Failed '+ IntToStr(RangeMiss) + ' Times');
if ( RangeMiss > 10 ) then
begin
Repeat
WorldHop;
Until Loggedin;
Reset:= True;
end;
inc(RangeMiss)
If Reset then Break;
FindNormalRandoms;
if not RangeClicked then
Case Random(4) of
1: MakeCompass('w');
2: MakeCompass('e');
3: MakeCompass('s');
3: MakeCompass('n');
end;
Until RangeClicked;
If Reset then Break;
InvMouse(1,3);
FindNormalRandoms;
until WaitUpText('Eat',1000);
If Reset then Break;
If Debug then Writeln('Found Started Cooking');
Cooking;
Report;
if breaking then BreakHandler(BreakIn,BreakFor,Bir,Bfr);
until not loggedin;
If Reset then Goto StartPoint;
end.