Simba Code:
program TarroPots;
{$I SRL-OSR/SRL.Simba}
var
enteredX: Boolean;
currentTask: String;
Pin: integer;
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Pin := ;
Players[0].Nick :='';
Players[0].Active:=True;
enteredX := False;
currentTask := 'OpenTheBank';
end;
procedure _openBank;
var
TPA: TpointArray;
ATPA: T2DPointArray;
I: Integer;
TP: TPoint;
theOptions: TStringArray;
x, y: integer;
x1, y1: integer;
begin
theOptions := ['Bank Bank booth', 'Bank Banker'];
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.78, 0.98);
findColorsTolerance(TPA, 4401964, MSX1, MSY1, MSX2, MSY2, 11);
colorToleranceSpeed(1);
setColorSpeed2Modifiers(0.2, 0.2);
ATPA := TPAtoATPAEx(TPA, 20, 40);
SortATPAFromMidPoint(ATPA, Point(MSCX, MSCY));
for I := 0 to High(ATPA) do
begin
if Length(ATPA[I]) < 100 then
Continue;
TP := middleTPA(ATPA[I]);
mMouse(TP.X, TP.y, 5, 5);
clickMouse2(MOUSE_RIGHT);
chooseOption('Bank Banker');
writeLn('Bank Open');
wait(1000+random(200));
if PinScreen then
begin
InPin(Players[CurrentPlayer].Pin);
writeLn('Entering Pin');
end;
mouseBox(431, 288, 454, 308, MOUSE_LEFT);
writeLn('Depositing inventory');
wait(500+random(300));
mouseBox(127, 68, 148, 87, MOUSE_MOVE);
if WaitUpTextMulti(['arromin', 'min', 'Tar', 'arro'], 300 + random(200)) then
begin
if not enteredX then
begin
writeLn('Tarromin Found - Right Clicking it');
GetMousePos(x, y);
HoldMouse(x, y, mouse_Right);
GetMousePos(x, y);
ReleaseMouse(x, y, mouse_Right);
writeLn('Quantity 14 not on dialog - Creating it');
y1 := y + 85;
x1 := x;
MMouse(x1, y1, 30, 5);
wait(200+random(100));
GetMousePos(x, y);
HoldMouse(x, y, mouse_Left);
GetMousePos(x, y);
ReleaseMouse(x, y, mouse_Left);
wait(1000+random(400));
sendKeys('14',50, 50);
typeByte(VK_ENTER);
enteredX := true;
end else
begin
writeLn('Tarromin Found - Right Clicking it');
GetMousePos(x, y);
HoldMouse(x, y, mouse_Right);
GetMousePos(x, y);
ReleaseMouse(x, y, mouse_Right);
wait(1600+random(400));
chooseOption('14');
wait(1500+random(400));
end;
end;
mouseBox(79, 70, 94, 87, MOUSE_MOVE);
if WaitUpTextMulti(['arromin','ial', 'ater', 'Wate'],300 + random(200)) then
begin
writeLn('Withdrawing Vials of Water');
GetMousePos(x, y);
HoldMouse(x, y, mouse_Right);
GetMousePos(x, y);
ReleaseMouse(x, y, mouse_Right);
y1 := y + 100;
x1 := x;
MMouse(x1, y1, 30, 5);
wait(200+random(100));
GetMousePos(x, y);
HoldMouse(x, y, mouse_Left);
GetMousePos(x, y);
ReleaseMouse(x, y, mouse_Left);
wait(1200+random(400));
mouseBox(479, 18, 492, 42, MOUSE_LEFT);
currentTask := 'BankCloseCheck';
Break;
end;
end;
end;
procedure makeUnfPots;
var
x, y: integer;
begin
writeLn('Beginning Unf Pots');
MMouse(578, 234, 10, 10);
if WaitUpTextMulti(['arromin', 'min', 'Tar', 'arro'],300 + random(200)) then
begin
GetMousePos(x, y);
HoldMouse(x, y, mouse_Left);
GetMousePos(x, y);
ReleaseMouse(x, y, mouse_Left);
wait(300+random(200));
MMouse(704, 450, 10, 10);
wait(100+random(100));
if WaitUpTextMulti(['arromin','ial', 'ater', 'Wate'],300 + random(200)) then
begin
GetMousePos(x, y);
HoldMouse(x, y, mouse_Left);
GetMousePos(x, y);
ReleaseMouse(x, y, mouse_Left);
wait(300+random(200));
MMouse(258, 413, 20, 20);
wait(600+random(200));
mouseBox(205, 387, 327, 444, MOUSE_RIGHT);
chooseOption('All');
currentTask := 'CheckPotionsAreReady';
wait(500+random(300));
end;
end else
begin
if WaitUpTextMulti(['arromin', 'otion', 'potio', 'unf'],300 + random(200)) then
begin
writeLn('The first slot is an unf potion - banking');
currentTask := 'OpenTheBank';
end else
begin
writeLn('Unknown Object in first inventory slot - Attempting to bank');
currentTask := 'OpenTheBank';
end;
end;
writeLn('Completed Unf Pots');
end;
procedure waitForPotsMade;
begin
if WaitInvMinCount(14, 11000+random(2000)) then
begin
if not (invCount = 14) then
begin
wait(2500+random(300));
writeLn('Still not finished - Waiting a few more seconds');
wait(4000+random(2000));
if not (invCount = 14) then
begin
writeLn('Something has gone wrong - Attempting to make potions again');
currentTask := 'MakePotions';
end;
end else
begin
writeLn('Potions are complete - time to bank');
currentTask := 'OpenTheBank';
end;
end else
begin
writeLn('Waiting for Unf potions to be made');
end;
end;
procedure checkBankClosed;
begin
writeLn('Beginning Check bank Closed');
writeLn('Checking if bank screen is closed');
if BankScreen then
begin
if not (invCount = 28) then
begin
writeLn('Its still open - Running bank block again');
currentTask := 'OpenTheBank';
end;
mouseBox(479, 18, 492, 42, MOUSE_LEFT);
wait(2200+random(2000));
writeLn('Closed the bank');
end else
begin
currentTask := 'MakePotions';
writeLn('Completed Check bank Closed');
end;
end;
procedure scriptLoop();
var
currentstate: string;
begin
currentstate := 'OpenTheBank';
case currentstate of
'OpenTheBank' : _openBank();
'BankCloseCheck' : checkBankClosed();
'MakePotions' : makeUnfPots();
'CheckPotionsAreReady' : waitForPotsMade();
end;
end;
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
mouseSpeed := 10;
Repeat
scriptLoop();
Until(false);
end.