I slammed about 3 scripts together, cut things out, and I have this less-than-master piece!

Although, I'm having a problem with what I believe is begin/ends, but I can't figure this out to save my life. :|

Edit: Oops, forgot to add the error.
(Note: The error is highlighted on the LAST line, 'end.')

Simba Code:
Semicolon (';') expected at line 150
Compiling failed.

Simba Code:
program WillowCutter;
{$I SRL/SRL.Simba}
{$I P07Include.Simba}


var
    runison, math,z,i,Seconds,StartTime,XpPerHour,fletchedperhour:Integer;
    shopdtm, logs2, ChopWaitT, knife, willow, lagg, x,y, k,bankcolor1, invcount1:integer;
    invcount2, ChopWaitTime, WillowColor, smooth: integer;
    Status,XpOre,XpGained,logsfletched:Integer;

procedure DTM;
begin
smooth := 750;
BankColor1 := 2578800;
Lagg := 750; //lag time in ms
end;

Procedure P07_DeclarePlayer;
Begin
  P07_PlayerName:='';
  P07_PlayerPass:='';
end;

Procedure Callviruses;
Begin
   {Going to Name the Bitmap string " Ring ", and declare the variable under Var}
    knife:= BitmapFromString(10, 10, 'meJwztnE1tfMwBpIOnowMDCUlNY' +
        'WFVVlZRX39M4FcoDgEAdllZXVA2dy88rS03HnzVkFkgbpMHdwgsvk' +
        'FlRkZ+ZMmzQVyFRQMrJy8IWZWVDQAzczOKU1JyV68eD1EFq4RYiZQ' +
        '47TpiyBSEFkgm9MqFIhmzlrW2TVl2fJNEFmIYyBScAVYNUIQr0cO3' +
        'D1AhFUKUxZZCuxUEAIANwhKdQ==');
    willow:= BitmapFromString(20, 16, 'meJyNk8EKgkAQhvURgkCIIN/ADl' +
        'KIsZCwhz3kIchLEUQhdAh6/1Mjv46jo0vwHZZlvt3ZmdkwCEz9BZt' +
        'TtXZnsLIl4J0Rq8KFQ1fqDPYl2j28PlLXCkP5RMZOuh7a5xQuyo7S' +
        'lZnPKsaStUzzRbKjtUfs69ZZLbQ2ljYJiPnjzfWhkwkd2dDVP7vXW' +
        'EPsT9aW6hq7++szvdz6wyVTjaYXsYuc6YS5YdAdp3hcOtdlz5zAla' +
        'X2uKMuIM9/7tXta95buKSsJqdLi9xuzDOYm5DBzxLxRBxvidFU89V' +
        'tT4WCePADxTnrrg==');
        logs2 := BitmapFromString(20, 15, 'meJyNk7EKwjAUResvOAiFInVzEn' +
        'EpilQCFgJ2kIKgi11EcRAE/x+89tb0maS2cIYScl5e8m7V/TXZn8b' +
        '5gUS6IGbFIsrycL0dJekgCFTlSt3AdYlxIcbxHO7m9pS6qxjQT6g0' +
        'D7XcP9TXqQ4dLpZw2TPpUJTmNSGC2a6YqswrNu/2tWrwrTQWuQ4xv' +
        'TzM+6AycHd+EO/P+hSbyq7lTM30tjpfk2PZFJf4Bi3vxZ5RoS0MbR' +
        'OnS6wp98lJH7ctJ52ud3wcnOtK3Q0JYKhkrqyE/PxZYj+TTN61Vt9D');

shopDTM := DTMFromString('mGQAAAHicY2RgYMgGYhdGBobqBkUGEGAEEQAbPAHP');


End;

Procedure FreeBits;
Begin
  FreeBitMap(willow);
   FreeBitMap(knife);
End;

Function IsFletching: Boolean;
var
  PBox: TBox;
Begin
  PBox := IntToBox(250, 145, 273, 175);
  Result := (AveragePixelShift(PBox, 250, 350) > 75);
  Writeln(IntToStr(AveragePixelShift(PBox, 500, 650)));
   cleardebug;
End;

procedure fletchingLogs;
Begin
    If FindBitMapToleranceIn(knife, x, y, MIX1, MIY1, MIX2, MIY2, 50) Then
    Mouse(x, y, Random(1), Random(1), true);
    P07_ChooseOptionMulti(['use']);
    If FindBitMapToleranceIn(willow, x, y, MIX1, MIY1, MIX2, MIY2, 50) Then
    Mouse(x, y, Random(1), Random(1), true);
    P07_ChooseOptionMulti(['use']);
    P07_MouseBox(250, 435, 220, 400, 3);
    Wait(RandomRange(300,400));
    ClickMouse2(Mouse_Right);
    Wait(RandomRange(300,400));
    P07_ChooseOptionMulti(['ake X']);
    Wait(RandomRange(500,450));
    SendKeys('88', 95, 35);
    Wait(RandomRange(300, 400));
    P07_UseKey(13);
End;



Function isMoving1: Boolean;
  var
    PBox: TBox;
  begin
    PBox := IntToBox(237, 162, 282, 205);
    Result := (AveragePixelShift(PBox, 250, 500) > 90);
    Writeln(IntToStr(AveragePixelShift(PBox, 250, 500)));
     cleardebug;
  end;


procedure WaitHumanClick;
begin
  case random(600) of
    1..450: Wait(RandomRange(0, 100));
    451..570: Wait(RandomRange(0, 200));
    571..590: Wait(RandomRange(0, 600));
    591..600: Wait(RandomRange(400, 1100));
  end;
end;

  procedure OpenBank1;
var x, y: integer;
begin
  P07_MakeCameraAngleHigh;
  P07_MakeCompassNorth;
  WaitHumanClick;
  Repeat
    If P07_FindObj(x, y, 'ank booth', BankColor1, 10) Then
    begin
      WaitHumanClick;
      Mouse(RandomRange(X - 5, x + 5), RandomRange(Y - 5, Y + 5), random(3), random(3), false);
      WaitHumanClick;
      P07_ChooseOptionMulti(['se-q']);
      wait(lagg * 2);
    end;



begin
  P07_DeclarePlayer;
  callviruses;
  SetupP07Include;
  ActivateClient;
    AddOnTerminate('FreeDTMss')
  Addonterminate('FreeBits');
  Wait(1000);
  P07_MakeCameraAngleHigh;
P07_MakeCompassnorth;
 wait(200);
  DTM;
  wait(200);
  end;
if(P07_InvFull) then
begin
 repeat
 fletchinglogs;
    until not FindBitMapToleranceIn(willow,x,y,MIX1,MIY1,MIX2,MIY2, 50)
    Openbank1;
    P07_Deposit(2, 28, True);
  wait (lagg);
end.