SRL Archive - Help and Support

Script help...


Dynamite

2009-06-19 21:01:28

Argh this is soooo annoying, I have asked a couple other Members and they can't figure this out either.
begin
marktime(openingbank);
repeat
wait(200+random(100));
InPin2(Players[CurrentPlayer].Pin);
until(R_BankScreen) or (TimeFromMark(openingbank) > 15000);
if not R_BankScreen then
begin
Players[Currentplayer].strings[2] := 'Failed to find bank';
writeln('DID NOT FIND BANK. Next Player.');
result := false; <----------------------------------------
exit;
end;
Where the arrows are it says
Unknown identifier 'result' in script 
What I done wrong?

T~M

Quickmarch

2009-06-19 21:08:41

Is that your mainloop?

Dynamite

2009-06-19 21:10:23

no it in: function BankIt: boolean;

T~M

Quickmarch

2009-06-19 21:11:25

Could you show the script?

HyperSecret

2009-06-19 21:23:57

or at least show the whole function…

Dynamite

2009-06-19 21:27:38

function BankIt: boolean;
var
FlaxDTM, BsDTM, waiting: integer;
ItemSlots: TIntegerArray;
rndm:string;
begin
if not LoggedIn then
begin
result := false;
Exit;
end;
distat('Opening Bank');
FindNormalRandoms;
marktime(waiting);
repeat
if not R_OpenBankBooth('lb') then
begin
Wait(500);//Failsafe
end;
until (TimeFromMArk(waiting) > 25000);
if not R_BankScreen then
begin
Players[Currentplayer].strings[2] := 'Failed to find bank';
writeln('DID NOT FIND BANK. Next Player.');
result := false;
exit;
end;
end;
begin
marktime(openingbank);
repeat
wait(200+random(100));
InPin2(Players[CurrentPlayer].Pin);
until(R_BankScreen) or (TimeFromMark(openingbank) > 15000);
if not R_BankScreen then
begin
Players[Currentplayer].strings[2] := 'Failed to find bank';
writeln('DID NOT FIND BANK. Next Player.');
result := false;
exit;
end;
if not R_BankScreen then
begin
Players[CurrentPlayer].strings[2] := 'Failed to open bank';
writeln('DID NOT OPEN BANK. Next Player.');
result := false;
exit;
end;
end;
Distat('Depositing/Withdrawing');
wait(400+random(200));
if (Players[CurrentPlayer].booleans[0] = false) then
begin
if not InvEmpty then
begin
marktime(searching);
repeat
wait(100+random(200));
until (DepositAll) or (TimeFromMArk(searching) > 8000);
end;
wait(200+random(100));
FlaxDTM := {Make A Flax DTM}
if FindDTM(FlaxDTM,x,y,12,12,509,335) then
begin
Mouse(x,y,2,2,false);
marktime(waiting);
R_ChooseOption('ll')
repeat
wait(100+random(100));
until (R_ChooseOption('ll')) or (TimeFromMark(waiting) > 8000);
FreeDTM(FlaxDTM);
end else
begin
Players[CurrentPlayer].Strings[2] := 'Failed Withdrawing Flax';
writeln('FAILED WITHDRAWING Flax.');
result := false;
exit;
end;
wait(100+random(100));
CloseBank;
MarkTime(Searching);
repeat
wait(300+random(200));
until (InvFull) or (TimeFromMark(Searching) > 6000);
if not InvFull then
begin
Players[CurrentPlayer].Strings[2] := 'Not enough supplies';
writeln('NOT ENOUGH SUPPLIES.');
result := false;
exit;
end;
begin
if not InventoryContains(FlaxID, ItemSlots) then
begin
Players[CurrentPlayer].Strings[2] := 'Bad supplies';
writeln('WRONG SUPPLIES. Did you read the Setup instructions? Next Player.');
result := false;
exit;
end;
end;
CloseBank;
result := true;
end;

T~M

ZaSz

2009-06-19 21:50:18

Its your stupid standards :p.

Try this.

function BankIt: boolean;
var
FlaxDTM, BsDTM, waiting: integer;
ItemSlots: TIntegerArray;
rndm:string;
begin
if not LoggedIn then
begin
result := false;
Exit;
end;
distat('Opening Bank');
FindNormalRandoms;
marktime(waiting);
repeat
if not R_OpenBankBooth('lb') then
begin
Wait(500);//Failsafe
end;
until (TimeFromMArk(waiting) > 25000);
if not R_BankScreen then
begin
Players[Currentplayer].strings[2] := 'Failed to find bank';
writeln('DID NOT FIND BANK. Next Player.');
result := false;
exit;
end;
begin
marktime(openingbank);
repeat
wait(200+random(100));
InPin2(Players[CurrentPlayer].Pin);
until(R_BankScreen) or (TimeFromMark(openingbank) > 15000);
if not R_BankScreen then
begin
Players[Currentplayer].strings[2] := 'Failed to find bank';
writeln('DID NOT FIND BANK. Next Player.');
result := false;
exit;
end;
if not R_BankScreen then
begin
Players[CurrentPlayer].strings[2] := 'Failed to open bank';
writeln('DID NOT OPEN BANK. Next Player.');
result := false;
exit;
end;
Distat('Depositing/Withdrawing');
wait(400+random(200));
if (Players[CurrentPlayer].booleans[0] = false) then
begin
if not InvEmpty then
begin
marktime(searching);
repeat
wait(100+random(200));
until (DepositAll) or (TimeFromMArk(searching) > 8000);
end;
wait(200+random(100));
FlaxDTM := {Make A Flax DTM}
if FindDTM(FlaxDTM,x,y,12,12,509,335) then
begin
Mouse(x,y,2,2,false);
marktime(waiting);
R_ChooseOption('ll')
repeat
wait(100+random(100));
until (R_ChooseOption('ll')) or (TimeFromMark(waiting) > 8000);
FreeDTM(FlaxDTM);
end else
begin
Players[CurrentPlayer].Strings[2] := 'Failed Withdrawing Flax';
writeln('FAILED WITHDRAWING Flax.');
result := false;
exit;
end;
wait(100+random(100));
CloseBank;
MarkTime(Searching);
repeat
wait(300+random(200));
until (InvFull) or (TimeFromMark(Searching) > 6000);
if not InvFull then
begin
Players[CurrentPlayer].Strings[2] := 'Not enough supplies';
writeln('NOT ENOUGH SUPPLIES.');
result := false;
exit;
end;
begin
if not InventoryContains(FlaxID, ItemSlots) then
begin
Players[CurrentPlayer].Strings[2] := 'Bad supplies';
writeln('WRONG SUPPLIES. Did you read the Setup instructions? Next Player.');
result := false;
exit;
end;
end;
end;
CloseBank;
result := true;
end;

Few to many ends.

Naike

2009-06-19 22:51:39

ProTip: Don't have that long functions.. Split them up in 2 diffrent, or maybe 3..