PDA

View Full Version : Nothing happening...?



Element17
05-14-2014, 06:23 PM
procedure findBanker();
var
x, y, i: integer;
TPA:TPointArray;
ATPA: T2DPointArray;
begin
findColorsSpiralTolerance(x, y, TPA, 4224566, mainScreen.getBounds(), 15, colorSetting(2, 1.72, 0.42));

if length(TPA) < 1 then
exit;
ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ank'], 500) then
begin
fastClick(MOUSE_LEFT);
break;
end;
end;


end;

It cant be the color because I got it us ACA and I logged in and out probably 15 times and on different servers. I click run it compilies then ends. Doesn't do anything else and I also tried to debug it using tmb.debugATPA(atpa);

It is the banker at Daemonheim

Foundry
05-14-2014, 06:54 PM
What was the result of the debug? Nothing? I don't really see why it wouldn't work.

Also, You can use the result of findColorsSpiralTolerance to exit if no colors are found.

if not findColorsSpiralTolerance(x, y, TPA, 4224566, mainScreen.getBounds(), 15, colorSetting(2, 1.72, 0.42)) then
exit;

Zyt3x
05-14-2014, 08:48 PM
Learning how to debug properly is the best way you can help yourself for situations like these.
Debug your TPA and ATPA (by overlaying them on a bitmap of the client and then displaying that on the debugimgwindow) and add writeln's in the code to check what line of your script is running at what times.

The Mayor
05-14-2014, 08:53 PM
That code looks ok, if it's not the colors (check with the paint debugging like others said) it must be something else in your script.

Olly
05-14-2014, 09:48 PM
You should post the whole script your testing it with.

Element17
05-15-2014, 01:23 AM
The debug doesn't do anything. Nothing shows up

program PieShellSmasher;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
//{$I SPS/LIB/SPS-RS3.simba}

procedure loggedIn();
begin
if isLoggedIn() then
writeLn('Yay we are logged in')

else writeln('We are not logged in');
Exit;
end;

procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;

procedure findRandoms();
begin
exitTreasure();
claimTicket();
end;

procedure findBanker();
var
x, y, i: integer;
TPA, Player_TPA:TPointArray;
ATPA: T2DPointArray;
begin
Player_TPA := TPAFromBox(IntToBox(245, 130, 285, 195));
if findColorsSpiralTolerance(x, y, TPA, 4224566, mainScreen.getBounds(), 15, colorSetting(2, 1.72, 0.42)) then
begin
TPA := ClearTPAFromTPA(TPA, Player_TPA);
if length(TPA) < 1 then
exit;
smartImage.debugTPA(TPA, false);
ATPA := TPA.toATPA(30, 30);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ank'], 500) then
begin
fastClick(MOUSE_LEFT);
break;
end;
end;


end;
end;

procedure getPie(waitTime: integer = 0);
var
t: integer;
begin
t := getSystemTime + waitTime;
while getSystemTime < t do
begin
if (not BankScreen.isOpen()) then
begin
writeLn('Bank is not open.');
exit;
end;
if bankScreen.isOpen() then
begin

bankScreen.clickbutton(BANK_BUTTON_SEARCH);
writeLn('Searching bank for pie dish');
wait(1000 + random(750));
typeSend('Pie dish');
wait(1000 + random(750));
mouseBox(bankScreen.getBankSlotBox(1), mouse_move);
end;
if (isMouseOverText(['With', 'draw'], 400)) then
begin
fastClick(MOUSE_RIGHT);
wait(250 + random(500));
chooseOption.select(['-X']);
wait(750 + random(750));
typeSend('14');
if tabBackpack.waitCount(14, 1000 + random(500)) then
writeln('Backpack count is now 14!');
end;
end;
end;


procedure getPast(waitTime: integer = 0);
var
t: integer;
begin
t := getSystemTime + waitTime;
while getSystemTime < t do
begin
if (bankScreen.isOpen()) then

bankScreen.clickbutton(BANK_BUTTON_SEARCH);
writeLn('Searching bank for pastry dough');
wait(2000);
typeSend('Pastry dough');
wait(2000);
mouseBox(bankScreen.getBankSlotBox(1), mouse_move);
if (isMouseOverText(['With', 'draw'], 400)) then
begin
fastClick(MOUSE_RIGHT);
wait(100 + random(250));
chooseOption.select(['-X']);
wait(2000);
typeSend('14');
if tabBackpack.waitCount(28, 1000 + random(500)) then
writeln('Backpack count is now 28!');
end;
end;
end;








begin
clearDebug(); // Clear the debug box
smartEnableDrawing := true; // So we can draw on SMART
loggedIn();
findBanker(); // Load the SRL include files


end.

Flight
05-15-2014, 01:28 AM
Try debugging with this instead:

procedure findBanker();
var
x, y, i: integer;
TPA:TPointArray;
ATPA: T2DPointArray;
begin
if not findColorsSpiralTolerance(x, y, TPA, 4224566, mainScreen.getBounds(), 15, colorSetting(2, 1.72, 0.42)) then
begin
writeln('Colors not found!');
exit;
end;

ATPA := TPA.toATPA(30, 30);
writeln(toStr(length(ATPA))+' ATPAs found');
ATPA.sortFromMidPoint(mainscreen.playerPoint);
for i := 0 to high(ATPA) do
begin
writeln('Index: '+toStr(i));
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ank'], 500) then
begin
fastClick(MOUSE_LEFT);
break;
end;
end;

writeln('Failed to find the correct uptext');
end;