SRL Archive - RS3 Help

Timer not working


lanadekat

2014-09-14 09:36:06

this is the procedure:

var
bankTimer: TTimeMarker;

begin
banktimer.start();
repeat
bankscreen.open(BANK_NPC_GREY)
until bankscreen.isopen()
if (bankTimer.getTime() > 60000) then
TeleportToBank();
end;

It doesn't go to TeleportToBank();

Oh and also if I use this for another thing I don't want to share It will always click the same pixel, is there a way to let it click other pixels?

findColorsSpiralTolerance(x, y, TPA, BANKER_COLOR, mainScreen.getBounds(), 20, colorSetting(BANKER_TOL, BANKER_SAT, BANKER_HUE));

if (Length(TPA) < 1) then
writeLn('no banker"s found!');


ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(8, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);


begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Bank','ank','Banker','anker'], 500) then
fastClick(MOUSE_LEFT);

sf411

2014-09-14 09:52:49

bankscreen.open(BANK_NPC_GREY)
until bankscreen.isopen()

if this is a direct copy paste both lines need a semicolon and .isOpen()should be capitalized.

masterBB

2014-09-14 09:53:24

You probably wanted it in the loop?

var
bankTimer: TTimeMarker;

begin
banktimer.start();
repeat
bankscreen.open(BANK_NPC_GREY)
if (bankTimer.getTime() > 60000) then
TeleportToBank();
until(bankscreen.isopen());
end;

lanadekat

2014-09-14 09:56:08

From: masterBB
You probably wanted it in the loop?

var
bankTimer: TTimeMarker;

begin
banktimer.start();
repeat
bankscreen.open(BANK_NPC_GREY)
if (bankTimer.getTime() > 60000) then
TeleportToBank();
until(bankscreen.isopen());
end;

procedure Bank();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
bankTimer: TTimeMarker;
InBank : Tbox;
begin
banktimer.start();
InBank := IntToBox(346,170,362,186);
repeat
if (bankTimer.getTime() > 60000) then TeleportToBank();
findColorsSpiralTolerance(x, y, TPA, BANKER_COLOR, mainScreen.getBounds(), 20, colorSetting(BANKER_TOL, BANKER_SAT, BANKER_HUE));

if (Length(TPA) < 1) then
writeLn('no banker"s found!');


ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(8, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);


for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Bank','ank','Banker','anker'], 500) then
fastClick(MOUSE_LEFT);
end;
smartImage.clear;
until bankScreen.isOpen();
wait(randomRange(500, 1000));
bankScreen.deposit([2..28]);
wait(randomRange(500, 1000));
BankScreen.close();
wait(randomRange(500, 2000));
end;

That's the full code

cosmasjdz

2014-09-14 12:07:16

begin
banktimer.start();
repeat
bankscreen.open(BANK_NPC_GREY)
until bankscreen.isopen()
if (bankTimer.getTime() > 60000) then
TeleportToBank();
end;


Ok now ur script looks like: start timer, wait untill bankscreen is open, if at the time the bank screen is open is 60+secs passed then teleport. but whats if its open faster? you dont teleport, thats whats happening, fix logic.






mouse(middleTPA(ATPA), MOUSE_MOVE);



For the second one issue is you can do something like:
mouse(middleTPA(ATPA[i]).x+random(-5,5),middleTPA(ATPA[i]).y+random(-5,5), MOUSE_MOVE);

lanadekat

2014-09-14 14:51:03

From: cosmasjdz
Ok now ur script looks like: start timer, wait untill bankscreen is open, if at the time the bank screen is open is 60+secs passed then teleport. but whats if its open faster? you dont teleport, thats whats happening, fix logic.









For the second one issue is you can do something like:
mouse(middleTPA(ATPA[i]).x+random(-5,5),middleTPA(ATPA[i]).y+random(-5,5), MOUSE_MOVE);


It takes 10 sec to open the bank so that won't happen and for some reason it works now.

And thanks for your code I'm going to try it out tomorrow, gotta go to sleep now school tomorrow :(
the 5 = amount of pixels?

cosmasjdz

2014-09-14 16:15:12

yep, it is +-5 pixels box around the center actually, may be little toobig, i usually use +-3

The Mayor

2014-09-14 16:47:18

You should exit your procedure if you didn't find any colours (if length(TPA) < 1). If you try and split an empty TPA into an ATPA it will most likely throw an error (see below for simple fix).

When you go: ATPA.filterBetween(8, 10); you are removing any TPAs with between 8 and 10 pixels. Do you want to retain the TPAs with only 3 matching TPoints?

Also if you:
mouseBox(ATPA[i].getBounds(), MOUSE_MOVE); 

it won't click the midpoint of the TPA, but somewhere inside it's bounds, with a higher change of clicking closer to the middle. If you want a completely random point, you can:
mouse(ATPA[i].getBounds().getRandomPoint(), MOUSE_MOVE);


procedure Bank();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
bankTimer: TTimeMarker;
InBank : Tbox;
begin
banktimer.start();

InBank := IntToBox(346,170,362,186); //what is this used for?

repeat
if (bankTimer.getTime() > 60000) then
TeleportToBank();

findColorsSpiralTolerance(x, y, TPA, BANKER_COLOR, mainScreen.getBounds(), 20, colorSetting(BANKER_TOL, BANKER_SAT, BANKER_HUE));

if (Length(TPA) < 1) then
begin
writeLn('no banker"s found!');
exit;
end;

ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(8, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouseBox(ATPA[i].getBounds(), MOUSE_MOVE);
if isMouseOverText(['Bank','ank','Banker','anker'], 500) then
fastClick(MOUSE_LEFT);
end;

smartImage.clear;

until bankScreen.isOpen();

wait(randomRange(500, 1000));
bankScreen.deposit([2..28]);
wait(randomRange(500, 1000));
BankScreen.close();
wait(randomRange(500, 2000));
end;

Lipcot

2014-09-14 18:47:44

From: The Mayor
When you go: ATPA.filterBetween(8, 10); you are removing any TPAs with between 8 and 10 pixels. Do you want to retain the TPAs with only 3 matching TPoints?


Interesting, i just keep learning from all your posts, this means that any TPA between 8 and 10 pixels WONT be taken into account in the ATPA??

BTW gratz on senior member (just saw you got it :o)

The Mayor

2014-09-14 18:56:26

From: undorak7
Interesting, i just keep learning from all your posts, this means that any TPA between 8 and 10 pixels WONT be taken into account in the ATPA??

BTW gratz on senior member (just saw you got it :o)


They will be deleted from the array. Lets say you found a whole bunch of colours and all the matching TPoints were put into a TPA:


Then you wanted to split that into an ATPA:


And then you filterBetween(1, 10), it will remove the TPAs will between 1 and 10 points:


Lipcot

2014-09-14 19:15:41

From: The Mayor
They will be deleted from the array. Lets say you found a whole bunch of colours and all the matching TPoints were put into a TPA:


Then you wanted to split that into an ATPA:


And then you filterBetween(1, 10), it will remove the TPAs will between 1 and 10 points:



awesome explanation, totally understood, thanks!