Hi all,

I am nearing completion of my first script which will hopefully bring me from leecher to contributor (yay!).

I am in the middle of doing the proggy details for my script to keep the user up to date. The issue I am having at the moment though is an error: Identifier expected at line 963. This is causing me all sorts of grief as I have double checked all of my syntax to ensure begin has an end, there are ; present etc etc. Any people with a keen eye that could help would be greatly appreciated!

The issue is inside of the
Simba Code:
procedure ProggyReport;
(LOCATED AT BOTTOM) . disregard the debug stuff at the top, the cannot divide by zero has been causing me grief (hense the need to do the if checks and, unfortunately, the error.

Script is below:

Simba Code:
program TarroPots;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}


var
  enteredX: Boolean;
  currentTask: String;
  failedToFindItem: Boolean;
  missingItemTotal: integer;
  firstTimeBanked: Boolean;
  potionsMade: integer;
  hoverAntibanSkill: string;
  waitDelayAntibanMin: integer;
  waitDelayAntibanMax: integer;
  waitDelayAntiban207Min: integer;
  waitDelayAntiban207Max: integer;
  makeSerum207: boolean;
  mx: integer;
  my: integer;
  expGainedThisInv: integer;

  XPGained, TimeGone, UnfPotsMade, Serum207Made: integer;
  XPGainedPerHour, UnfPotsPerHour, Serum207PerHour, CurrentXP, OriginalXP: integer;


Procedure DeclarePlayers;
begin
  HowManyPlayers := 1;
  NumberOfPlayers(HowManyPlayers);
  CurrentPlayer := 0;

  // Enter Account details here
  Players[0].Name :='';
  Players[0].Pass :='';
  Players[0].Nick :='';
  Players[0].Pin  :='';
  Players[0].Active:=True;

  // Configuration
  makeSerum207  := true; // True = Serum207. False = unfinished tarromin potions. You must have unf tarro potions in bank to make serum 207 potions.

  // Antiban
  hoverAntibanSkill := 'Herblore'; // Skill in which to hover when antiban triggers
  waitDelayAntibanMin := 2000;     // Minimum wait for unattentive human antiban
  waitDelayAntibanMax := 7000;     // Maximum wait for unattentive human antiban
  waitDelayAntiban207Min := 5000;  // Minimum wait for unattentive human antiban when making Serum 207 pots (longer as its more labor intensive)
  waitDelayAntiban207Max := 15000; // Maximum wait for unattentive human antiban when making Serum 207 pots (longer as its more labor intensive)

  //Don't touch these!
  enteredX := False;
  currentTask := 'OpenTheBank';
  missingItemTotal := 2;
  firstTimeBanked := true;
end;


Procedure RandomBankWait;
Begin
  case random(1000) of
    0..700:    Wait(RandomRange(200, 500));
    701..900:  Wait(RandomRange(400, 800));
    901..1000: Wait(RandomRange(500, 1000));
  End;
End;

Procedure RandSmallWait;
Begin
  case random(1000) of
    0..700:    Wait(RandomRange(200, 200));
    701..900:  Wait(RandomRange(200, 600));
    901..1000: Wait(RandomRange(500, 700));
  End;
End;



procedure AntiBan;
begin
  if(not(LoggedIn))then
  Exit;
  FindNormalRandoms;
  case Random(50) of
   0..3:
   begin
     writeLn('Antiban - Hovering Skill Running');
     HoverSkill(hoverAntibanSkill, false);
     wait(2453+Random(432));
     FindNormalRandoms;
   end;
   3..12:
   begin
     PickUpMouse;
     writeLn('AntiBan - Pickup Mouse Running');
   end;
   20..22:
   begin
     writeLn('AntiBan - Changing Compass Running');
     MakeCompass('N');
     wait(100+random(133));
     MakeCompass('E');
     wait(50+random(133));
     MakeCompass('N');
   end;
   30..35:
   begin
     writeLn('AntiBan - Unattentive Human Running');
     wait(waitDelayAntibanMin+random(waitDelayAntibanMin));
     FindNormalRandoms;
   end;
  end;
end;


procedure AntiBan207;
begin
  if(not(LoggedIn))then
  Exit;
  FindNormalRandoms;
  case Random(50) of
    0..3:
    begin
      writeLn('AntiBan - Long AFK Break');
      WriteLn('Going AFK for a while');
      wait(waitDelayAntiban207Min+random(waitDelayAntiban207Max));
    end;
    5..10:
    begin
      writeLn('AntiBan - Small AFK');
      wait(1000+random(3000));
    end;
  end;
end;

procedure _openBank;
var
  TPA: TpointArray;
  ATPA: T2DPointArray;
  I: Integer;
  TP: TPoint;
  theOptions: TStringArray;
  x, y: integer;
  x1, y1: integer;
  itemsFound: integer;
begin
  FindNormalRandoms;
  writeLn('Banking Started');
  theOptions := ['Bank Bank booth', 'Bank Banker'];
  ColorToleranceSpeed(2);
  SetColorSpeed2Modifiers(0.78, 0.98);
  findColorsTolerance(TPA, 4401964, MSX1, MSY1, MSX2, MSY2, 11);
  colorToleranceSpeed(1);
  setColorSpeed2Modifiers(0.2, 0.2);
  ATPA := TPAtoATPAEx(TPA, 20, 40);
  SortATPAFromMidPoint(ATPA, Point(MSCX, MSCY));
  for I := 0 to High(ATPA) do
  begin
    if Length(ATPA[I]) < 100 then
       Continue;
    TP := middleTPA(ATPA[I]);
    mMouse(TP.X, TP.y, 5, 5);
    clickMouse2(MOUSE_RIGHT);
    chooseOption('Bank Banker');
    writeLn('Bank Open');
    RandomBankWait;
    if PinScreen then
    begin
      InPin(Players[CurrentPlayer].Pin);
      writeLn('Entering Pin');
    end;
    if firstTimeBanked then
    begin
      mouseBox(484, 69, 495, 75, MOUSE_LEFT);
      writeLn('First time opening bank, scrolling up');
    end;
    itemsFound := 0;
    if makeSerum207 then
    begin
      if firstTimeBanked then
      begin
        if (invCount > 0) then
        begin
          mouseBox(431, 288, 454, 308, MOUSE_LEFT);
          writeLn('Depositing inventory');
          potionsMade := potionsMade + invCount;
          WriteLn(Format('Have made %d Serum 207 Potions so far!', [potionsMade]));
        end;
      end;
      RandomBankWait;
      mouseBox(173, 68, 192, 88, MOUSE_MOVE);
      if WaitUpTextMulti(['arromin', 'pot', 'Tar', 'unf'], 300 + random(200)) then
      begin
        if not enteredX then
        begin
          writeLn('Quantity 14 not on dialog - Creating it');
          clickMouse2(false);
          RandomBankWait;
          GetMousePos(x, y);
          y1 := y + 85;
          x1 := x;
          MMouse(x1, y1, 30, 5);
          wait(300+random(200));
          GetMousePos(x, y);
          HoldMouse(x, y, mouse_Left);
          GetMousePos(x, y);
          ReleaseMouse(x, y, mouse_Left);
          wait(1000+random(400));
          sendKeys('14',80, 80);
          typeByte(VK_ENTER);
          enteredX := true;
          firstTimeBanked := true;
        end else
        begin
          writeLn('Unfinised pot found - Right Clicking it');
          GetMousePos(x, y);
          HoldMouse(x, y, mouse_Right);
          GetMousePos(x, y);
          ReleaseMouse(x, y, mouse_Right);
          RandomBankWait;
          chooseOption('14');
        end;
      end;
      if firstTimeBanked then
      begin
        writeLn('Arranging inventory for efficiency');

        wait(600+random(600));

        // Move inv slot 3 to 17
        mouseBox(652, 215, 671, 238, MOUSE_MOVE);
        GetMousePos(x, y);
        HoldMouse(x, y, mouse_Left);
        mouseBox(571, 363, 580, 379, MOUSE_MOVE);
        GetMousePos(x, y);
        ReleaseMouse(x, y, mouse_Left);

        wait(400+random(400));

        // Move inv slot 4 to 18
        mouseBox(697, 216, 711, 238, MOUSE_MOVE);
        GetMousePos(x, y);
        HoldMouse(x, y, mouse_Left);
        mouseBox(613, 366, 626, 380, MOUSE_MOVE);
        GetMousePos(x, y);
        ReleaseMouse(x, y, mouse_Left);

        wait(400+random(400));

        // Move inv slot 7 to 21
        mouseBox(652, 253, 669, 273, MOUSE_MOVE);
        GetMousePos(x, y);
        HoldMouse(x, y, mouse_Left);
        mouseBox(570, 397, 584, 415, MOUSE_MOVE);
        GetMousePos(x, y);
        ReleaseMouse(x, y, mouse_Left);

        wait(400+random(400));

        // Move inv slot 8 to 22
        mouseBox(695, 253, 711, 273, MOUSE_MOVE);
        GetMousePos(x, y);
        HoldMouse(x, y, mouse_Left);
        mouseBox(613, 397, 625, 415, MOUSE_MOVE);
        GetMousePos(x, y);
        ReleaseMouse(x, y, mouse_Left);

        wait(400+random(400));

        // Move inv slot 11 to 25
        mouseBox(652, 288, 670, 311, MOUSE_MOVE);
        GetMousePos(x, y);
        HoldMouse(x, y, mouse_Left);
        mouseBox(571, 433, 585, 453, MOUSE_MOVE);
        GetMousePos(x, y);
        ReleaseMouse(x, y, mouse_Left);

        wait(400+random(400));

        // Move inv slot 13 to 28
        mouseBox(697, 288, 711, 311, MOUSE_MOVE);
        GetMousePos(x, y);
        HoldMouse(x, y, mouse_Left);
        mouseBox(614, 433, 626, 453, MOUSE_MOVE);
        GetMousePos(x, y);
        ReleaseMouse(x, y, mouse_Left);

        wait(400+random(400));

        writeLn('Completed arrangement of inventory');
        firstTimeBanked := false;
        RandomBankWait;
      end else
      begin
        mouseBox(652, 216, 670, 234, MOUSE_MOVE);
        if WaitUpTextMulti(['erum', '207', 'Serru', '3'], 300 + random(200)) then
        begin
          writeLn('Found and depositing serum207 from inventory');
          GetMousePos(x, y);
          HoldMouse(x, y, mouse_Right);
          GetMousePos(x, y);
          ReleaseMouse(x, y, mouse_Right);
          RandomBankWait;
          chooseOption('All');
        end else
        begin
          writeLn('Serum207 not found in slot - rebanking');
          firstTimeBanked := true;
          _openBank();
        end;
      end;
      RandomBankWait;
      mouseBox(223, 68, 241, 88, MOUSE_MOVE);
      if WaitUpTextMulti(['shes', 'Ash', 'sh', 'es'], 300 + random(200)) then
      begin
        writeLn('Found and withdrawing Ashes');
        GetMousePos(x, y);
        HoldMouse(x, y, mouse_Right);
        GetMousePos(x, y);
        ReleaseMouse(x, y, mouse_Right);
        RandomBankWait;
        chooseOption('All');
        RandomBankWait;
        mouseBox(479, 29, 492, 42, MOUSE_LEFT)
        currentTask := 'makingSerum207pots';
        RandomBankWait;
        writeLn('Time to make 207 pots!')
        Exit;
      end else
      begin
        writeLn('Ashes not found in 4th slot. Closing script');
        TerminateScript;
      end;
    end;
    if (invCount < 28) then
    begin
      writeLn('Not enough items in inventory - rebanking');
      _openBank();
    end;
    if not makeSerum207 then
    begin
      if (invCount > 0) then
      begin
        mouseBox(431, 288, 454, 308, MOUSE_LEFT);
        writeLn('Depositing inventory');
        potionsMade := potionsMade + invCount;
        WriteLn(Format('Have made %d Unfinished Tarromin Potions so far!', [potionsMade]));
      end;
      RandomBankWait;
      mouseBox(127, 68, 148, 87, MOUSE_MOVE);
      if WaitUpTextMulti(['arromin', 'min', 'Tar', 'arro'], 300 + random(200)) then
      begin
        itemsFound := itemsFound + 1;
        if not enteredX then
        begin
          RandomBankWait;
          writeLn('Tarromin Found - Right Clicking it');
          GetMousePos(x, y);
          HoldMouse(x, y, mouse_Right);
          GetMousePos(x, y);
          ReleaseMouse(x, y, mouse_Right);
          writeLn('Quantity 14 not on dialog - Creating it');
          RandomBankWait;
          y1 := y + 85;
          x1 := x;
          MMouse(x1, y1, 30, 5);
          wait(300+random(200));
          GetMousePos(x, y);
          HoldMouse(x, y, mouse_Left);
          GetMousePos(x, y);
          ReleaseMouse(x, y, mouse_Left);
          wait(1000+random(400));
          sendKeys('14',80, 80);
          typeByte(VK_ENTER);
          enteredX := true;
          firstTimeBanked := true;
        end else
        begin
          writeLn('Tarromin Found - Right Clicking it');
          GetMousePos(x, y);
          HoldMouse(x, y, mouse_Right);
          GetMousePos(x, y);
          ReleaseMouse(x, y, mouse_Right);
          RandomBankWait;
          chooseOption('14');

          RandomBankWait;
        end;
      end;
      mouseBox(79, 70, 94, 87, MOUSE_MOVE);
      if WaitUpTextMulti(['arromin','ial', 'ater', 'Wate'],300 + random(200)) then
      begin
        itemsFound := itemsFound + 1;
        writeLn('Withdrawing Vials of Water');
        GetMousePos(x, y);
        HoldMouse(x, y, mouse_Right);
        GetMousePos(x, y);
        ReleaseMouse(x, y, mouse_Right);
        RandomBankWait;
        y1 := y + 100;
        x1 := x;
        MMouse(x1, y1, 30, 5);
        wait(300+random(200));
        GetMousePos(x, y);
        HoldMouse(x, y, mouse_Left);
        GetMousePos(x, y);
        ReleaseMouse(x, y, mouse_Left);
        RandomBankWait;
        mouseBox(479, 29, 492, 42, MOUSE_LEFT)
        currentTask := 'BankCloseCheck';
        writeLn('Banking Completed');
        FindNormalRandoms;
        Break;
      end;
      if  itemsFound < 2 then
      begin
        writeLn('Tarromin or Water Vial not detected in slot 1 and 2. Exiting Script');
        TerminateScript;
      end;
      if failedToFindItem then
      begin
        writeLn('Tarromin or Water Vial not detected in slot 1 and 2. Exiting Script');
        TerminateScript;
      end else
      begin
        writeLn('Tarromin or Water Vial not detected in slot 1 and 2. Exiting Script');
        TerminateScript;
      end;
    end;
  end;
  writeLn('Banking Complete');
end;



procedure makeUnfPots;
var
  x, y: integer;

begin
  writeLn('Starating to make unfinished potions');
  x := 578;
  y := 234;
  case random(200) of
    0..160:   MMouse(RandomRange(x - 7, x + 7), RandomRange(y - 7, y + 7), 0, 0);
    161..190: MMouse(RandomRange(x - 9, x + 9), RandomRange(y - 9, y + 9), 0, 0);
    191..200: MMouse(RandomRange(x - 12, x + 12), RandomRange(y - 12, y + 12), 0, 0);
  end;
  if WaitUpTextMulti(['arromin', 'min', 'Tar', 'arro'],300 + random(200)) then
  begin
    FindNormalRandoms;
    GetMousePos(x, y);
    HoldMouse(x, y, mouse_Left);
    GetMousePos(x, y);
    ReleaseMouse(x, y, mouse_Left);
    wait(300+random(200));
    x := 704;
    y := 450;
    case random(200) of
      0..160:   MMouse(RandomRange(x - 7, x + 7), RandomRange(y - 7, y + 7), 0, 0);
      161..190: MMouse(RandomRange(x - 9, x + 9), RandomRange(y - 9, y + 9), 0, 0);
      191..200: MMouse(RandomRange(x - 12, x + 12), RandomRange(y - 12, y + 12), 0, 0);
    end;
    wait(300+random(200));
    if WaitUpTextMulti(['arromin','ial', 'ater', 'Wate'],300 + random(200)) then
    begin
      GetMousePos(x, y);
      HoldMouse(x, y, mouse_Left);
      GetMousePos(x, y);
      ReleaseMouse(x, y, mouse_Left);
      RandomBankWait;

      mouseBox(205, 387, 327, 444, MOUSE_RIGHT);
      chooseOption('All');

      firstTimeBanked := false;

      currentTask := 'CheckPotionsAreReady';
      failedToFindItem := False;

      RandomBankWait;
      AntiBan;
      RandomBankWait;
    end else
    begin
      writeLn('Might be out of Water Vials. Trying to bank again');
      currentTask := 'OpenTheBank';
      failedToFindItem := True;
    end;
  end else
  begin
    if WaitUpTextMulti(['otion', 'potio', 'unf'],300 + random(200)) then
    begin
      writeLn('The first slot is an unf potion - banking');
      currentTask := 'OpenTheBank';
    end;
    if WaitUpTextMulti(['ial', 'ater', 'Wate'],300 + random(200)) then
    begin
      writeLn('Might be out of tarromin. Trying to bank again');
      currentTask := 'OpenTheBank';
      failedToFindItem := True;
    end else
    begin
      writeLn('Unknown Object in first inventory slot - Attempting to bank');
      currentTask := 'OpenTheBank';
    end;
  end;
  writeLn('Completed Unf Pots');
end;

procedure randomMouseClick;
begin
  case random(200) of
      0..160:   MMouse(RandomRange(mx - 6, mx + 6), RandomRange(my - 6, my + 6), 0, 0);
      161..190: MMouse(RandomRange(mx - 7, mx + 7), RandomRange(my - 7, my + 7), 0, 0);
      191..200: MMouse(RandomRange(mx - 8, mx + 8), RandomRange(my - 8, my + 8), 0, 0);
  end;
end;

procedure make207pots;
begin
  writeLn('Starating to make Serum207 potions');
  RandSmallWait;
  // Making the inside pair
  mx := 621
  my := 234
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 662
    my := 234
    randomMouseClick;
    RandSmallWait;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
      RandSmallWait;
    end else
    begin
      writeLn('Ashes Not Found - Terminating');
      terminateScript;
    end;
  end;
  mx := 621
  my := 271
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 662
    my := 268
    randomMouseClick;
    RandSmallWait;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
      RandSmallWait;
    end else
    begin
      writeLn('Ashes Not Found - Terminating');
      Logout;
      terminateScript;
    end;
  end;
  mx := 621
  my := 306
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 662
    my := 303
    randomMouseClick;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
      RandSmallWait;
    end else
    begin
      writeLn('Ashes Not Found - Terminating');
      terminateScript;
    end;
  end;
  mx := 621
  my := 343
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 662
    my := 339
    randomMouseClick;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
      RandSmallWait;
    end else
    begin
      writeLn('Ashes Not Found - Terminating');

      terminateScript;
    end;
  end;
  mx := 621
  my := 379
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 662
    my := 374
    randomMouseClick;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
      RandSmallWait;
    end else
    begin
      writeLn('Ashes Not Found - Terminating');

      terminateScript;
    end;
  end;
  mx := 621
  my := 415
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 662
    my := 411
    randomMouseClick;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
      RandSmallWait;
    end else
    begin
      writeLn('Ashes Not Found - Terminating');

      terminateScript;
    end;
  end;
  mx := 621
  my := 450
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 662
    my := 447
    randomMouseClick;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
      RandSmallWait;
    end else
    begin
      writeLn('Ashes Not Found - Terminating');

      terminateScript;
    end;
  end;

  // Making the outside pair
  mx := 578
  my := 234
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 703
    my := 234
    randomMouseClick;
    RandSmallWait;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
    end else
    begin
      writeLn('Ashes Not Found - Terminating');

      terminateScript;
    end;
  end;
  mx := 578
  my := 270
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 703
    my := 268
    randomMouseClick;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
      RandSmallWait;
    end else
    begin
      writeLn('Ashes Not Found - Terminating');

      terminateScript;
    end;
  end;
  mx := 578
  my := 306
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 703
    my := 302
    randomMouseClick;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
      RandSmallWait;
    end else
    begin
      writeLn('Ashes Not Found - Terminating');

      terminateScript;
    end;
  end;
  mx := 578
  my := 342
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 703
    my := 338
    randomMouseClick;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
      RandSmallWait;
    end else
    begin
      writeLn('Ashes Not Found - Terminating');

      terminateScript;
    end;
  end;
  mx := 578
  my := 378
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 703
    my := 374
    randomMouseClick;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
      RandSmallWait;
    end else
    begin
      writeLn('Ashes Not Found - Terminating');

      terminateScript;
    end;
  end;
  mx := 578
  my := 415
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 703
    my := 410
    randomMouseClick;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
      RandSmallWait;
    end else
    begin
      writeLn('Ashes Not Found - Terminating');

      terminateScript;
    end;
  end;
  mx := 578
  my := 448
  randomMouseClick;
  if WaitUpTextMulti(['arromin', 'potion', 'pot', 'unf'],300 + random(200)) then
  begin
    writeLn('Found the unfinished potion - Clicking');
    Clickmouse2(true);
    RandSmallWait;
    mx := 703
    my := 446
    randomMouseClick;
    if WaitUpTextMulti(['arromin', 'pot', 'Ashes', 'unf'], 300 + random(200)) then
    begin
      writeLn('Found the ashes - Clicking');
      Clickmouse2(true);
      RandSmallWait;
      currentTask := 'OpenTheBank';
      Serum207Made := Serum207Made + 14;
      CurrentXP := CurrentXP + 700;
    end else
    begin
      writeLn('Ashes Not Found - Terminating');
      terminateScript;
    end;
  end;
  if (invCount < 16) then
  begin
    AntiBan207;
    writeLn('Completed the potions, time to bank!');
    currentTask := 'OpenTheBank';
  end;
  if (invCount > 16) then
  begin
    writeLn('Something has gone wrong, too many items in inventory - Banking');
    firstTimeBanked := true;
    currentTask := 'OpenTheBank';
  end else
  begin
    writeLn('No tarromin pot detected, going to bank in case');
    currentTask := 'OpenTheBank';
    exit;
  end;
end;



procedure waitForPotsMade;
var
  potsMade: integer;
  potsBeingMadeCheck: integer;

begin
  potsBeingMadeCheck := 0;
  potsMade := 0;
  writeLn('Waiting for potions to complete - Started');
  Antiban;
  repeat
    potsMade := invCount;
    wait(250)
    writeLn('Still making unf pots...');
    if (invCount = 28) then
    begin
      potsBeingMadeCheck := potsBeingMadeCheck + 1
      if (potsBeingMadeCheck > 10) then
      begin
        writeLn('Something has gone wrong, restarting the pot making block');
        currentTask := 'MakePotions';
        makeUnfPots();
      end;
      writeLn('Pots are not being made yet...Checking again');
    end;
  until(potsMade = 14);
  if (invCount = 14) then
  begin
    writeLn('Pots made. Banking...');
    currentTask := 'OpenTheBank';
    UnfPotsMade := UnfPotsMade + invCount;
  end;
end;








procedure checkBankClosed;
begin
  writeLn('Checking if bank screen is closed');
  if BankScreen then
  begin
    if not (invCount = 28) then
    begin
      writeLn('Its still open - Running bank block again');
      currentTask := 'OpenTheBank';
    end;
    mouseBox(479, 29, 492, 42, MOUSE_LEFT);
    RandomBankWait;
    FindNormalRandoms;
    writeLn('Closed the bank');
  end else
  begin
    if firstTimeBanked then
    begin
      writeLn('First bank so we will click inv tab just in case');
      mouseBox(630, 174, 650, 197, MOUSE_LEFT);
      firstTimeBanked := false;
    end;
    currentTask := 'MakePotions';
    writeLn('Completed Check bank Closed');
  end;
end;

procedure ProggyReport;
var
  tempTimeVar: integer;

begin
  ClearDebug;
  tempTimeVar := GetTimeRunning;
  Writeln('Debug: Time Gone = ' + IntToStr(tempTimeVar) + 'milliseconds!');
  Writeln('XPGained is ' + IntToStr(XPGained) + '!');
  Writeln('Serum207Made is ' + IntToStr(Serum207Made) + '!');

  XPGained := (CurrentXP);
  if (XPGained > 2500) then
  begin
    XPGainedPerHour :=  XPGained/GetTimeRunning;
    if (XPGainedPerHour > 0) then
    begin
      XPGainedPerHour :=  XPGainedPerHour/3600000;
    end;
  end;
  if (Serum207Made > 50) then
  begin
    Serum207PerHour := Serum207Made/GetTimeRunning);
    if (Serum207PerHour > 0) then
    begin
      Serum207PerHour := Serum207PerHour/3600000;
    end;
  end;
  if (UnfPotsMade > 50) then
  begin
    UnfPotsPerHour := UnfPotsMade/GetTimeRunning;
    if (UnfPotsPerHour > 0) then
    begin
      UnfPotsPerHour := UnfPotsMade/3600000;
    end;
  end;
  begin
    Writeln('******************************************************************');
    Writeln('*/////////---------- Dan The Mans TarroPots207 -----------\\\\\\\*');
    Writeln('*/////////----------____________________________----------\\\\\\\*');
    Writeln('******************************************************************');
    Writeln('');
    Writeln('*/////////--------- Proggy for the player: ' + Players[0].Nick + ' --------\\\\\\\\\*');
    Writeln('*/////////We have ran the script for:' + IntToStr(GetTimeRunning/1000) + ' seconds so far');
    Writeln('*/////////We have gained: ' + IntToStr(XPGained) + ' xp / Thats ' + IntToStr(XPGainedPerHour) + ' xp per hour');
    Writeln('*/////////We have crafted ' + IntToStr(Serum207Made) + ' Serum207 Potions / Thats ' + IntToStr(Serum207PerHour) + ' Serum207 Pots Per Hour');
    Writeln('*/////////We have crafted ' + IntToStr(UnfPotsMade) + ' unfinished Potions / Thats ' + IntToStr(UnfPotsPerHour) + ' unfinished Pots Per Hour');
    Writeln('');
  end;
end;


procedure scriptLoop();
begin
  case currentTask of
    'OpenTheBank'           :      _openBank();
    'BankCloseCheck'        :      checkBankClosed();
    'MakePotions'           :      makeUnfPots();
    'CheckPotionsAreReady'  :      waitForPotsMade();
    'makingSerum207pots'    :      make207pots();
  end;
end;






begin
  DeclarePlayers;
  SetUpSRL;
  ProggyReport;
  ActivateClient;
  LoginPlayer;
  mouseSpeed := 10;

  Repeat
    scriptLoop();
    ProggyReport;
  Until(false);
end.