SRL Archive - General Botting Help

Help me figure out the error


Nufineek

2014-05-07 05:07:54

Hey, I'm running my herb script. I've been running it for a few months without problems, a few days ago it started to randomly fail at one spot.

The script fails when making "Unfs" at the unfs procedure right after the tabBackpack.waitWhileLocked(); – when it occurs, it never shows the WriteLn which is right after the waitwhilelocked function.

Here's the script:

 program GEunfPots;

{$DEFINE SMART} // Always have this to load smart
{$I SRL-6/SRL.simba} // To load the SRL include files
{$I SPS/lib/SPS-RS3.Simba} // To load the SPS include files
{$i srl-6/lib/misc/srlplayerform.simba}


var
runsDone: integer;
outOfHerbsCheck, outOfHerbsCheckAll, outOfWaterCheck: integer;
AntiB, MouseB: integer;
randProfile: integer;
breakTime, breaked: integer;
WHAT_TO_DO, WHICH_BANK: string;
randomType, secondaries, MIN_P_BK, MAX_P_BK, MIN_B_BK, MAX_B_BK: integer;
ENABLE_BREAKS, DIRECT_X, ENABLE_DEBUG: boolean;
ticketDTM, vialDTM: integer;
currentSecondary := 1;


procedure initPlayerForm();
begin
with playerForm do
begin
name := 'Unf pots'; // the title of the SPF, usually the name of your script
scriptSettingsPath := 'C:\Settings.xml';
editBoxLabels := ['MIN Time before break','MAX Time before break', 'MIN Break length', ' MAX Break length']; // edit boxes are created for each array element
editBoxDefaults := [ '30', '140', '3', '50']; // optional default values for each edit box; array length must equal editBoxLabel length
checkBoxLabels := ['Take Breaks', 'DirectX', 'Enable SRL debug?']; // same as editBoxLabels but for check boxes
checkBoxDefaults := ['True', 'False', 'False'];

comboBoxLabels := ['What to do?','Location', 'randomType', 'Secondaries']; // same as editBoxLabels but for combo boxes (drop down boxes)
comboBoxDefaults := ['Unfs','AL', '1', '1'];

// this needs to be done for every element in the comboBoxLabels array
setLength(comboBoxItems, length(comboBoxLabels));
comboBoxItems[0] := ['Unfs', 'Cleans', 'Pots']; // all the options available for the first combo box
comboBoxItems[1] := ['GE', 'AL', 'CAM', 'CAT']; // all the options available for the first combo box
comboBoxItems[2] := ['1', '2', '3', '4']; // all the options available for the first combo box
comboBoxItems[3] := ['1', '2'];
end;
end;

procedure declarePlayers();
var
i: integer;
begin
players.setup(playerForm.playerNames, playerForm.playerFile); // load the SPF players from the SRL Player Manager
currentPlayer := 0; // player to use first

for i := 0 to high(players) do
with players[i] do
begin
integers[0] := strToInt(playerForm.players[i].settings[0]);
integers[1] := strToInt(playerForm.players[i].settings[1]);
integers[2] := strToInt(playerForm.players[i].settings[2]);
integers[3] := strToInt(playerForm.players[i].settings[3]);
ENABLE_BREAKS := strToBool(playerForm.players[i].settings[4]);
DIRECT_X := strToBool(playerForm.players[i].settings[5]);
ENABLE_DEBUG := strToBool(playerForm.players[i].settings[6]);
WHAT_TO_DO := playerForm.players[i].settings[7];
WHICH_BANK := playerForm.players[i].settings[8];
randomType := strToInt(playerForm.players[i].settings[9]);
secondaries := strToInt(playerForm.players[i].settings[10]);
end;
end;

procedure setupDTMz;
begin
ticketDTM := DTMFromString('mlwAAAHicY2dgYNBlZ2BQAWIrILYGYh0glgdiOSCWZGJgEARiPiBWBmIVKC0BxD1JdkDdTFDMCMUQviQDbsCIB0MBAIV0A4Y=');
vialDTM := DTMFromString('mbQAAAHicY2VgYLjCxMBwAojPAvFlIL4NxFMYGRhmAnE/EM+HsjPz5wJVM6FgSQZMwIgFgwEA2s0Iuw==');
end;

procedure freeDTMz;
begin
freeDTM(ticketDTM);
freeDTM(vialDTM);
end;

procedure checkForTickets; //checks for Squeal of Fortune tickets and claims them
var
x, y: integer;
begin
if findDTM(ticketDTM, x, y, tabBackPack.getBounds()) then
begin
mouse(x, y, 3, 3, MOUSE_MOVE);
sleep(30+random(64));
fastClick(mouse_left);
end else
Exit;
end;
procedure resetBreakTimer;
begin
breakTime := getSystemTime + gaussRangeInt(MIN_P_BK * 60000, MAX_P_BK * 60000);
end;

function timeUntilBreak: string;
var
breakFromNow, H, M, S: integer;

begin
if ENABLE_BREAKS then
begin
breakFromNow := breakTime - getSystemTime;
convertTime(breakFromNow, H, M, S);
result := (toStr(H)+ 'h ' + toStr(M)+ 'm ' + toStr(S)+ 's');
end else
result := ('Breaking disabled');
end;

procedure takeBreak;
var
H, M, S, HH, MM, SS, breakFor, timeLeft: integer;
breakStartTimer: TTimeMarker;

begin
if not ENABLE_BREAKS then
exit;

if (getSystemTime >= breakTime) then
begin
writeln('Taking a break');
if BreakTime > 306000 then
players[currentPlayer].logout()
else
players[currentPlayer].exitToLobby();

breakFor := gaussRangeInt(MIN_B_BK * 60000, MAX_B_BK * 60000);
convertTime(breakFor, H, M, S);
writeLn('We are breaking for: ' + toStr(H)+ 'h ' + toStr(M)+ 'm ' + toStr(S)+ 's');

breakStartTimer.start();

repeat
timeLeft := breakFor - breakStartTimer.getTime();
convertTime(timeLeft, HH, MM, SS);
writeLn('Ending break in: ' + toStr(HH)+ 'h ' + toStr(MM)+ 'm ' + toStr(SS)+ 's');
wait(30000);
until breakFor < breakStartTimer.getTime();

inc(breaked);
resetBreakTimer;
writeln('Logging back in.');
players[currentPlayer].login();
wait(randomrange(4000, 9000));
Case WHICH_BANK of
'AL','GE','CAM','CAT':
begin
minimap.clickCompass();
wait(randomRange(300, 600));
MainScreen.SetAngle(MS_ANGLE_HIGH);
end;
end;
end;
end;


function BnkClose(): boolean;
var
timeOut: integer;
begin
result := false;

if (not bankScreen.isOpen()) then
exit(true);

// try ESC key first
timeOut := (getSystemTime() + randomRange(600, 1200));
repeat
typeByte(VK_ESCAPE);
wait(130 + random(70));
result := (not bankScreen.isOpen);
until((getSystemTime() > timeOut) or result);

if (result) then
exit();

// click the X as a failsafe
mouseBox(intToBox(521, 15, 532, 30), MOUSE_RIGHT);
wait(50 + random(50));
chooseOption.select(['Close', 'lose'], 1000);

timeOut := (getSystemTime() + randomRange(5000, 6000));
while (timeOut > getSystemTime()) do
begin
if (not bankScreen.isOpen()) then
begin
result := true;
break;
end;

wait(50 + random(50));
end;

print('BnkClose(): result = '+boolToStr(result), TDebug.SUB);
end;

Function Antiban: Boolean;
Var
I: Integer;
Begin
if not isLoggedIn then
exit;
I := Random(600);
Case randomType of
1, 4:
Begin
Case I Of
1:
begin
boredHuman(true);
case WHICH_BANK of
'AL', 'CAM', 'CAT', 'GE':
begin
minimap.clickCompass();
MainScreen.SetAngle(MS_ANGLE_HIGH);
end;
end;
end;
4..45:
Begin
hoverSkill(Skill_herblore);
Wait(GaussRangeInt(1000,2000));
End;
46..48: mouseMovingObject;
49..100: SleepAndMoveMouse(RandomRange(100,MouseB));
101..270:
Begin
MouseOffClient(Random(4));
Wait(RandomRange(3000, MouseB));
End;
271..331:
wait(randomRange(1000, 4000));
331..333:
randomRClickItem();
339..341:
smallRandomMouse();
342..344:
randomGameTab(true);
345..349:
smallRandomMouse;
350..419:
pickUpMouse;
end;
end;
2, 5:
Begin
Case I Of
1..5:
begin
boredHuman(true);
case WHICH_BANK of
'AL', 'CAM', 'CAT', 'GE':
begin
minimap.clickCompass();
MainScreen.SetAngle(MS_ANGLE_HIGH);
end;
end;
end;
6..25:
Begin
hoverSkill(Skill_herblore);
Wait(GaussRangeInt(1000,2000));
End;
26..48: mouseMovingObject;
49..100: SleepAndMoveMouse(RandomRange(100,MouseB));
101..199:
Begin
MouseOffClient(Random(4));
Wait(RandomRange(2000, MouseB));
End;
241..331:
wait(randomRange(6000, 7000));
331..338:
randomRClickItem();
339..341:
smallRandomMouse();
342..344:
randomGameTab(true);
345..349:
smallRandomMouse;
350..400:
pickUpMouse;
end;
end;
3, 6:
Begin
Case I Of
1..2:
begin
boredHuman(true);
case WHICH_BANK of
'AL', 'CAM', 'CAT', 'GE':
begin
minimap.clickCompass();
MainScreen.SetAngle(MS_ANGLE_HIGH);
end;
end;
end;
3..38:
Begin
hoverSkill(Skill_herblore);
Wait(GaussRangeInt(1000,2000));
End;
39..40: mouseMovingObject;
41..121: SleepAndMoveMouse(RandomRange(100,MouseB));
122..199:
Begin
MouseOffClient(Random(4));
Wait(RandomRange(4000, MouseB));
End;
271..331:
wait(randomRange(8000, 13000));
331..360:
randomRClickItem();
361..368:
smallRandomMouse();
369..370:
randomGameTab(true);
371..420:
pickUpMouse;
end;
end;

End;
Wait(GaussRangeInt(0, AntiB));
End;

procedure lookingAtWeb;
var
I: integer;
begin
i := random(1000);
Case randomType of
1, 4:
begin
Case I of
0..10:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
writeln('Pretending to looking at another website. (long)');
wait(30000 + randomRange(20000, 30000));
end;
11:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
writeln('Pretending to looking at another website. (med)');
wait(30000 + randomRange(5000, 15000));
end;
12..16:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
writeln('Pretending to looking at another website. (short)');
wait(5000 + randomRange(2000, 7000));
end;
end;
end;
2, 5:
begin
Case I of
0..1:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
writeln('Pretending to looking at another website. (long)');
wait(30000 + randomRange(5000, 12000));
end;
2..15:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
writeln('Pretending to looking at another website. (med)');
wait(15000 + randomRange(3000, 9000));
end;
16..19:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
writeln('Pretending to looking at another website. (short)');
wait(1500 + randomRange(1000, 3000));
end;
end;
end;
3, 6:
begin
Case I of
0..2:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
writeln('Pretending to looking at another website. (long)');
wait(30000 + randomRange(10000, 25000));
end;
3..9:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
writeln('Pretending to looking at another website. (med)');
wait(11000 + randomRange(2000, 5000));
end;
10..20:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
writeln('Pretending to looking at another website. (short)');
wait(4000 + randomRange(2000, 7000));
end;
end;
end;
end;
end;

procedure openBank;
var
x, y, i, c: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
RandOpenMethod: Integer;

begin
If Not IsLoggedIn Then
exit;
RandOpenMethod := Random(30)
if (not bankScreen.isOpen()) then
begin

case WHICH_BANK of
'GE':
begin
repeat
if (bankScreen.isOpen()) or (Not IsLoggedIn) then
exit;
productionScreen.clickStart;
findColorsSpiralTolerance(x, y, TPA, 1396848, mainScreen.getBounds(), 11, colorSetting(2, 0.16, 0.36));
ATPA := TPA.toATPA(30, 30);
atpa.sortFromFirstPoint(point(289, 40));
smartImage.debugATPA(ATPA);

if length(TPA) < 1 then
continue;
mouse(287, 82, 5, 30, MOUSE_MOVE);
inc(c);
writeln(intToStr(c));
if isMouseOverText(['anker'], 500) then
begin
fastClick(MOUSE_RIGHT);
wait(100 + random(100));
try
chooseOption.select(['ank']);
wait(800 + random(1600));
except
continue;
end;
end else
begin
if (bankScreen.isOpen()) then
exit;
mouse(middleTPA(ATPA[0]), MOUSE_MOVE);
writeln('Something block us from clicking the chest. Clicking the head..');
if isMouseOverText(['anker'], 500) then
begin
fastClick(MOUSE_RIGHT);
wait(100 + random(100));
try
chooseOption.select(['ank']);
wait(random(4000 + random(5000)));
except
continue;
end;
end;

if (c > 3) then
begin
if (bankScreen.isOpen()) then
exit;
writeln('--- Cannot find banker, resetting angle. ---');
minimap.clickCompass();
MainScreen.SetAngle(MS_ANGLE_HIGH);
wait(1000 + random (2000));
end;
end;
until (c = 30);
if c = 30 then
begin
Writeln('Failed to find the banker. Shutting down.');
TerminateScript;
end;
end;
'CAM':
begin
repeat
if (bankScreen.isOpen()) or (not isLoggedIn) then
exit;
productionScreen.clickStart;
findColorsSpiralTolerance(x, y, TPA, 6989274, mainScreen.getBounds(), 9, colorSetting(2, 0.35, 1.82));
ATPA := TPA.toATPA(50, 50);
atpa.sortFromFirstPoint(point(290, 32));
smartImage.debugATPA(ATPA);

if length(TPA) < 1 then
exit;

For i := 0 to high (ATPA) do
begin
if (bankScreen.isOpen)() then
exit;
mouse(middleTPA(ATPA[i]).x, middleTPA(ATPA[i]).y, 5, 5, MOUSE_MOVE)
if isMouseOverText(['Bank']) then
begin
Case RandOpenMethod of
0..29:
begin
if Bankscreen.isOpen then
exit;
fastClick(MOUSE_LEFT);
inc(c);
wait(1100 + random(600));
break;
end;
30:
begin
if Bankscreen.isOpen then
exit;
fastClick(MOUSE_RIGHT);
chooseOption.select(['Bank']);
inc(c);
wait(800 + random(500));
break;
end;
end;
end else
begin
if Bankscreen.isOpen then
exit;
fastClick(MOUSE_RIGHT);
chooseOption.select(['Bank']);
inc(c);
wait(1100 + random(600));
break;
end;

end;

if c = 4 then
begin
if (bankScreen.isOpen()) then
exit;
writeln('--- Failed to open he bank, resetting angle. ---');
minimap.clickCompass();
wait(randomRange(300, 600));
MainScreen.SetAngle(MS_ANGLE_HIGH);
inc(c);
wait(3000 + random (1500));
exit;
end;
if c = 5 then
begin
if (bankScreen.isOpen()) then
exit;
writeln('--- Failed to open he bank, performing antiban + resetting angle. ---');
inc(c);
boredHuman(true);
wait(random(300));
minimap.clickCompass();
wait(random(300));
MainScreen.SetAngle(MS_ANGLE_HIGH);
end
if c > 5 then
begin
if (bankScreen.isOpen()) then
exit;
begin
writeln('--- Cannot find banker, performing right-click chooseoption. ---');
inc(c);
minimap.clickCompass();
wait(random(300));
MainScreen.SetAngle(MS_ANGLE_HIGH);
wait(3000 + random (1500));
exit;
end;
end;
if c = 7 then
begin
writeln('Failed to find the banker.');
lookingAtWeb;
players[currentPlayer].logout();
end;
until BankScreen.isOpen;
end;

'CAT':
begin
repeat
if (bankScreen.isOpen()) or (not isLoggedIn) then
exit;
productionScreen.clickStart;
findColorsSpiralTolerance(x, y, TPA, 14405576, mainScreen.getBounds(), 8, colorSetting(2, 2.71, 1.76));
ATPA := TPA.toATPA(75, 40);
atpa.sortFromFirstPoint(point(279, 68));
smartImage.debugATPA(ATPA);

if length(TPA) < 1 then
exit;

For i := 0 to high (ATPA) do
begin
if (bankScreen.isOpen)() then
exit;
mouse(middleTPA(ATPA[0]).x, middleTPA(ATPA[i]).y, 10, 10, MOUSE_MOVE)
if isMouseOverText(['Bank']) then
begin
Case RandOpenMethod of
0..29:
begin
if Bankscreen.isOpen then
exit;
fastClick(MOUSE_LEFT);
inc(c);
wait(1100 + random(600));
break;
end;
30:
begin
if Bankscreen.isOpen then
exit;
fastClick(MOUSE_RIGHT);
chooseOption.select(['Bank']);
inc(c);
wait(800 + random(500));
break;
end;
end;
end else
begin
if Bankscreen.isOpen then
exit;
fastClick(MOUSE_RIGHT);
chooseOption.select(['Bank']);
inc(c);
wait(1100 + random(600));
break;
end;

end;

if c = 4 then
begin
if (bankScreen.isOpen()) then
exit;
writeln('--- Failed to open he bank, resetting angle. ---');
minimap.clickCompass();
wait(randomRange(300, 600));
MainScreen.SetAngle(MS_ANGLE_HIGH);
inc(c);
wait(3000 + random (1500));
exit;
end;
if c = 5 then
begin
if (bankScreen.isOpen()) then
exit;
writeln('--- Failed to open he bank, performing antiban + resetting angle. ---');
inc(c);
boredHuman(true);
wait(random(300));
minimap.clickCompass();
wait(random(300));
MainScreen.SetAngle(MS_ANGLE_HIGH);
end
if c > 5 then
begin
if (bankScreen.isOpen()) then
exit;
begin
writeln('--- Cannot find banker, performing right-click chooseoption. ---');
inc(c);
minimap.clickCompass();
wait(random(300));
MainScreen.SetAngle(MS_ANGLE_HIGH);
wait(3000 + random (1500));
exit;
end;
end;
if c = 7 then
begin
writeln('Failed to find the banker.');
lookingAtWeb;
players[currentPlayer].logout();
end;
until BankScreen.isOpen;
end;

'AL':
begin
repeat
if (bankScreen.isOpen()) or (not isLoggedIn) then
exit;
productionScreen.clickStart;
findColorsSpiralTolerance(x, y, TPA, 3449274, mainScreen.getBounds(), 17, colorSetting(2, 0.21, 1.56));
ATPA := TPA.toATPA(50, 50);
atpa.sortFromFirstPoint(point(290, 32));
smartImage.debugATPA(ATPA);

if length(TPA) < 1 then
exit;

For i := 0 to high (ATPA) do
begin
if (bankScreen.isOpen)() then
exit;
mouse(middleTPA(ATPA[i]).x, middleTPA(ATPA[i]).y, 5, 5, MOUSE_MOVE)
if isMouseOverText(['Bank']) then
begin
Case RandOpenMethod of
0..29:
begin
if Bankscreen.isOpen then
exit;
fastClick(MOUSE_LEFT);
inc(c);
wait(1100 + random(600));
break;
end;
30:
begin
if Bankscreen.isOpen then
exit;
fastClick(MOUSE_RIGHT);
chooseOption.select(['Bank']);
inc(c);
wait(800 + random(500));
break;
end;
end;
end else
begin
if Bankscreen.isOpen then
exit;
fastClick(MOUSE_RIGHT);
chooseOption.select(['Bank']);
inc(c);
wait(1100 + random(600));
break;
end;

end;

if c = 4 then
begin
if (bankScreen.isOpen()) then
exit;
writeln('--- Failed to open he bank, resetting angle. ---');
minimap.clickCompass();
wait(randomRange(300, 600));
MainScreen.SetAngle(MS_ANGLE_HIGH);
inc(c);
wait(3000 + random (1500));
exit;
end;
if c = 5 then
begin
if (bankScreen.isOpen()) then
exit;
writeln('--- Failed to open he bank, performing antiban + resetting angle. ---');
inc(c);
boredHuman(true);
wait(random(300));
minimap.clickCompass();
wait(random(300));
MainScreen.SetAngle(MS_ANGLE_HIGH);
end
if c > 5 then
begin
if (bankScreen.isOpen()) then
exit;
begin
writeln('--- Cannot find banker, performing right-click chooseoption. ---');
inc(c);
minimap.clickCompass();
wait(random(300));
MainScreen.SetAngle(MS_ANGLE_HIGH);
wait(3000 + random (1500));
exit;
end;
end;
if c = 7 then
begin
writeln('Failed to find the banker.');
lookingAtWeb;
players[currentPlayer].logout();
end;
until BankScreen.isOpen;
end;
end;
end;
end;





procedure openExchange;
var
x, y, i, c: integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
if (not bankScreen.isOpen()) then
begin
findColorsSpiralTolerance(x, y, TPA, 4858414, mainScreen.getBounds(), 7, colorSetting(2, 0.16, 0.44));
if length(TPA) < 1 then
exit;

ATPA := TPA.toATPA(30, 100);
atpa.sortFromFirstPoint(point(451, 60));
smartImage.debugATPA(ATPA);

repeat
mouse(middleTPA(ATPA[0]), MOUSE_MOVE);
if isMouseOverText(['xchang'], 2000) then
begin
fastClick(MOUSE_LEFT);
inc(c);
wait(random(2000));
end;
until (bankScreen.isOpen()) or (c = 10);
end;
end;

procedure bankDeposit;
var
c: integer;
begin
if not isLoggedIn() then
exit
else
if (bankScreen.isOpen()) then
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
end;

procedure withdrawItems;
Var
T: TTimeMarker;
Time: Integer;
begin
if not isLoggedIn() then
exit;
if (not bankScreen.isOpen()) then
begin
Writeln('We are not at bank');
openBank;
end;
T.Reset;
T.Start;
Time:=GaussRangeInt(10000, 16000);
repeat
If (Not IsLoggedIn) Then
Exit;
case currentSecondary of
1:
begin
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
writeln('clicked preset');
end;
2:
begin
bankScreen.clickButton(BANK_BUTTON_PRESET_2);
end;
end
until (not bankScreen.isOpen()) or (T.GetTime>Time)

end;

procedure withdrawCleans;
begin
if not isLoggedIn() then
exit
if (not bankScreen.isOpen()) then
begin
Writeln('We are not at bank');
openBank;
end else
if random(75) > 73 then
begin
writeln('Pretending to looking at another website');
mouseOffClient(OFF_CLIENT_RANDOM);
wait(randomRange(5000, 25000));
end;
try
begin
bankScreen.withdraw(8, 28, ['']); //withraw 14 vials //close the bank...
end;
except
bankDeposit;
end;
end;

procedure blueButtom;
var
x, y, i: integer;
T: TTimeMarker;
Time: Integer;
begin
if not isLoggedIn then
exit;
T.Reset;
T.Start;
Time:=GaussRangeInt(6000, 12000);
Repeat
If Productionscreen.IsOpen Then
Break;
Wait(GaussRangeInt(0, 500));
If (Not IsLoggedIn) Or (T.GetTime>Time) Then
Exit;
Until Productionscreen.IsOpen;

Wait(GaussRangeInt(0, 400));

Productionscreen.ClickStart;


If Not TabBackpack.WaitForShift(RandomRange(2000,4000)) Then
Exit;

Wait(GaussRangeInt(0, 1500));

end;

procedure Unfs;
var
x, y, c, lookFor: integer;
begin
if not isLoggedIn() then
exit
else
c := 0;
Antiban;
openBank;
lookingAtWeb;
withdrawItems;
tabBackpack.waitWhileLocked();
writeln('looking for vial');
wait(100 + GaussRangeInt(100, 140));
repeat
wait(800 + GaussRangeInt(600, 800));
tabBackpack.open();
if (findDTM(vialDTM, x, y, tabBackpack.getBounds())) or (tabBackpack.isItemInSlot(14)) then
begin
writeln('Found vial');
break;
end else
begin
writeln('Didnt find vial');
end;
inc(c);
until c > 3;
if (not findDTM(vialDTM, x, y, tabBackPack.getBounds())) or (not tabBackpack.isItemInSlot(14)) then
{--------------------------------------------------------------------------------)
Checks why there wasn't vial of water in the preset withraw and whether you have it in your bank.
(--------------------------------------------------------------------------------}
begin
c := 0; //reset c
writeln('--- Could not find Vial of water in your backpack. I will look if there are any in bank ---');
openBank;
wait(GaussRangeInt(500, 1000));
if (findDTM(vialDTM, x, y, bankscreen.getBounds())) then
begin
writeln('You have vial of water in bank! Lets try if it will appear in inventory now.');
withdrawItems;
repeat
wait(800 + GaussRangeInt(600, 800));
inc(c);
if findDTM(vialDTM, x, y, bankscreen.getBounds()) then
break;
until (c > 8);
if (not findDTM(vialDTM, x, y, bankscreen.getBounds())) then
begin
writeln('It seems like you do not have vial of water in quick preset option!');
players[currentPlayer].logout();
wait(GaussRangeInt(8000, 15000));
TerminateScript;
end;
end else
begin
writeln('Didnt find vial of water in bank. Terminating');
BnkClose;
players[currentPlayer].logout();
wait(GaussRangeInt(8000, 15000));
TerminateScript;
end;
end else
{--------------------------------------------------------------------------------}

if (tabBackpack.isFull) or (tabBackpack.isItemInSlot(28)) then
begin
begin
wait(500 + random(200));
lookingAtWeb;
end;
if (Random(20) < 6) then
mouse(771, 413, 5, 5, MOUSE_MOVE)
else
mouse(733, 449, 5, 5, MOUSE_MOVE);
wait(50 + random(30));
fastClick(MOUSE_LEFT);
wait(200 + random(200));
mouse(729, 416, 5, 5, MOUSE_MOVE);
mouse(729, 416, 5, 5, MOUSE_LEFT);
BlueButtom;
antiban;
tabBackpack.waitSlotPixelChange(13,18000);
lookingAtWeb;
checkForTickets;
case randomType of
1, 4:
wait(1000 + random(500));
2, 5:
wait(700 + Random(400));
3, 6:
wait(100 + random(600));
end;
end else
begin
case secondaries of
1:
begin
writeln('Seems like we have run out of the herbs. Trying once again');
openBank;
withdrawItems;
wait(GaussRangeInt(2000, 3500));
if ( not tabBackpack.isFull) or (not tabBackpack.isItemInSlot(28)) then
writeln('We have really run out of herbs.');
LookingAtWeb;
Antiban;
wait(GaussRangeInt(2000, 9000));
players[currentPlayer].logout();
TerminateScript;
end;
2:
if (currentSecondary := 1) then
begin
writeln('Seems like we have run out of the 1st resource. Trying once again');
openBank;
withdrawItems;
wait(GaussRangeInt(2000, 3500));
if ( not tabBackpack.isFull) or (not tabBackpack.isItemInSlot(28)) then
writeln('We have really run out of the 1st resource. Switching to the second ingredient.');
currentSecondary := 2;
end else
begin
writeln('Seems like we have run out of the 2nd resource. Trying once again');
openBank;
withdrawItems;
wait(GaussRangeInt(2000, 3500));
if ( not tabBackpack.isFull) or (not tabBackpack.isItemInSlot(28)) then
writeln('We have really run out of the 2nd resource. Terminating.');
LookingAtWeb;
Antiban;
wait(GaussRangeInt(2000, 9000));
players[currentPlayer].logout();
TerminateScript;
end;
end;
end;
end;

procedure Pots;
var
x, y, c, lookFor: integer;
begin
if not isLoggedIn() then
exit
else
Antiban;
openBank;
lookingAtWeb;
withdrawItems;
wait(100 + GaussRangeInt(100, 140));
wait(800 + GaussRangeInt(600, 800));
tabBackpack.open();
if (tabBackpack.isFull) or (tabBackpack.isItemInSlot(28)) then
begin
begin
wait(500 + random(200));
lookingAtWeb;
end;
if (Random(20) < 6) then
mouse(771, 413, 5, 5, MOUSE_MOVE)
else
mouse(733, 449, 5, 5, MOUSE_MOVE);
wait(50 + random(30));
fastClick(MOUSE_LEFT);
wait(200 + random(200));
mouse(729, 416, 5, 5, MOUSE_MOVE);
mouse(729, 416, 5, 5, MOUSE_LEFT);
BlueButtom;
antiban;
tabBackpack.waitSlotPixelChange(13,18000);
lookingAtWeb;
checkForTickets;
case randomType of
1, 4:
wait(1000 + random(500));
2, 5:
wait(700 + Random(400));
3, 6:
wait(100 + random(600));
end;
end else
begin
case secondaries of
1:
begin
writeln('Seems like we have run out of the unf pots/vials of water. Trying once again');
openBank;
withdrawItems;
wait(GaussRangeInt(2000, 3500));
if ( not tabBackpack.isFull) or (not tabBackpack.isItemInSlot(28)) then
writeln('We have really run out of unf pots/vials of water.');
LookingAtWeb;
Antiban;
wait(GaussRangeInt(2000, 9000));
players[currentPlayer].logout();
end;
2:
if (currentSecondary := 1) then
begin
writeln('Seems like we have run out of the 1st resource. Trying once again');
openBank;
withdrawItems;
wait(GaussRangeInt(2000, 3500));
if ( not tabBackpack.isFull) or (not tabBackpack.isItemInSlot(28)) then
writeln('We have really run out of the 1st resource. Switching to the second ingredient.');
currentSecondary := 2;
end else
begin
writeln('Seems like we have run out of the 2nd resource. Trying once again');
openBank;
withdrawItems;
wait(GaussRangeInt(2000, 3500));
if ( not tabBackpack.isFull) or (not tabBackpack.isItemInSlot(28)) then
writeln('We have really run out of the 2nd resource. Terminating.');
LookingAtWeb;
Antiban;
wait(GaussRangeInt(2000, 9000));
players[currentPlayer].logout();
TerminateScript;
end;
end;
end;
end;

procedure Cleaner;
var
x, y, c, lookFor: integer;
begin
if not isLoggedIn() then
exit
else
Antiban;
openBank;
lookingAtWeb;
withdrawItems;
wait(800 + GaussRangeInt(600, 800));
tabBackpack.open();
if (tabBackpack.isFull) or (tabBackpack.isItemInSlot(28)) then
begin
begin
wait(GaussRangeInt(400, 800));
lookingAtWeb;
end;
if (Random(20) < 6) then
mouse(602, 346, 5, 5, MOUSE_MOVE)
else
mouse(645, 382, 5, 5, MOUSE_MOVE);
wait(50 + random(30));
fastClick(MOUSE_LEFT);
BlueButtom;
antiban;
tabBackpack.waitSlotPixelChange(26,18000);
lookingAtWeb;
checkForTickets;
case randomType of
1, 4:
wait(1000 + random(500));
2, 5:
wait(700 + Random(400));
3, 6:
wait(100 + random(600));
end;
end else
begin
case secondaries of
1:
begin
writeln('Seems like we have run out of the grimy herbs. Trying once again');
openBank;
withdrawItems;
wait(GaussRangeInt(2000, 3500));
if ( not tabBackpack.isFull) or (not tabBackpack.isItemInSlot(28)) then
writeln('We have really run out of grimy herbs.');
LookingAtWeb;
Antiban;
wait(GaussRangeInt(2000, 9000));
players[currentPlayer].logout();
TerminateScript;
end;
2:
if (currentSecondary := 1) then
begin
writeln('Seems like we have run out of the 1st resource. Trying once again');
openBank;
withdrawItems;
wait(GaussRangeInt(2000, 3500));
if ( not tabBackpack.isFull) or (not tabBackpack.isItemInSlot(28)) then
writeln('We have really run out of the 1st resource. Switching to the second ingredient.');
currentSecondary := 2;
end else
begin
writeln('Seems like we have run out of the 2nd resource. Trying once again');
openBank;
withdrawItems;
wait(GaussRangeInt(2000, 3500));
if ( not tabBackpack.isFull) or (not tabBackpack.isItemInSlot(28)) then
writeln('We have really run out of the 2nd resource. Terminating.');
LookingAtWeb;
Antiban;
wait(GaussRangeInt(2000, 9000));
players[currentPlayer].logout();
TerminateScript;
end;
end;
end;
end;

Procedure Setup
var
bmp: integer;
begin

clearDebug();
initPlayerForm(); // initiate your settings
runPlayerForm(); // run the form
// use this so the script doesn't continue if the user exits out of the form
if (not playerForm.isScriptReady) then
terminatescript;
disableSRLDebug := false; // Clear the debug box
smartEnableDrawing := true; // So we can draw on SMART
declarePlayers(); // Set up your username/pass
if DIRECT_X then
smartPlugins := ['d3d9.dll'];
setupSRL();
bmp := bitmapFromClient(0, 0, getClientBounds().x2 -1, getClientBounds().y2 -1);
freeBitmap(bmp);

setupDTMz;
addOnTerminate('__freeMinimapMask');
addonterminate('freeDTMz');
MIN_P_BK := (Players[CurrentPlayer].Integers[0]);
MAX_P_BK := (Players[CurrentPlayer].Integers[1]);
MIN_B_BK := (Players[CurrentPlayer].Integers[2]);
MAX_B_BK := (Players[CurrentPlayer].Integers[3]);
end;

// main loop
procedure MainLoop;
begin
Setup;
resetBreakTimer;
if (not gameTabs.isTabActive(TAB_BACKPACK)) then
gameTabs.openTab(TAB_BACKPACK)
case WHICH_BANK of
'AL', 'CAM', 'GE', 'CAT':
begin
minimap.clickCompass();
MainScreen.SetAngle(MS_ANGLE_HIGH);
end;
end;
repeat
case randomType of
1, 4:
MouseSpeed := randomRange(22, 25);
2, 5:
MouseSpeed := randomRange(24, 27);
3, 6:
MouseSpeed := randomRange(23, 29);
end;
if not isLoggedIn() then // If player isn't logged in then
begin
players[currentPlayer].login(); // Log them in
wait(7000 + random(3000));
exitSquealOfFortune();
minimap.clickCompass();
tabBackpack.open();
end;
if WHAT_TO_DO = 'Unfs' then
begin
Unfs;
end;
if WHAT_TO_DO = 'Cleans' then
begin
Cleaner;
end;
if WHAT_TO_DO = 'Pots' then
begin
Pots;
end;
TakeBreak;
inc(runsDone);
writeln('||-------------' + (Timerunning) + '------------||');
writeln('||-------------Made ' + IntToStr(runsDone) + ' runs------------||');
writeLn(padR('|| Breaking in: ' + timeUntilBreak, 38) + '||');
writeln(padR('|| Breaks taken: ' + toStr(breaked), 38) + '||');
smartImage.clear();
until(false);
end;

begin
MainLoop;
end.

Here are the last debug lines:

---- Current mouse-over text: "Bank Bank booth"
---- Found "Bank" in mouse-over string: "Bank Bank booth"
-- isMouseOverText(): True
clicked preset
clicked preset

Ashaman88

2014-05-12 13:04:30

I think it's mostly logic errors from copying stuff from the include - which had some infinite loops in there and have been fixed as of last night. Why don't you just use the include functions?