SRL Archive - OSR Help

Opening Bank Procedure?


ffcfoo

2012-06-25 07:15:48

Hello, I am trying to get the hang of scripting but I keep getting this error and I don't know what is wrong with the procedure.

procedure OpenBank1;
begin
if OpenBank('clt', False, True) then
Withdraw('flax')
else
Writeln('Failed to Open Bank, Trying again!')

begin
Wait(1000);
if OpenBank('clt', True, True) then
Withdraw('flax')
else
Writeln('Failed to Open Bank, Trying again!');

begin
Wait(1000);
if OpenBank('clt', True, True) then
Withdraw('flax')
else
Writeln('Failed to Open Bank, Loggin off!');
Wait(1000);
logout;
end;
end;
end;

Heres the error:

[Error] (58:3): Invalid number of parameters at line 57

This line

procedure OpenBank1;
begin
if OpenBank('clt', False, True) then
Withdraw('flax')
else <-------------------------------------
Writeln('Failed to Open Bank, Trying again!')

riwu

2012-06-25 07:20:06

Exactly what the error is telling u:
function Withdraw(col, row, Amount: Integer): Boolean;
it doesn't just withdraw the item for u, u have to specify the column,row and amount. Otherwise u will have to make a DTM of flax to withdraw it directly (regardless of which bank slot it is at)

ffcfoo

2012-06-25 07:25:14

From: riwu
Exactly what the error is telling u:
function Withdraw(col, row, Amount: Integer): Boolean;
it doesn't just withdraw the item for u, u have to specify the column,row and amount. Otherwise u will have to make a DTM of flax to withdraw it directly (regardless of which bank slot it is at)


Thank you, knew the Withdraw function looked a little funky xD!

riwu

2012-06-25 07:27:49

From: ffcfoo
Thank you, knew the Withdraw function looked a little funky xD!

Spotted a couple more mistakes, and u can just use a loop to repeat the procedure until it is found:
procedure OpenBank1;
var
fail: Integer;
begin
repeat
if OpenBank('clt', False, True) then
begin
Withdraw(col,row,amount);
Break;
end;

Inc(fail);
if (fail>2) then
begin
Writeln('Failed to Open Bank, Loggin off!');
Logout;
TerminateScript;
end;

Wait(1000+Random(500)); //never use static waits
Writeln('Failed to Open Bank, Trying again!');
until(false);
end;