imhero
2014-01-29 23:22:02
need help. I am trying to go through my program recursively but my error reports suggest that the first procedure must go first and in linear order. I can't find out how to go back recursively when it seems my script is reading downward and if I call a procedure it has to be above the place I am calling. Wouldn't this make it impossible to do things without iterating?
program PkH_WoodCutterF2P;
{$i SRL-OSR/srl.simba}
var
DepositBut:integer;
function ismining: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 250, 500) > 300);
end;
Function Is_Inv_Full:Boolean;
Begin
if (InvCount = 28) then
Result := True;
End;
Function rsps_GetCompassAngleRadians: Extended;
var
TPA: TPointArray;
T: TPoint;
B: TBox;
begin
B := IntToBox(522, 4, 564, 43);
with B do
FindColorsSpiralTolerance(T.x, T.y, TPA, 1911089, x1, y1, x2, y2, 0);
if Length(TPA) < 1 then
exit;
T := MiddleTPA(TPA);
Result := ArcTan2(-(T.Y - 24), T.X - 543) + Radians(90);
Result := fixRad(Result - Pi);
end;
function rsps_GetCompassAngleDegrees: Extended;
begin
Result := Degrees(rsps_GetCompassAngleRadians());
end;
procedure ExitBank;
Begin
Mouse(489, 28, 1, 1, true);
If (IsUptext('Close')) then
begin
Mouse(489, 28, 1, 1, true);
end;
wait(2000)
clickCoal;
end;
procedure Deposit_All;
var
x,y:integer;
begin
Mouse(400, 301, 3, 3, true);
wait(1000)
ExitBank;
//broken
// if FindBitmapToleranceIn(DepositBut, x, y, 376, 288, 416, 315, 145) then
// begin
// mmouse(x, y,1,1);
// wait(250);
// ClickMouse(X, Y, mouse_Left)
// ExitBank;
// end;
end;
Procedure ClickBank;
var
x,y:integer;
begin
if FindObjCustom(x,y, ['depo', 'ank', 'ox'], [5263704,6645102,8816274], 5) then
begin
mouse(x,y,0,0,True);
end;
wait(2000)
Deposit_All;
end;
Procedure ClickCoal;
var
x,y:integer;
begin
if (Is_Inv_full) then
begin
ClickBank;
end;
if not(ismining) then
begin
wait(4000)
ClickCoal;
end;
If FindObjCustom(x, y, ['ine', 'ock'], [1187615,1912623,1582887], 5) then
begin
If(IsUptext('Mine Rocks')) then
begin
Mouse(x, y, 0, 0, True);
end;
end;
wait(6000)
ClickCoal
end;
Procedure ClickInv;
var
x,y:integer;
begin
if FindColorTolerance(X, Y, 1788023, 628, 171, 658, 198, 10) then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Left)
wait(2000);
end;
end;
Procedure test;
begin
writeln(Is_Inv_Full);
end;
begin
SetupSRL;
DepositBut := BitmapFromString(28, 17, 'meJyNk0FKA0EQRTcSjElUyEgIJC' +
'pmI7gbVAJCEGGyiBF1KQm4GBDBrRs3LnTpAfQCHiAH8CYexicfPs0' +
'46RE+Q01N9+tfXTWTm7vJcq3Uamu7w9Vu2j7Kd67f0PbFK+qePXZO' +
'HpJ0tnlwxScyvDaarQjKQLa0Blm93YcMx0w4HESSrwg4X1kcxwoos' +
'QUsEMyI2Tt/Ik8GIPHe7IPjWJYkWxFgZ5CyRrtUI1gREK4QeeL925' +
'devoDJ4ohPmKwfbVwSCEuxwvIUEM+Hz5/o95R8QaaycDg83Sb1ggA' +
'sARwW4HD+/gUWIPlK5nrWtNQLUMaqcZSg7uh+eC7DipN9nyIC3a2s' +
'Uq+xvGrM1Ho5hzmd3zeO66U0Ad0vTY5ciUwgvvL0KGRqb0gTEBTAk' +
'KkGYYlx0i+gkkmSCZkiFICgKBC5djMF9KB6DDRLZhaA7pSZoc8CTZ' +
'cQDmeE6cuU3CajiPXX22EpMwSGbl07loQVTa0PgZU+C1iPE6IjZKD' +
'9nUmYpeJcS1j9p1YpTRqOp/+XOFJk2Q/uyVW9');
rsps_GetCompassAngleRadians;
rsps_GetCompassAngleDegrees;
ClickInv;
ClickCoal;
end.[Error] (53:1): Unknown identifier 'clickCoal' at line 53
Compiling failed.
New window: 983580
[Error] (51:1): Unknown identifier 'ClickBank' at line 51
Compiling failed.
[Error] (53:1): Unknown identifier 'Deposit_All' at line 53
Compiling failed.
[Error] (51:1): Unknown identifier 'ExitBank' at line 51
Compiling failed.
[Error] (52:1): Unknown identifier 'clickCoal' at line 52
Compiling failed.
[Error] (51:1): Unknown identifier 'ClickBank' at line 51
Compiling failed.
[Error] (53:1): Unknown identifier 'Deposit_All' at line 53
Compiling failed.
New window: 983580
[Error] (51:1): Unknown identifier 'ExitBank' at line 51
Compiling failed.
[Error] (52:1): Unknown identifier 'clickCoal' at line 52
Compiling failed.Each 'unknown identifier' I moved the procedure to the top of the procedure list. HELP :)