SRL Archive - OSR Help

help me open bank


westkevin12

2013-04-27 01:20:44

ok so i'm trying to write a script to mine iron and bank it in yanill and i have already run into problems with the script in my first procedure trying to open the bank. here is what i have atm please help me fix this. it will log me in and put the mouse on the bank boot but it won't click to open the bank

program westkevin12yanilironminer;
{$DEFINE SMART8}
{$I SRL/SRL.Simba}
{$I P07Include.Simba}



procedure P07_DeclarePlayer;
Begin
P07_PlayerName:='';
P07_PlayerPass:='';

end;
procedure OpenMyBank;
var x,y: Integer;

begin
P07_MakeCompassEast;
P07_MakeCameraAngleHigh;
if FindColorTolerance(x, y, 7112083, 200, 62, 519, 174, 10)then
MMouse(x, y, 2, 2);
wait(100);
if not(IsUpTextMultiCustom(['nk boo'])) then
repeat until
(IsUpTextMultiCustom(['nk boo']));
if (IsUpTextMultiCustom(['nk boo'])) then
begin
clickMouse2(MOUSE_left);
end;
end;
begin

SetupSRL;
P07_DeclarePlayer;
SetupP07Include;
If Not P07_LoggedIn Then
P07_LoginPlayer;
wait(5000);
OpenMyBank;

end.

The Mayor

2013-04-27 01:29:35



procedure OpenMyBank;
var
x,y, attempts: Integer;

begin
P07_MakeCompassEast;
P07_MakeCameraAngleHigh;
repeat
Inc(attempts) // each time it starts the loop it will add 1 to attempts
if FindColorTolerance(x, y, 7112083, 200, 62, 519, 174, 10)then
begin
MMouse(x, y, 2, 2);
wait(100);
if (IsUpTextMultiCustom(['nk boo'])) then
clickMouse2(MOUSE_left);
end;
until (BankScreen) or (PinScreen) or (attempts > 10); // it will break out of the loop is it finds bank/pin screen or if it has tried 10 times.

if (Attempts > 10) then
WriteLn('We failed to find the banker after 10 attempts')
end;



westkevin12

2013-04-27 01:31:30

wow way cool idea to add 10 attempts! thanks so much

The Mayor

2013-04-27 01:33:46

From: westkevin12
wow way cool idea to add 10 attempts! thanks so much


You should never have an infinite loop. What happens if it couldn't find the banker? It would be looking over and over again for hours, which will lead to a ban :)

westkevin12

2013-04-27 01:35:20

thanks i'll use that advice in the rest of my script to then

westkevin12

2013-04-27 01:39:48

I tested the procedure the way you wrote it this time and it still doesn't click the text bank booth is up but it's just not clicking for some reason, any ideas?

The Mayor

2013-04-27 02:28:37

From: westkevin12
I tested the procedure the way you wrote it this time and it still doesn't click the text bank booth is up but it's just not clicking for some reason, any ideas?


It might be something to do with the fonts. I've never used the P07 include so I'm not sure sorry :(

On a side note, it might be wise to start scripting with the SRL-OSR include as the P07 Include will probably be redundant in the near future. If you don't already have it, I would advise checking it out :)