SRL Archive - OSR Help

Simple Logic Help


YoHoJo

2012-02-28 22:50:56

Just got brain-dead.. bleg :D.

    Function OpenBank:Boolean;
Var
ClickedBank:Integer;
Begin
If ClickObject('Booth') Then
Begin
MarkTime(ClickedBank)
Repeat
Wait(10)
If TimeFromMark(ClickedBank) > 5000 Then Break
Until (YBankOpen);
If TimeFromMark(ClickedBank) > 5000 Then

What I want

Open Bank
Wait Until YBankOpen Or 5 seconds have passed
If YBankOpen then it can break/exit/end/finito
If 5 seconds have passed, start over, and try opening the bank again.

Thanks!

bolshak25

2012-02-28 22:53:26


a:=0;
repeat
If OpenBankFast(Bank) then
break;
Inc(a);
Wait(250+Random(150));
Until (a>5)
if (a>5) then
begin
Writeln('Cant Open Bank');
NextPlayer(False);
exit;
end;

thats my bank procedure. not exactly what you want, but the logic is there

Brandon

2012-02-28 23:03:26


Function YohojoBank: Boolean;
var
T, Tries: Integer;
Bool: Boolean;
begin
While (Tries < 3) do
begin
Result := (LoggedIn and BankScreen);
if (Result) then
Exit;

T:= 0;
MarkTimeT(T);
Bool:= ClickObject('Booth');
while ((Not Bool) and (TimeFromMark(T) < 5000) or (Not (LoggedIn and BankScreen) or Not PinScreen)) do
wait(1);
Inc(Tries);
end;
if (Length(Players) > 0) then
if ((PinScreen) and (Players[CurrentPlayer].Pin <> '')) then
InPin(Players[CurrentPlayer].Pin);

Result:= (LoggedIn and BankScreen);
end;

weequ

2012-02-28 23:03:36


Function OpenBank:Boolean;
Var
ClickedBank, fails:Integer;
Begin
Fails := 0;
Result := False;
repeat
If ClickObject('Booth') Then
Begin
MarkTime(ClickedBank)
Repeat
Wait(10)
If TimeFromMark(ClickedBank) > 5000 Then Break
Until (YBankOpen);
Result := YBankOpen;
end else Wait(1000);
Inc(Fails);
until(Result or Fails > 5);
end;

v2:

Function OpenBank:Boolean;
Var
ClickedBank, fails:Integer;
Begin
Fails := 0;
Result := False;
repeat
Inc(Fails);
If ClickObject('Booth') Then
Begin
MarkTime(ClickedBank)
Repeat
Wait(10)
If YBankOpen Then
begin
Result := True;
Exit;
end;
Until (TimeFromMark(ClickedBank) > 5000);
end else Wait(1000);
until(Fails > 5);
end;

Runescape Pro

2012-02-28 23:17:39

Something like this I think(won't be the specific code but the logic will be there):
Function OpenBank: Boolean;
Var
T: Integer;
Label
Start;
Begin
Result:=False;
Start:
MarkTime(T);
Repeat
If OpenBooth Then Result:=True;
Until(YBankOpen OrTimeFromMark(T) > 5000);
If Result:= False Then GoTo Start;
End;

Er1k

2012-02-29 05:22:16

Something like this?
function DoBanking: boolean;
begin
repeat
ClickObject('booth');
; //failsafe against infinite loop please
until waitFunc(@YBankOpen, 500, 5000);

;//do banking stuff here
end;

JuKKa

2012-02-29 07:33:44


Procedure OpenandBankStuff;
Var
X, Y, T, I, Steelbar: Integer;
Label
OpenBanklbl, BankHandle;
begin
if not loggedin then exit;
//Bank_AK
T := GetSystemTime;
OpenBanklbl:
If(BankScreen)Then
Begin
I := 0;
Goto BankHandle;
End;
If(GetSystemTime - T > 120000)Then
Begin
Writeln('banking took too long');
CloseBank;
Logout;
Exit;
End;
If(I > 10)Then
Begin
Writeln('Cant find no bank');
Wait(1500);
Logout;
Exit;
End;
OpenAKBank;
Inc(I);
Goto OpenBanklbl;
//never here
BankHandle:
if(I > 2)Then
Begin
Writeln('Cant find no steelbars wtf');
Wait(1500);
CloseBank;
Logout;
Exit;
End;
DepositAll;
Steelbar := BitmapFromString(13, 11, 'meJyLjUuKxY1qahohiBg1QGRsbA' +
'pHuNSgKUNGg1kZskpkr+FSBpSqr2+Vl1eAIEz1cDXIyjDVw9UAEQC' +
'pgY0d');
If FindBitmapToleranceIn(Steelbar, x, y, MBX1, MBY1, MBX2, MBY2, 25) then
Begin
Mouse(X, Y, 9, 9, False);
if not ChooseOption('ithdraw-All')then
begin
Inc(I);
Goto BankHandle;
end else
SteelbarsDone := SteelbarsDone + 28;
End else
Begin
SearchBank('Steel bar');
Wait(350+Random(250));
Inc(I);
Goto BankHandle;
End;
FreeBitmap( Steelbar );
end;

I use this in a few Al-Kharid banking scripts i have.

this is how i open the bank


function OpenAKBank: Boolean;
var
P: TPoint;
arP: TPointArray;
ar2P: T2DPointArray;
c, tmpCTS, i: Integer;
begin
WaitFunc(@Inverted_Ismoving, 50, 3000);

tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 10340332, MSX1, MSY1, MSX2, MSY2, 23);
ar2P := TPAtoATPAEx(arP, 40, 40);
SortATPAFrom(ar2P, Point(MSCX - 50, MSCY - 40));
for i := 0 to high(ar2P) do
begin
P := MiddleTPA(ar2P[I]);
//usually around 250 the "Inrange" can be lowered...
C := CountColorTolerance(4409678, P.X - 30, P.Y - 30, P.X + 30, P.Y + 30, 16);
If ( InRange(C, 200, 350))Then
Begin
MMouse(P.x, P.y, 8, 8);
if WaitUpTextMulti(['Bank', 'ank', 'booth', 'ooth'], 500)then
Begin
//Writeln('boothcount '+inttostr(C));
GetMousePos(P.x, P.y);
Mouse(p.x, P.y, 0, 0, true);
if not DidRedClick then break;
FFLag(0);
MarkTime(c);
repeat
Wait(100);
until (BankScreen) or (PinScreen) or (TimeFromMark(c) > 10000);
Wait(Random(300));
if (HowManyPlayers > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
if (Result) then Break;
End;
End;
end;
If(Result)Then
Writeln('Bank open');
ColorToleranceSpeed(tmpCTS);
end;

feel free to copy/edit but leave credits if u release