Results 1 to 16 of 16

Thread: I Need Help.. With Everything.

  1. #1
    Join Date
    Jul 2007
    Location
    Between Here, And There.
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default I Need Help.. With Everything.

    Help, Please?

    Ok, so I've been here few a day for two now, non-stop searching for scripts that work for me.. yet, i found nothing.


    So this is what i have;

    SCAR 3.11 - File / Download SLR + Download Includes. And SetUp.SCAR saved.
    SCAR 3.06 - File / Download SLR + Download Includes. And SetUp.SCAR saved.


    So they are ready to use now right? Well nothing has worked up to yet.

    I've Also downloaded;
    Code:
    http://www.srl-forums.com/forum/showthread.php?t=13955

    *The SRL 3.81*

    I haven't installed SRL 3.81, because I've don the file / download step. And no tutorials stated i need to install SRL 3.81 manually.

    Ok, so i try and rune a script, i do everything it says in setup, and other procedures.
    And i get errors such as;

    Code:
    Line 137: [Error] (16019:1): Duplicate identifier 'HeadColor' in script
    And..
    Line 259: [Error] (15073:4): Unknown identifier 'RandomClickEvery' in script

    Ect, Ect, Ect.

    So Please any help given will be much appreciated, and i really need this, i haven't been able to fix this for two days straight.

    Thanks.
    P O O N4GE.

    Also add my Msn, but I'm not on it as much as i will be on forums - kidd-kaos@hotmail.com
    As you can see, i put a lot of effort into this post = ) so i hope to get some answers.

  2. #2
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ehm that random clickevery; is removed from srl or is not workin ins car anymore they dont work at my script so just delete it and just have scar 3.11 and srl 3.81 installed
    ~Hermen

  3. #3
    Join Date
    Jul 2007
    Location
    Between Here, And There.
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  4. #4
    Join Date
    Mar 2007
    Location
    Netherlands->Amersfoort.
    Posts
    1,615
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    edit: sorry.

    that head color is a mistake of the script.

  5. #5
    Join Date
    Jul 2007
    Location
    Between Here, And There.
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  6. #6
    Join Date
    Jun 2007
    Posts
    61
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    use the port sarim willow cutter by lorax with scar 3.11, it will work.

  7. #7
    Join Date
    Jul 2007
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by WonderBread View Post
    use the port sarim willow cutter by lorax with scar 3.11, it will work.
    That's the one he is having the Duplicate error problem with I think, the [SL] one.

  8. #8
    Join Date
    Jul 2007
    Location
    Between Here, And There.
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  9. #9
    Join Date
    Jun 2007
    Location
    England
    Posts
    262
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Change the procedure name, RuneScape doesn't have the axe flying off random anymore.. change it to "HeadColor123" or delete it completely.

    Edit: Post the script I'll fix it up for you.

  10. #10
    Join Date
    Jul 2007
    Location
    Between Here, And There.
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well it made it past the head error, but now i get this;

    Line 1641: [Error] (17523:1): Unknown identifier 'ClickItemColorTol' in script..
    ok ill post, thanks.

    SCAR Code:
    {=========================================================================]
    [                      Port Sarim Willow Whacker                          ]
    [                                                                         ]
    [           NAME        : Port Sarim Willow Whacker                       ]
    [           WRITER      : Lorax + Sumilion                                ]
    [           CATEGORY    : Woodcutter                                      ]
    [           DESCRIPTION : Chops willows in PS and banks them              ]
    [           USAGE       : Start at the willows / in the bank              ]
    [           AUTOCOLOR   : Yes                                             ]
    [                                                                         ]
    [                   More Scripts can be found at                          ]
    [                       [url]www.Villu-Reborn.com[/url]                              ]
    [=========================================================================]
    [                           Instructions.                                 ]
    [=========================================================================]
    [ 1. USE Runescape with Low Detail, Very Bright.                          ]
    [ 2. Set your Screen to 32 bit TRUE color.                                ]
    [ 3. Set Playernames and Passwords in the form (comes when started).      ]
    [ 4. Start script Logged Out / Logged in                                  ]
    [ 5. Set Colors or Leave at Zero to autopick                              ]
    [ 6. Have Axe in First inventoryslot or wielded and more in the bank      ]
    [ 7. Setup lines below                                                    ]
    [=========================================================================]
    [ Credits to :                                                            ]
    [  WT-Fakawi   --> For SRL and the SRL Community + FindFastRandoms ^^     ]
    [  StarBlaster100 --> For helping with all sorts of stuff                 ]
    [=========================================================================}

    program SLPSWW;
    {.include SRL/SRL.scar}
    {.include SRL/SRL/misc/Loading.scar}
    {.include SRL/SRL/misc/Trade.scar}
    {.include SRL/SRL/skill/WoodCutting.scar}

    //***********_Setup these_**********\\
    const
      PartOfRCName   = ''; // Your .Nick for your Remote Controll man
      UsePlayerForm  = True;  // If false, then DeclarePlayers(below) is used.

    //***********_Setup if wanted.._**********\\
    const
      MaxSecToWait   = 15;      // Will check for wc axe every x sec
      MaxLoginTime   = 25;      // Per playerturn - in minuts
      RanLoginTime   = 3;       // + x mins random time
      StartPlayer    = 0;       // Player to start with
      MinzCount      = 6;       // If it fails to find trees - lower this.
      MinWCount      = 20;      // Lower if it fails to find trees
      MinHCount      = 20;      // Lower this together with MinWCount

    //***********_No need to setup these_**********\\
    const
      DebugStyle     = 'Write'; // Write / Disguise / Status / None.
      DebugLevel     = 1;       // None: 0, Walking: 1, Tree finding: 2
      RunDir         = 'W';     // Changing wouldn't be necessary..
      RunFar         = True;    // Same here
      gMouseSpeed    = 20;      // Adds a random of 5
      MMLadder       = 1062250; // Autocolor doesnt work all to well...
      MSTreeColor    = 4350048; // Currently you don't need to change this

    //***********_Don't change_**********\\
    const
      VersionNumber  = '0.97';
      MinHue = 10;
      MaxHue = 34;
      MaxFenceCount = 7;

    //------------------------------------------------------------------------\\
    {                 DeclarePlayers - Sets Player array.                      ||
    \\------------------------------------------------------------------------//}


    procedure DeclarePlayers;
    begin
         HowManyPlayers := 6;
         CurrentPlayer := StartPlayer;
         NumberOfPlayers(HowManyPlayers); // set arraylength

         Players[0].Name :='Username';
         Players[0].Pass :='Password';
         Players[0].Nick :='sern';
         Players[0].Active:= True;
         Players[0].String1 := '0000';//PinNumber

         Players[1].Name :='Username';
         Players[1].Pass :='Password';
         Players[1].Nick :='sern';
         Players[1].Active:= True;
         Players[1].String1 := '0000';

         Players[2].Name :='Username';
         Players[2].Pass :='Password';
         Players[2].Nick :='sern';
         Players[2].Active:= True;
         Players[2].String1 := '0000';

         Players[3].Name :='Username';
         Players[3].Pass :='Password';
         Players[3].Nick :='sern';
         Players[3].Active:= True;
         Players[3].String1 := '0000';

         Players[4].Name :='Username';
         Players[4].Pass :='Password';
         Players[4].Nick :='sern';
         Players[4].Active:= True;
         Players[4].String1 := '0000';

         Players[5].Name :='Username';
         Players[5].Pass :='Password';
         Players[5].Nick :='sern';
         Players[5].Active:= True;
         Players[5].String1 := '0000';
    end;

    type
      RespondType = record
        Question: array of string;
        Answer: Integer;
      end;

    { FORM variables }

    var
      SLPSWWForm : TForm;
      mMemoBox : TMemo;
      bNews : TButton;
      bVersionCheck : TButton;
      bSetupUsers : TButton;
      bReportBug : TButton;
      bStartScript : TButton;
      bBestReport : TButton;

    { SCRIPT variables }

    var
      LadderColor, FarmingColor, QuestColor, WaterSymbolColor, BarColor, BankCount: Integer;
      LogMask, LogsChopped, Loads, gPlayerTime, gRanTime, gWillowFailSafes, WalkTries: Integer;
      dtmAxes: array[0..6] of Integer;
      HeadColor123: array[0..2] of Integer;
      gBrokenAxe, PlayerStatus: Boolean;
      PinNumber: string;

    { AUTO CHATTER variables }
    var
      OldChatText, NewChatText, OldChatter, NewChatter: string;
      arChatLines: array of RespondType;


    //******_Small usefull stuff_******\\
    //------------------------------------------------------------------------\\
    {                         DebugMe - Outputs Debug info                    ||
    \\------------------------------------------------------------------------//}


    procedure DebugMe(aString: string; Importance: Integer);
    begin
      if(DebugLevel >= Importance)then
      begin
        case LowerCase(DebugStyle) of
          'write' : WriteLn(astring);
          'disguise' : DisguiseScar(astring);
          'status' : Status(astring);
        end;
      end;
    end;

    //------------------------------------------------------------------------\\
    {              ChangeLoc - Changes the Loc of the player                   ||
    \\------------------------------------------------------------------------//}


    procedure ChangeLoc(aString: string);
    begin
      Players[CurrentPlayer].String2 := LowerCase(aString);
      WriteLn('We are at ' + aString);
    end;

    //------------------------------------------------------------------------\\
    {                PlayerLost - Logs out player when lost                   ||
    \\------------------------------------------------------------------------//}


    procedure PlayerLost(Info:string);
    begin
      Writeln('Player Lost, '+ Info);
      Logout;
    end;

    //------------------------------------------------------------------------\\
    {             ProgressReport - Prints the progressreport                  ||
    \\------------------------------------------------------------------------//}


    procedure ProgressReport;//Made by Fakawi, i think, edited by Sumilion
    var
      PActive, Spaces: string;
      i, K, MaxSpace, SpaceNumber: Integer;
    begin
      SRLRandomsReport;
      If Players[CurrentPlayer].Active then PActive:='True' else PActive:='False';
      Writeln(' ');
      Writeln('//=============== SL PSWW ================\\');
      Writeln('\\======== -'+VersionNumber+'- Progress Report ========//');
      Writeln('/==========================================\');
      Writeln('|      Worked for '+ TimeRunning);
      Writeln('|      Chopped '+ IntToStr(LogsChopped)+(' logs.'));
      Writeln('|      Banked '+ IntToStr(Loads)+(' times.'));
      Writeln('\==========================================/');
      Writeln('    Name       : '+Players[CurrentPlayer].Name);
      Writeln('    Wcing Lvl  : '+IntToStr(Players[CurrentPlayer].Level[20]));
      Writeln('    Worked for : '+IntToStr(Players[CurrentPlayer].Worked)+' minutes.');
      Writeln('    Active     : '+PActive);
      Writeln('    Location   : '+Players[CurrentPlayer].Loc);
      Writeln('\\----------------------------------------//');
      for i := 0 to HowManyPlayers-1 do
        if(Length(Players[I].Name) > MaxSpace)then
          MaxSpace := Length(Players[I].Name);
      for i := 0 to HowManyPlayers-1 do
      begin
        SpaceNumber := MaxSpace - Length(Players[I].Name);
        for K := 0 to SpaceNumber do
          Spaces := Spaces + ' ';
        if Players[i].Active=True then PActive:='True' else PActive:='False';
        Writeln( (IntToStr(I))+': '+ Players[I].Name + Spaces+ '= '+PActive+
        ' , Wc lvl : '+IntToStr(Players[i].Level[20])+
        ' , Worked '+IntToStr(Players[i].Worked)+ ' minutes, '+
        'Loc: '+Players[i].Loc)
        Spaces := '';
      end;
      Writeln('\\========================================//');
      if(ScriptTime(3) > StrToIntDef(LoadSetting('PSWW', 'LongestTime'), 0))then
      begin
        Writeln('Saved Proggie!');
        SaveSetting('PSWW', 'LongestTime', IntToStr(ScriptTime(3)));
        SaveSetting('PSWW', 'BestTime', TimeRunning);
        SaveSetting('PSWW', 'BestLogs', IntToStr(LogsChopped));
        SaveSetting('PSWW', 'BestBanks', IntToStr(Loads));
      end;
    end;

    //------------------------------------------------------------------------\\
    {             LoadBMPs - Loads LOTS of bmps in the memory ^^.             ||
    \\------------------------------------------------------------------------//}


    procedure LoadBMPs;
    begin
      LogMask := BitmapFromString(13, 10, 'z78DA33301805E40037BC8' +
           '0BAB6D0C2E5F451494998D02E5471010034299979');
    end;

    //------------------------------------------------------------------------\\
    {                LoadDTMs - Loads the DTMs in the memory.                 ||
    \\------------------------------------------------------------------------//}


    procedure LoadDTMs;
    begin
      dtmAxes[1] := DTMFromString('78DA633CC4C4C050CCC8800C1A13F91852803' +
         '448F43F10309E05AA294055631B18C5C0055503028CE7816A3251' +
         'D5384725A3AA3981A9C6333107450D00A4080D5C'); //rune
      dtmAxes[2] := DTMFromString('78DA63746162602865644006AD297C0C29401' +
         'A24FA1F0818FD816A0A50D5587B5B337041D580006320504D26AA' +
         '1AC7204754355E986ADCA33D51D40000E10C0AEF'); //addy
      dtmAxes[3] := DTMFromString('78DA633CC4C4C010C0C8800C5A53F81852803' +
         '448F43F10309E05AAF14155636111CCC0055503028CE7816A5C51' +
         'D5D839C4A2AA3981A9C6C52D0D450D0061FC0C64'); //mith
      dtmAxes[4] := DTMFromString('78DA63CC636260D8C3C8800C5A53F81852803' +
         '448F43F10305602D5EC4055939B9ACAC0055503028CD540351B51' +
         'D594E5E5A2AA29C154D3545989A20600C3BC0E32'); //steel
      dtmAxes[5] := DTMFromString('78DA639CC1C4C0309D9101193426F231A4006' +
         '990E87F20605C0C543305558DA78B0B0317540D08302E05AAE945' +
         '5513E4ED8DAA661EA69AA8E0601435008C000CFF'); //iron
      dtmAxes[6] := DTMFromString('78DA63CC636260D0666440068D897C0C29401' +
         'A24FA1F08182B816A3450D5B898C8317041D580006335508D22AA' +
         '1A5F6B65543525986A02ED5451D400009DDA09E3'); //bronze
    end;

    //------------------------------------------------------------------------\\
    {     BestProgressReport - Writes the best progress report made.          ||
    \\------------------------------------------------------------------------//}


    procedure BestProgressReport;
    begin
      if(LoadSetting('PSWW', 'BestTime') = '')then
      begin
        mMemoBox.Lines.Add('--');
        mMemoBox.Lines.Add('Currently unavailable.');
        Exit;
      end;
      mMemoBox.Lines.Add('--');
      mMemoBox.Lines.Add('//=========== SL PSWW   ===========\\');
      mMemoBox.Lines.Add('\\======  -Best- Progress Report ========//');
      mMemoBox.Lines.Add('/===============================\');
      mMemoBox.Lines.Add('|  Worked for '+ LoadSetting('PSWW', 'BestTime'));
      mMemoBox.Lines.Add('|  Chopped '+ LoadSetting('PSWW', 'BestLogs')+(' logs.'));
      mMemoBox.Lines.Add('|  Banked '+ LoadSetting('PSWW', 'BestBanks')+(' times.'));
      mMemoBox.Lines.Add('\===============================/');
    end;

    //------------------------------------------------------------------------\\
    {                      WriteNews - Writes the News.                       ||
    \\------------------------------------------------------------------------//}


    procedure WriteNews(HowMany: Integer);//Thnx to StarBlaster
    var
      Timer, i, x, y: Integer;
      News :array of string;
      New, TheNews: string;
    begin
      SetArrayLength(News, HowMany+1);
      Wait(1);
      TheNews := Getpage('http://sumilionscripts.freehostia.com/PSWWNews.txt');
      x := 0;
      mMemoBox.Lines.Add('--');
      mMemoBox.Lines.Add('//==============================\\');
      mMemoBox.Lines.Add('| >> PSWW News      (v' + VersionNumber + ')');
      mMemoBox.Lines.Add('|');
      y := 1;
      for i := 1 to HowMany do
      begin
        MarkTime(Timer);
        repeat
          x := x + 1;
          new := copy(TheNews, x, x+1);
          if(new = '|')then
          begin
            i := HowMany;
            Break;
          end;
        until(copy(new, 1, 1) = ',')or(TimeFromMark(Timer) >= 2000);
      news[i]:= copy(TheNews, y, (x-y));
      y := x + 1;
      mMemoBox.Lines.Add('|       --   '+news[i]);
      Wait(1);
      end;
      mMemoBox.Lines.Add('|');
      mMemoBox.Lines.Add('\\==============================//');
    end;

    //------------------------------------------------------------------------\\
    {             CheckVersion - Checks the current version.                  ||
    \\------------------------------------------------------------------------//}


    procedure CheckVersion;
    var
      CurrentVersion: Extended;
    begin
      CurrentVersion := StrToFloat(GetPage('http://sumilionscripts.freehostia.com/PSWWVersion.txt'));
      if(CurrentVersion > StrToFloat(VersionNumber))then
      begin
        mMemoBox.Lines.Add('--');
        mMemoBox.Lines.Add('Your current version is outdated.');
        mMemoBox.Lines.Add('Contact Lorax or Sumilion for an update.');
        Exit;
      end;
      mMemoBox.Lines.Add('--');
      mMemoBox.Lines.Add('You are up to date.');
    end;

    //------------------------------------------------------------------------\\
    {             FormStuff - Different stuff for the form.                   ||
    \\------------------------------------------------------------------------//}


    procedure CheckNicks; forward;
    procedure ButtonClick(Sender: TObject);
    begin
      case Sender of
        bStartScript :
        begin
          SLPSWWForm.Caption:= SLPSWWForm.Caption + '.';
          SLPSWWForm.ModalResult:= mrOk;
        end;
        bSetupUsers :
        begin
          StartPlayers(true, 'string1');
          mMemoBox.Lines.Add('--');
          mMemoBox.Lines.Add('Players Saved.');
          CheckNicks;
        end;
        bReportBug :
        begin
          mMemoBox.Lines.Add('--');
          mMemoBox.Lines.Add('Currently unavailable.');
        end;
        bVersionCheck :
          CheckVersion;
        bNews :
          WriteNews(10);
        bBestReport :
          BestProgressReport;
      end;
    end;

    {Normal Form}
    procedure LoadSLPSWWForm;
    begin
      SLPSWWForm := CreateForm;
      SLPSWWForm.Left := 250;
      SLPSWWForm.Top := 114;
      SLPSWWForm.Width := 439;
      SLPSWWForm.Height := 351;
      SLPSWWForm.Caption := 'SL PSWW - Form';
      SLPSWWForm.Color := clBtnFace;
      SLPSWWForm.Font.Color := clWindowText;
      SLPSWWForm.Font.Height := -11;
      SLPSWWForm.Font.Name := 'MS Sans Serif';
      SLPSWWForm.Font.Style := [];
      SLPSWWForm.Visible := False;
      SLPSWWForm.PixelsPerInch := 96;
      mMemoBox := TMemo.Create(SLPSWWForm);
      mMemoBox.Font.Name := 'Segoe UI';
      mMemoBox.Font.Height := -12;
      mMemoBox.Parent := SLPSWWForm;
      mMemoBox.Left := 134;
      mMemoBox.Top := 16;
      mMemoBox.Width := 272;
      mMemoBox.Height := 225;
      mMemoBox.Lines.Add('Thank you for using the PSWW.');
      mMemoBox.TabOrder := 4;
      bNews := TButton.Create(SLPSWWForm);
      bNews.Parent := SLPSWWForm;
      bNews.Left := 30;
      bNews.Top := 20;
      bNews.Width := 83;
      bNews.Height := 25;
      bNews.Caption := 'News';
      bNews.TabOrder := 0;
      bNews.OnClick := @ButtonClick;
      bVersionCheck := TButton.Create(SLPSWWForm);
      bVersionCheck.Parent := SLPSWWForm;
      bVersionCheck.Left := 30;
      bVersionCheck.Top := 55;
      bVersionCheck.Width := 83;
      bVersionCheck.Height := 25;
      bVersionCheck.Caption := 'Version Check';
      bVersionCheck.TabOrder := 1;
      bVersionCheck.OnClick := @ButtonClick;
      bSetupUsers := TButton.Create(SLPSWWForm);
      bSetupUsers.Parent := SLPSWWForm;
      bSetupUsers.Left := 30;
      bSetupUsers.Top := 160;
      bSetupUsers.Width := 83;
      bSetupUsers.Height := 25;
      bSetupUsers.Caption := 'Setup Users';
      bSetupUsers.TabOrder := 4;
      bSetupUsers.OnClick := @ButtonClick;
      bStartScript := TButton.Create(SLPSWWForm);
      bStartScript.Parent := SLPSWWForm;
      bStartScript.Left := 163;
      bStartScript.Top := 266;
      bStartScript.Width := 197;
      bStartScript.Height := 25;
      bStartScript.Caption := 'Start Script!';
      bStartScript.TabOrder := 5;
      bStartScript.OnClick := @ButtonClick;
      bReportBug := TButton.Create(SLPSWWForm);
      bReportBug.Parent := SLPSWWForm;
      bReportBug.Left := 30;
      bReportBug.Top := 90;
      bReportBug.Width := 83;
      bReportBug.Height := 25;
      bReportBug.Caption := 'Report Bug';
      bReportBug.TabOrder := 2;
      bReportBug.OnClick := @ButtonClick;
      bBestReport := TButton.Create(SLPSWWForm);
      bBestReport.Parent := SLPSWWForm;
      bBestReport.Left := 30;
      bBestReport.Top := 125;
      bBestReport.Width := 83;
      bBestReport.Height := 25;
      bBestReport.Caption := 'Best Report';
      bBestReport.TabOrder := 3;
      bBestReport.OnClick := @ButtonClick;
    end;

    procedure ShowFormModal;
    begin
      SLPSWWForm.ShowModal;
    end;

    procedure Signature; forward;
    procedure ShowNormalForm;
    var
      v: TVariantArray;
    begin
      Signature;
      SetArrayLength(V, 0);
      ThreadSafeCall('LoadSLPSWWForm', v);
      SetArrayLength(v, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    //------------------------------------------------------------------------\\
    {              LoadChatArray - Loads Chat text in the memory.             ||
    \\------------------------------------------------------------------------//}


    procedure LoadChatArray;
    begin
      SetArrayLength(arChatLines, 20);
        //b
      SetArrayLength(arChatLines[0].Question, 1);
      arChatLines[0].Question[0] := 'ban';
      arChatLines[0].Answer   := 2;
        //c
      SetArrayLength(arChatLines[1].Question, 1);
      arChatLines[1].Question[0] := 'cheat';
      arChatLines[1].Answer   := 2;
        //g
      SetArrayLength(arChatLines[2].Question, 1);
      arChatLines[2].Question[0] := 'gf';
      arChatLines[2].Answer   := 3;
      SetArrayLength(arChatLines[3].Question, 1);
      arChatLines[3].Question[0] := 'girl friend';
      arChatLines[3].Answer   := 3;
        //h
      SetArrayLength(arChatLines[4].Question, 1);
      arChatLines[4].Question[0] := 'hi';
      arChatLines[4].Answer   := 0;
      SetArrayLength(arChatLines[5].Question, 1);
      arChatLines[5].Question[0] := 'hey';
      arChatLines[5].Answer   := 0;
      SetArrayLength(arChatLines[6].Question, 1);
      arChatLines[6].Question[0] := 'hello';
      arChatLines[6].Answer   := 0;
      SetArrayLength(arChatLines[7].Question, 1);
      arChatLines[7].Question[0] := 'how are';
      arChatLines[7].Answer   := 1;
        //r
      SetArrayLength(arChatLines[8].Question, 1);
      arChatLines[8].Question[0] := 'report';
      arChatLines[8].Answer   := 2;
        //w
      SetArrayLength(arChatLines[9].Question, 3);
      arChatLines[9].Question[0] := 'wc';
      arChatLines[9].Question[1] := '+level';
      arChatLines[9].Question[2] := '+lvl';
      arChatLines[9].Answer   := 4;
      SetArrayLength(arChatLines[10].Question, 3);
      arChatLines[10].Question[0] := 'woodcut';
      arChatLines[10].Question[1] := '+level';
      arChatLines[10].Question[2] := '+lvl';
      arChatLines[10].Answer   := 4;
    end;

    //------------------------------------------------------------------------\\
    {                 LoadAnswer - Loads answers in the memory.               ||
    \\------------------------------------------------------------------------//}


    function LoadAnswer(AnswerType: Integer): string;
    begin
      case AnswerType of
        0: begin
             case Random(5) of
               0: Result := 'hi';
               1: Result := 'hey';
               2: Result := 'whats up?';
               3: Result := 'hello';
               4: Result := 'hey you';
             end;
           end;
        1: begin
             case Random(4) of
               0: Result := 'fine';
               1: Result := 'good';
               2: Result := 'ok';
               3: Result := 'splendid';
             end;
           end;
        2: begin
             case Random(6) of
               0: Result := 'why?';
               1: Result := 'me?';
               2: Result := 'sure';
               3: Result := 'if you feel like it';
               4: Result := 'please don''t';
               5: Result := 'that''s not nice';
             end;
           end;
        3: begin
             case Random(5) of
               0: Result := 'lol';
               1: Result := 'ew';
               2: Result := 'haha';
               3: Result := 'go away!';
               4: Result := 'let''s not';
             end;
           end;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                  CompareStrings - Compares the string.                  ||
    \\------------------------------------------------------------------------//}


    function CompareStrings(comText: string; var Count: Integer): Boolean;
    var
      bolMatch: array of Boolean;
      Count2, Count3: Integer;
      tmpString: string;
    begin
      WriteLn('we got to comparestrings');
      for Count := 0 to GetArrayLength(arChatLines) - 1 do
      begin
        Count3 := 0;
        SetArrayLength(bolMatch, Count3);
        for Count2 := 0 to GetArrayLength(arChatLines[Count].Question) - 1 do
        begin
          if(arChatLines[Count].Question[Count2][1] = '+')then
          begin
            if(Count2 <> 0)then
            begin
              if(arChatLines[Count].Question[Count2-1][1] <> '+')then
              begin
                Count3 := Count3 + 1;
                SetArrayLength(bolMatch, Count3);
              end;
            end else
            begin
             Count3 := Count3 + 1;
             SetArrayLength(bolMatch, Count3);
            end;

            tmpString := Copy(arChatLines[Count].Question[Count2], 2, Length(arChatLines[Count].Question[Count2]));
            WriteLn('+:'+tmpString);
            if(bolMatch[Count3 - 1] <> True)then
              if(Pos(tmpString, comText) <> 0)then
                bolMatch[Count3 - 1] := True;

          end else
          begin

            Count3 := Count3 + 1;
            SetArrayLength(bolMatch, Count3);
            tmpString := arChatLines[Count].Question[Count2];

            if(Pos(tmpString, comText) <> 0)then
              bolMatch[Count3 - 1] := True;
          end;

        end;

        Result := True;
        for Count3 := 0 to GetArrayLength(bolMatch) - 1 do
        begin
          if(bolMatch[Count3] = False)then
            WriteLn('bolMatch['+IntToStr(Count3)+']:False');
          if(bolMatch[Count3] = True)then
            WriteLn('bolMatch['+IntToStr(Count3)+']:True');
          if(bolMatch[Count3] = False)then
            Result := False;
        end;
        if Result then
          Exit;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                       ChatBack - Should we chat ?                       ||
    \\------------------------------------------------------------------------//}


    function ChatBack: Boolean;
    var
      MyAnswer: string;
      Count: Integer;
    begin
      OldChatText := NewChatText;
      OldChatter := NewChatter;
      GetLastChatText(NewChatText);
      LastChatter(NewChatter);

      WriteLn('NewChatText: '+NewChatText);
      WriteLn('OldChatText: '+OldChatText);

      if(NewChatter = '')then
        Exit;

      if(NewChatter <> LowerCase(Players[CurrentPlayer].Name))then
        WriteLn('Newchatter <> us')
      else
        WriteLn('NewChatter = us');
      if(OldChatText <> NewChatText)then
        WriteLn('Old text <> New text')
      else
        WriteLn('OldChatText = NewChatText');
      if(NewChatter <> LowerCase(Players[CurrentPlayer].Name))and
        (OldChatText <> NewChatText)then
      begin

        if CompareStrings(NewChatText, Count)then
          Result := True;

        if Result then
        begin
          MyAnswer := LoadAnswer(arChatLines[Count].Answer);
          TypeSend(MyAnswer);
        end;
      end;
    end;

    //******_Anti Randoms_******\\
    //------------------------------------------------------------------------\\
    {              FindFastRandoms - Finds basic randoms                      ||
    \\------------------------------------------------------------------------//}


    function FindFastRandoms: Boolean; //WT-Fawki
    var
      i: Integer;
    begin
      for i:=1 to 9 do
      begin
        case I of
         1:  If FindDead then
               Result := True;
         2:  If FindMod then
               Result := True;
         3:  If FindMime then
               Result := True;
         4:  If FindMaze then
               Result := True;
         5:  If FindQuiz then
               Result := True;
         6:  If FindDemon then
               Result := True;
         7: begin
               if NoGameTab then
               begin
                 Result := True;
                 ChangeLoc('No GameTab');
                 Logout;
                 Exit;
               end;
             end;
         7: begin
               if InBlack then
               begin
                 Result := True;
                 ChangeLoc('InBlack');
                 Logout;
                 Exit;
               end;
             end;
         8: if(RC)or(HandleTrade)then
              Result := True;
         9: if FindTalk then
              Result := True;
    //     10:  if ChatBack then
    //            Result := True;
        end;
        wait(1);
      end;
    end;

    //******_Math procedures_******\\
    //------------------------------------------------------------------------\\
    {                 FindColorsArray - Finds Raw colors                      ||
    \\------------------------------------------------------------------------//}


    function FindColorsArray(Color, Tolerance, Step, MaxTol: Integer): TPointArray;
    var
      Count, tx, ty: Integer;
    begin
      while (not FindColorTolerance(tx, ty, Color, MSX1, MSY1, MSCX, MSY2, Tolerance + Count * Step))and
            (Count * Step <= MaxTol) do
        Count := Count + 1;
      FindColorsSpiralTolerance(MSCX, MSCY, Result, Color, MSX1, MSY1, MSCX, MSY2, Tolerance + Count * Step);
    end;

    //------------------------------------------------------------------------\\
    {                getArrayFromBox - Gets colors in groups                  ||
    \\------------------------------------------------------------------------//}


    function getArrayFromBox(arColor: TPointArray; Width, Height: Integer): TPointArray;
    var
      Count, Count2, Count3: Integer;
      Match: Boolean;
    begin
      Count2 := 1;
      SetArrayLength(Result, Count2);
      Result[Count2 - 1].x := arColor[0].x;
      Result[Count2 - 1].y := arColor[0].y;
      for Count := 1 to GetArrayLength(arColor) - 1 do
      begin
        Match := False;
        for Count3 := 0 to GetArrayLength(Result) - 1 do
        begin
          if(arColor[Count].x < Result[Count3].x + Width)and
            (arColor[Count].y < Result[Count3].y + Height)and
            (arColor[Count].x > Result[Count3].x - Width)and
            (arColor[Count].y > Result[Count3].y - Height)then
            Match := True;
        end;
        if(Match = False)then
        begin
          Count2 := Count2 + 1;
          SetArrayLength(Result, Count2);
          Result[Count2 - 1].x := arColor[Count].x;
          Result[Count2 - 1].y := arColor[Count].y;
        end;
      end;
    end;

    //------------------------------------------------------------------------\\
    {              CheckColor - Checks that we haven't found a player         ||
    \\------------------------------------------------------------------------//}


    function CheckColor(ax, ay: Integer): Boolean;
    var
      xCount, yCount, zCount: Integer;
    begin
      for xCount := 0 to 4 do
        for yCount := 0 to 4 do
          if SimilarColors(GetColor(ax - 2 + xCount, ay - 2 + yCount), 16183532, 15) then
            zCount := zCount + 1;

      if(zCount <= MaxFenceCount)then
        Result := True;
    end;

    //------------------------------------------------------------------------\\
    {        IsFenceInLine - Checks for fence between two points              ||
    \\------------------------------------------------------------------------//}


    function IsFenceInLine(var ax, ay: Integer; x1, y1, x2, y2, fromPercent, toPercent: Integer): Boolean;
    var
      a, b: Extended;
      t1, t2, Count: Integer;
    begin
      t1 := x1; t2 := x2;
      x1 := Min(t1, t2);
      x2 := Max(t1, t2);
      if x1 <> t1 then begin t1 := y1; t2 := y2; y1 := t2; y2 := t1; end;
      t1 := -y1;
      t2 := -y2;
      a := (t2 - t1) div (x2 - x1);
      b := t1 - (a * x1);

      for Count := Trunc((fromPercent div 100.0) * (x2 - x1)) to Trunc((toPercent div 100.0) * (x2 - x1)) - 1 do
      begin
        ax := Count + x1;
        ay := Trunc(-1 * (a * ax + b));
        if SimilarColors(GetColor(ax, ay), 16183532, 15) then
        begin
          if CheckColor(ax, ay) then
          begin
            Result := True;
            Exit;
          end;
        end;
      end;
    end;

    //******_Walking procedures_******\\
    //------------------------------------------------------------------------\\
    {             SLWaterWalk - Walks along the water / road                  ||
    \\------------------------------------------------------------------------//}


    function SLWaterWalk(StartRadial, EndRadial: Integer; Radius,
      FFlagBreakOut: Integer; Xoff, Yoff, Xmod, Ymod: Integer): Boolean;
        // By Wizzup? and WT-Fakawi.
    var
      i, X1, Y1: Integer;
    begin
      Result := False;
      if not(LoggedIn)then
        Exit;
      if (StartRadial < EndRadial) then
      begin
        repeat
          for i := StartRadial to EndRadial do
          begin
            x1 := Round(Radius * Sine(i)) + 646;
            y1 := Round(-Radius * Cose(i)) + 84;
            if FindColor(x, y, RoadColor, X1, Y1, X1 + 1, Y1 + 1) then
            begin
              MouseFindNoFlag(x + Xoff, y + Yoff, Xmod, Ymod);
              Result := True;
              FFlag(FFlagBreakOut);
              Exit;
            end;
          end;
          Radius := Radius - 4;
        until Radius <= 1;
      end;
      if (StartRadial > EndRadial) then
      begin
        repeat
          for i := StartRadial downto EndRadial do
          begin
            x1 := Round(Radius * Sine(i)) + 646;
            y1 := Round(-Radius * Cose(i)) + 84;
            if (FindColor(x, y, RoadColor, X1, Y1, X1 + 1, Y1 + 1)) then
            begin
              MouseFindNoFlag(x + Xoff, y + Yoff, Xmod, Ymod);
              Result := True;
              FFlag(FFlagBreakOut);
              Exit;
            end;
          end;
          Radius := Radius - 4;
        until Radius <= 1;
      end;
    end;

    //------------------------------------------------------------------------\\
    {               SLGetSymbol - Lowers acc for better finding               ||
    \\------------------------------------------------------------------------//}


    function SLGetSymbol(var ax, ay: Integer; Symbol: string): Integer;
    begin
      SymbolAccuracy := 0.7;
      if(Lowercase(Symbol) = 'bank')then
        SymbolAccuracy := 0.3;
      Result := GetSymbolColor(ax, ay, Symbol);
      DebugMe(IntToStr(ax)+' '+IntToStr(ay), 1);
      SymbolAccuracy := 0.8;
    end;

    //------------------------------------------------------------------------\\
    {               GotColor - Do we got the wanted color ?                   ||
    \\------------------------------------------------------------------------//}


    function GotColor(ColorType: string): Boolean;
    begin
      case LowerCase(ColorType) of
        'bank'  : Result := (BankColor    > 0);
        'road'  : Result := (RoadColor    > 0);
        'ladder': Result := (LadderColor  > 0);
        'quest' : Result := (QuestColor   > 0);
        'farm'  : Result := (FarmingColor > 0);
      end;
      if not(Result)then
      begin
        Writeln(ColorType + 'Color NOT found, setting to false');
        LogOut;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                   RelocateAtWillows - Resets player                     ||
    \\------------------------------------------------------------------------//}


    procedure RelocateAtWillows;
    var
      ax, ay: Integer;
    begin
      if not(LoggedIn)then
        Exit;
      MakeCompass('N');
      if(SLGetSymbol(ax, ay, 'farming spot') <> 0)then
      begin
        DebugMe('Relocated - used farm spot', 1);
        MouseFindNoFlag(ax + 10, ay + 15, 5, 5);
        FFlag(0);
        Exit;
      end else
        DebugMe('Didn''t find farm spot', 1);

      if(QuestColor = 0)then
        QuestColor := SLGetSymbol(ax, ay, 'quest');
      if(QuestColor <> 0)then
        if FindColor(ax, ay, QuestColor, MMX1, MMCY, MMX2, MMY2) then
        begin
          DebugMe('Relocated - used QuestColor', 1);
          MouseFindNoFlag(ax + 20, ay - 20, 4, 4);
          FFlag(0);
          RelocateAtWillows;
          Exit;
        end else
          DebugMe('Didn''t find QuestSymbol', 1);

      if(BarColor = 0)then
        BarColor := SLGetSymbol(ax, ay, 'bar');
      if(BarColor <> 0)then
        if FindColor(ax, ay, BarColor, MMX1, MMY1, MMX2, MMY2) then
        begin
          DebugMe('Relocated - used BarColor', 1);
          MouseFindNoFlag(ax + 30, ay + 10, 4, 4);
          FFlag(0);
          RelocateAtWillows;
          Exit;
        end else
          DebugMe('Didn''t find BarColor', 1);

      WriteLn('We didn''t find any points - while relocating');
      LogOut;
    end;

    //------------------------------------------------------------------------\\
    {                 BankToWillows - Walks to the willows                    ||
    \\------------------------------------------------------------------------//}


    procedure BankToWillows;
    var
      ax, ay, Count: Integer;
    begin
      if LoggedIn then
      begin
        MouseSpeed := 5 + Random(5);
        MakeCompass('N');
        WriteLn('Bank to willows');
        FindRoadColor;
        GotColor('Road');
        if(BankColor = 0)then
          BankColor := SLGetSymbol(ax, ay, 'bank');
        GotColor('Bank');
        if(LadderColor = 0)then
        begin
          LadderColor := FindLadderColor;
          GotColor('Ladder');
        end;

        SLWaterWalk(300, 220, 60, 8, 0, 0, 3, 3);
        DebugMe('Walked left of bank using RoadWalk', 1);

        if(QuestColor = 0)then
        begin
          DebugMe('QuestColor was 0, now finding QuestColor using symbol', 1);
          QuestColor := SLGetSymbol(ax, ay, 'quest');
          if(QuestColor = 0)then
            DebugMe('Didn''t find QuestColor at first try', 1);
        end;

        if(QuestColor <> 0)then
          DebugMe('QuestColor is not zero - QuestColor: '+IntToStr(QuestColor), 1);

        if(QuestColor = 0)or(not FindColor(ax, ay, QuestColor, MMX1, MMY1, MMX2, MMY2))then
        begin
          Wait(500 + Random(100));
          FFlag(0);
          DebugMe('Making FFlag(0) because of previously not found QuestColor, QuestColor: '+IntToStr(QuestColor), 1);
          if(QuestColor = 0)then
            QuestColor := SLGetSymbol(ax, ay, 'quest');

          if(QuestColor = 0)or(not FindColor(ax, ay, QuestColor, MMX1, MMY1, MMX2, MMY2))then
          begin
            DebugMe('Didn''t find QuestColor using FFlag(0) - using RoadWalk now, QuestColor: '+IntToStr(QuestColor), 1);
            FindRoadColor;
            SLWaterWalk(300, 220, 50, 0, 0, 0, 0, 0);
            if(QuestColor = 0)then
              QuestColor := SLGetSymbol(ax, ay, 'quest');

            if(QuestColor = 0)or(not FindColor(ax, ay, QuestColor, MMX1, MMY1, MMX2, MMY2))then
            begin
              DebugMe('Didn''t find QuestColor using RoadWalk then GetSymbolColor - setting False', 1);
              LogOut;
              Players[CurrentPlayer].Active := False;
            end;
          end;
        end;

        if FindColor(ax, ay, QuestColor, MMX1, MMY1, MMX2, MMY2) then
        begin
          DebugMe('Found QuestColor - Clicking x coordinate - 22', 1);
          MouseFindNoFlag(ax - 22, ay, 3, 3);
        end;

        FFlag(10);

        for Count := 3 downto 0 do
        begin
          if(SLGetSymbol(ax, ay, 'farming spot') <> 0)then
          begin
            DebugMe('Found farming spot', 1);
            if(ay - 25 > 25)then
            begin
              DebugMe('ay - 25 > 25 = true - we can safely click now', 1);
              Break;
            end else
              DebugMe('farming spot coordinates is to close to upper edge of MM', 1);
          end else
            DebugMe('Farming spot not visible yet', 1);

          if(QuestColor <> 0)then
            if FindColor(ax, ay, QuestColor, MMX1, MMY1, MMX2, MMY2) then
            begin
              MouseFindNoFlag(ax - 22 - 24 + (Count * 6), ay, 3, 3);
              DebugMe('Found QuestColor clicking closer to the fence ('+IntToStr(4-Count)+') - using FFlag(0)', 1);
            end;

          FFlag(0);
        end;

        if(SLGetSymbol(ax, ay, 'farming spot') <> 0)then
        begin
          DebugMe('Found farm spot clicking x + 20 + Random(5), y - 25 - Random(3)', 1);
          MouseFindNoFlag(ax + 20 + Random(5), ay - 25 - Random(3), 0, 7);
          if(not FlagPresent)then
          begin
            DebugMe('There were no flag (Waiting 3000 + Random(1000))', 1);
            Wait(3000 + Random(1000));
          end;
        end else
        begin
          DebugMe('Found no farm symbol - using QuestSymbol (x - 50), (y - 30), 3, 3', 1);
          if FindColor(ax, ay, QuestColor, MMX1, MMY1, MMX2, MMY2) then
            MouseFindNoFlag(ax - 50, ay - 30, 3, 3);
        end;

        FFlag(0);
        if(SLGetSymbol(ax, ay, 'farming spot') <> 0)then
        begin
          DebugMe('Found farm spot - clicking (ax + 10), (ay + 15)', 1);
          MouseFindNoFlag(ax + 10, ay + 15, 5, 5);
        end else
        begin
          DebugMe('Didn''t find farm spot number 2 - trying again', 1);
          FFlag(0);
          if(SLGetSymbol(ax, ay, 'farming spot') <> 0)then
          begin
            DebugMe('Found farm spot - clicking (ax + 10), (ay + 15)', 1);
            MouseFindNoFlag(ax + 10, ay + 15, 5, 5);
            FFlag(0);
          end else
          begin
            DebugMe('Didn''t find farm spot number 2 second try', 1);
            for Count := 0 to 2 do
            begin
              DebugMe('Making blind click', 1);
              MouseFindNoFlag(635, 105, 5, 5);
              FFlag(0);
              if(SLGetSymbol(ax, ay, 'farming spot') <> 0)then
              begin
                Count := -1;
                Break;
              end;
            end;
            if(Count <> 2)then
            begin
              DebugMe('Found farm spot - clicking (ax + 10), (ay + 15)', 1);
              MouseFindNoFlag(ax + 10, ay + 15, 5, 5)
            end else
            begin
              WriteLn('Didn''t find farm spot number 2 - setting active: false');
              LogOut;
              Exit;
            end;
          end;
        end;

        FFlag(0);
        ChangeLoc('willows');
      MouseSpeed := gMouseSpeed + Random(5);
      end;
    end;

    //------------------------------------------------------------------------\\
    {                    WillowsToBank - Walks to the bank                    ||
    \\------------------------------------------------------------------------//}


    procedure WillowsToBank;
    var
      ax, ay, bx, by, cx, cy, Count: Integer;
    begin
      if LoggedIn then
      begin
        MouseSpeed := 5 + Random(5);
        MakeCompass('N');
        WriteLn('Willows to bank');
        if(FarmingColor = 0)then
          FarmingColor := SLGetSymbol(ax, ay, 'farming spot');
        GotColor('Farm');

        if(QuestColor = 0)then
          QuestColor := SLGetSymbol(ax, ay, 'quest');
        GotColor('Quest');

        while(not FindColor(bx, by, QuestColor, 678, MMY1, MMX2, MMY2))and
             (Count <= 24)do
        begin
          DebugMe('Didn''t find QuestColor', 1);
          if FindColor(ax, ay, FarmingColor, MMX1, MMY1, MMX2, MMY2) then
          begin
            MouseFindNoFlag(ax + 10 + Count, ay, 3, 3);
            DebugMe('Found farm color - optimating location (ax + 10 + '+IntToStr(Count)+')', 1);
            FFlag(0);
          end;
          Count := Count + 6;
        end;

        if Count = 30 then
        begin
          WalkTries := WalkTries + 1;
          if(WalkTries = 4)then
          begin
            WriteLn('Player lost during walkback - WalkTries = 4 - setting false');
            Players[CurrentPlayer].Active := False;
          end;
          RelocateAtWillows;
          WillowsToBank;
          Exit;
        end else
          WalkTries := 0;

        if(FindColor(ax, ay, FarmingColor, MMX1, MMY1, MMX2, MMY2))and
          (FindColor(bx, by, QuestColor, 678, MMY1, MMX2, MMY2))then
        begin
          DebugMe('Found Farm + Quest color', 1);
          if IsFenceInLine(cx, cy, ax, ay, bx, by, 40, 60)then
          begin
            DebugMe('Used fence to walk clicking (cx + 8), ((by + ay) div 2 - 25)', 1);
            MouseFindNoFlag(cx + 8, (by + ay) div 2 - 25, 3, 3);
          end else
          begin
            DebugMe('used 30% Farm (x) and 70% Quest x, (by + ay) div 2 - 25', 1);
            MouseFindNoFlag( Trunc(ax * 0.3 + bx * 0.7), (by + ay) div 2 - 25, 3, 3);
          end;
        end;

        FFlag(0);
        if(not FindColor(bx, by, QuestColor, MMCX, MMY1, MMX2, MMY2))then
        begin
          DebugMe('We didn''t get all the way - Waiting(4000 + Random(1000)) and then do another FFlag(0)', 1);
          Wait(4000 + Random(1000));
          FFlag(0);
        end;

        if(FindColor(bx, by, QuestColor, MMCX, MMY1, MMX2, MMY2))then
        begin
          DebugMe('Found QuestColor - clicking Quest symbol', 1);
          MouseFindNoFlag(bx, by, 3, 3)
        end else
        begin
          WriteLn('Didn''t find QuestColor - setting player: false');
          Players[CurrentPlayer].Active := False;
          LogOut;
        end;

        if(RoadColor = 0)then
        begin
          DebugMe('RoadColor = 0, using FFlag(0)', 1);
          FFlag(0);
        end else
        begin
          DebugMe('RoadColor <> 0, using FFlag(10)', 1);
          FFlag(10);
        end;

        FindRoadColor;
        GotColor('Road');
        for Count := 0 to 2 do
        begin
          SLWaterWalk(150, 80, 60, 10, 0, 0, 4, 4);
          DebugMe('Walking the road - '+IntToStr(Count + 1)+'th time', 1);
          FindRoadColor;
          if(BankColor = 0)then
          begin
            DebugMe('BankColor = 0, trying to find BankSymbol', 1);
            BankColor := SLGetSymbol(ax, ay, 'bank');
            if(BankColor <> 0)then
            begin
              DebugMe('Found BankSymbol', 1);
              Break;
            end;
          end else
          begin
            DebugMe('BankColor <> 0, trying to find BankColor', 1);
            if FindColor(ax, ay, BankColor, MMX1, MMY1, MMX2, MMY2) then
            begin
              DebugMe('Found BankSymbol', 1);
              Break;
            end;
          end;
        end;

        if(BankColor <> 0)then
        begin
          DebugMe('BankColor <> 0, trying to find Bank using BankColor', 1);
          if(FindColor(ax, ay, BankColor, MMX1, MMY1, MMX2, MMY2))then
          begin
            DebugMe('Found BankColor on MM, walking to bank', 1);
            MouseFindNoFlag(ax, ay, 5, 5);
            FFlag(0);
          end else
          begin
            WriteLn('Didn''t find BankColor on MM, setting active: false');
            Players[CurrentPlayer].Active := False;
            LogOut;
          end;
        end else
        if(LadderColor <> 0)then
        begin
          DebugMe('BankColor = 0 and LadderColor <> 0 trying to find bank with LadderColor', 1);
          if(FindColor(ax, ay, LadderColor, MMX1, MMY1, MMX2, MMY2))then
          begin
            DebugMe('Found LadderColor - clicking LadderColor (ax + 20), (ay + 40), 5, 5', 1);
            MouseFindNoFlag(ax + 20, ay + 40, 5, 5);
            FFlag(0);
          end;
        end else
        begin
          WriteLn('Sorry we couldn''t find Ladder or BankColor - terminating');
          LogOut;
          Exit;
        end;

        ChangeLoc('bank');
        MouseSpeed := gMouseSpeed + Random(5);
      end;
    end;

    //******_AxeHead procedures_******\\
    //------------------------------------------------------------------------\\
    {               FindBestAxe - Gets best axe in the bank                   ||
    \\------------------------------------------------------------------------//}


    function FindBestAxe(var fx, fy: Integer; InBank: Boolean): Boolean;
    var
      I, x1, y1, x2, y2 : Integer;
    begin
      if LoggedIn then
      begin
        for I := 1 to 6 do
        begin
          if(InBank)then
          begin
            x1 := MSX1; y1 := MSY1; x2 := MSX2; y2 := MSY2;
          end else
          begin
            x1 := MIX1; y1 := MIY1; x2 := MIX2; y2 := MIY2;
          end;
          if(FindDtm(dtmAxes[I], fx, fy, x1, y1, x2, y2))then
          begin
            Result := True;
            Break;
          end;
        end;
        if not(Result)then
          PlayerLost('We don''t have an axe - FindBestAxe');
      end;
    end;

    //------------------------------------------------------------------------\\
    {               SLFindAxeHeadColor - Finds axe at the player              ||
    \\------------------------------------------------------------------------//}


    function SLFindAxeHeadColor: Boolean;
    var
      InvAxe, WieldAxe, Ix, Iy: integer;
    begin
      if LoggedIn then
      begin
        GameTab(4);
        for InvAxe := 1 to 7 do
        begin
          if(InvAxe = 7)then Break;
          if(FindDtm(dtmAxes[InvAxe], Ix, Iy, MIX1, MIY1, MIX2, MIY2))then
           Break;
        end;
        GameTab(5);
        for WieldAxe := 1 to 7 do
        begin
          if(WieldAxe = 7)then Break;
          if(FindDtm(dtmAxes[WieldAxe], x, y, MIX1, MIY1, MIX2, MIY2))then
            Break;
        end;

        if(InvAxe = 7)and(WieldAxe = 7)then
        begin
          Result := False;
          Exit;
        end;
        if((InvAxe-WieldAxe) < 0)then
          EquipAxe := False
        else
          EquipAxe := True;
        Result := true;
        if(EquipAxe)then
        begin
          GameTab(5);
          Wait(1000 + Random(500));
          HeadColor[0] := GetColor(597, 294);
          HeadColor[1] := GetColor(600, 295);
          HeadColor[2] := GetColor(599, 298);
        end else
        begin
          GameTab(4);
          if FindBestAxe(ix, iy, False) then
            Mouse(ix, iy, 3, 3, True);
          Wait(2000 + Random(1000));
          if(InChat('You need'))then
            PlayerLost('Noob alert - you do not have the required att to wield axe');
          GameTab(5);
          HeadColor[0] := GetColor(597, 294);
          HeadColor[1] := GetColor(600, 295);
          HeadColor[2] := GetColor(599, 298);
        end;
        WriteLn('Axe head colors: ' + IntToStr(HeadColor[0]) + ' ' + IntToStr(HeadColor[1]) + ' ' +
                IntToStr(HeadColor[1]));
      end;
    end;

    //------------------------------------------------------------------------\\
    {          AttachHead2 - Attaches found head, needed modifying.           ||
    \\------------------------------------------------------------------------//}


    function AttachHead2: Boolean;
    var
      AxeHandleDTM, AxeHeadDTM, ax, ay: Integer;
      Reequip: Boolean;
    begin
      AxeHandleDTM := DTMFromString('78DA637465626078C48002CA2379191E02694' +
        '620FE0F048C0E40352F19D000231209A4ED806A3E1150E30454F3' +
        '86801A2FA09AEB04D47800D5DC23A0C616A8E61D01358E4035EF0' +
        '9A80185CF03FC6A00E1CD105C');
      AxeHeadDTM := DTMFromString('78DA63CC62626078C180021C2312191E02694' +
        '620FE0F048C694035CF18D000231209A473816A9E12A1E6150135' +
        'A94035AF09A801B9F9090135994498930C54F392809A3CCCF0415' +
        '70300FB8311DF');

      WriteLn('Attaching head');
      if not(LoggedIn)then
        Exit;
      if EquipAxe then
      begin
        GameTab(5);
        Wait(200 + Random(200));
        Mouse(592, 297, 2, 2, True);
        Wait(2000 + Random(800));
        Reequip := True;
      end;
      GameTab(4);
      if (FindDTM(AxeHeadDTM, x, y, MIX1, MIY1, MIX2, MIY2)) and
         (FindDTM(AxeHandleDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
      begin
        if (FindDTM(AxeHeadDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
        begin
          Mouse(x, y, 3, 3, True);
          Wait(600 + Random(400));
        end;
        if (FindDTM(AxeHandleDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
        begin
          Mouse(x, y, 3, 3, True);
          Wait(500 + Random(200));
          AxeAttaches := AxeAttaches + 1;
          Result := True;
          WriteLn('Attached Axe Head!');
          GameTab(4);
          MakeCompass('N');
        end;
        if ReEquip then
        begin
          Wait(1000 + Random(1000));
          if FindBestAxe(ax, ay, False) then
            Mouse(ax, ay, 3, 3, True);
          Wait(500 + Random(500));
        end;
      end;
      FreeDTM(AxeHandleDTM);
      FreeDTM(AxeHeadDTM);
    end;

    //------------------------------------------------------------------------\\
    {           SLFindHead - Finds the AxeHead if not on the handle           ||
    \\------------------------------------------------------------------------//}


    function SLFindHead: Boolean;
    var
      AxeHeadDTM, Tries, ax, ay, ChatText: Integer;
      a, c: Extended;
    begin
      if LoggedIn then
      begin
        Result := True;

        ChatText := CreateBitmapMaskFromText('ou do not have an axe', SmallChars);
        if FindBitmapMaskTolerance(ChatText, x, y, 17, 399, 188, 440, 10, 85) then
        begin
          AxeHeadDTM := DTMFromString('78DA63CC62626078C180021C2312191E02694' +
        '620FE0F048C694035CF18D000231209A473816A9E12A1E6150135' +
        'A94035AF09A801B9F9090135994498930C54F392809A3CCCF0415' +
        '70300FB8311DF');

          Result := False;
          Tries := 0;
          a := 1.0;
          repeat
            if not LoggedIn then Exit;
            GameTab(4);
            if (FindDTM(AxeHeadDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
              Break;

            a := a + 1;
            c := Trunc(a div 2.0) * 1.0;
            if(c = a div 2.0)then
            begin
              if(FindObjMulti('ake', HeadColor[0], HeadColor[1], HeadColor[2], 5))then
              begin
                WriteLn('Axe head found - picking it up');
                Wait(450 + Random(400));
                GetMousePos(ax, ay);
                Mouse(ax, ay, 0, 0, False);
                Popup('ake');
                FFlag(0);
                Wait(1000 + Random(500));
              end else
              begin
                Tries := Tries + 1;
                WriteLn('Axe head was not found. Taken ' + IntToStr(Tries) + ' tries');
                KeyDown(VK_LEFT);
                Wait(1000 + Random(400));
                KeyUp(VK_LEFT);
                Wait(300 + Random(150));
              end;
            end else
            begin
              WriteLn('Axe head wasn''t found - Moving to a Red dot');
              ax := MMCX;
              ay := MMCY;
              if(FindColorSpiral(ax, ay, 241, MMCX + 3, MMY1, MMX2, MMY2))or
                (FindColorSpiral(ax, ay, 241, MMX1, MMY1, MMCX - 3, MMY2))or
                (FindColorSpiral(ax, ay, 241, MMX1, MMCY + 3, MMX2, MMY2))or
                (FindColorSpiral(ax, ay, 241, MMX1, MMY1, MMX2, MMCY - 3))then
                MouseFindNoFlag(ax + 3, ay + 3, 2, 2);
              FFlag(0);
              Wait(500 + Random(500));
            end;
          until(Tries > 5)or
          (FindDTM(AxeHeadDTM, ax, ay, MIX1, MIY1, MIX2, MIY2));

          if AttachHead2 then
            Result := True;

          Wait(500);
          if(InChat('You need'))then
            PlayerLost('Noob alert - not high enough att level to wear axe');

          RelocateAtWillows;
        end;

        gBrokenAxe := (not Result);

        if(AxeHeadDTM <> 0)then
          FreeDTM(AxeHeadDTM);
        FreeBitmap(ChatText);
      end;
    end;

    //******_Bank procedures_******\\
    //------------------------------------------------------------------------\\
    {                        SLOpenBank - Opents the bank                     ||
    \\------------------------------------------------------------------------//}


    function SLOpenBank: Boolean;
    var
      BankTime, I: Integer;
      arBankColor, arBankColorResults: TPointArray;
    begin
      if LoggedIn then
      begin
        MarkTime(BankTime);
        while(not(BankScreen))and(TimeFromMark(BankTime) < 20000)do
        begin
          arBankColor := FindColorsArray(541273, 0, 2, 10);
          if(GetArrayLength(arBankColor) = 0)then
            Break;
          arBankColorResults := getArrayFromBox(arBankColor, 40, 40);
          for I := 1 to GetArrayLength(arBankColorResults)-1 do
          begin
            if not(LoggedIn)then Exit;
            FFlag(0);
            Wait(100 + Random(100));
            MMouse(arBankColorResults[I].x, arBankColorResults[I].y, 5, 5);
            if(IsUpTextMulti('se Ban', 'ank b', 'booth'))then
            begin
              GetMousePos(x, y);
              Mouse(x, y, 2, 2, false);
              Wait(100+Random(100));
              ChooseOption(x, y, 'uickly');
            end;
            if(PinScreen)then
              if not(InPin(PinNumber))then
                Writeln('Player lost.');
            if(BankScreen)or(TimeFromMark(BankTime) > 20000)then
              Break;
          end;
        end;
        FFlag(0);
        Wait(4000 + Random(500));
        Result := BankScreen;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                    SLBank - Main banking procedure                      ||
    \\------------------------------------------------------------------------//}


    procedure SLBank(WithdrawAxe: Boolean);
    var
      dtmLogs, ax, ay: Integer;
    begin
      if LoggedIn then
      begin
        if(BankCount = 3)then
          PlayerLost('We failed the bank');

        if(WithdrawAxe)then
        begin
          if(InvCount = 28)then
          begin
            dtmLogs := DTMFromString('78DA637CC3C0C0308B010538588AC3D9FF818' +
              '0F13590B184010D30229140FA2790984F40CD57203109BF1A001E' +
              '6D0ACB');
            if(FindDtm(dtmLogs, x, y, MIX1, MIY1, MIX2, MIY2))then
            begin
              Mouse(x, y, 5, 5, false);
              ChooseOption(x, y, 'rop');
            end;
            FreeDtm(dtmLogs);
          end;
          GameTab(5);
          Mouse(591, 304, 10, 10, true);
          GameTab(4);
        end;
        SLOpenBank;
        if(not BankScreen)then
        begin
          Writeln('Failed to open the bank.');
          ax := MMCX; ay := MMCY;
          if FindColorSpiral2(ax, ay, RoadColor, MMX1, MMY1, MMX2, MMY2) then
            MouseFindNoFlag(ax, ay, 3, 3);
          FFlag(0);
          BankCount := BankCount + 1;
          SLBank(WithdrawAxe);
        end else
          BankCount := 0;
        FixBank;
        if(InvCount = 28)then
          Loads := Loads + 1;
        LogsChopped := LogsChopped + CountItemBmpMaskTol(LogMask, 5, 5);
        ReportVars[0] := ReportVars[0] + CountItemBmpMaskTol(LogMask, 5, 5);
        DepositAll;
        if(InvCount > 0)then
          DepositAll;
        if(WithDrawAxe)then
        begin
          if(FindBestAxe(x, y, True))then
          begin
            Mouse(x, y, 5, 5, true);
            Wait(200+Random(300));
          end;
        end;
        CloseBank;
        Wait(200+Random(200));
        if(BankScreen)then
          CloseBank;
        if(WithDrawAxe)then
        begin
          ClickItemColorTol(876930, 10, true);
          Wait(400 + Random(400));
          if(not SLFindAxeHeadColor)then
            PlayerLost('You don''t have an axe');
        end;
        gBrokenAxe := false;
      end;
      ProgressReport;
    end;

    //******_Chopping procedures_******\\
    //------------------------------------------------------------------------\\
    {                   SLFindEnt - Finds the evil ent !                      ||
    \\------------------------------------------------------------------------//}


    function SLFindEnt(var ax, ay: Integer; tColor: Integer): Boolean;
    var
      TempMouseSpeed, mx, my, Count: integer;
    begin
      GetMousePos(mx, my);
      if(ax < 5)then
        ax := 5;
      if(ay < 5)then
        ay := 5;
      if(mx < ax + 5)and(mx > ax - 5)and(my < ay + 5)and(my > ay - 5)then
      else
        if(FindColorSpiralTolerance(ax, ay, tColor, ax - 5, ay - 5, ax + 5, ay + 5, 5))then
        begin
          MMouse(ax, ay, 2, 2);
          Wait(75 + Random(30));
        end;
      if(FindColorTolerance(ax, ay, 122333, 84, 1, 123, 15, 10))then
      begin
        for Count := 0 to 4 do
        begin
          Result := IsUpTextMulti('hop', 'own', 'down');
          if(Result)then
            Break;
          Wait(25);
        end;
        if(Result)then
        begin
          Writeln('Ent found!!! Waiting...');
          TempMouseSpeed := MouseSpeed;
          MouseSpeed := 2 + Random(2);
          Mouse(MMCX, MMCY, 2, 2, true);
          IdleTime(5000 + Random(10000), 500, 1.0);
          EntsAvoided := EntsAvoided + 1;
          MouseSpeed := TempMouseSpeed;
        end;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                ValidateTree - Is it the correct tree ?                  ||
    \\------------------------------------------------------------------------//}


    function ValidateTree(ax, ay: Integer): boolean;
    begin
      if(IsUpText('hop'))or(IsUpText('own'))then
      begin
        if IsUpTextMulti('ree', 'ak', 'ew') then
          Exit;
        if IsUpText('illow') then
          Result := True;
      end;
    end;

    //------------------------------------------------------------------------\\
    {        SLFindMiddleOfTree - Finds ... the middle of the tree            ||
    \\------------------------------------------------------------------------//}


    function SLFindMiddleOfTree(var ax, ay: Integer; tColor: Integer): Boolean;
    var
      Count, x1, y1, x2, y2, bCount, aCount: Integer;
      arLuminance: array[0..1] of Extended;
      Hue, Saturation: Extended;
    begin
      if(ax < 10)then
        ax := 10;
      if(ay < 10)then
        ay := 10;
      if(FindColorSpiralTolerance(ax, ay, tColor, ax - 10, ay - 10, ax + 10, ay + 10, 5))and
        (LoggedIn)then
      begin
        for bCount := 0 to 3 do
        begin
          ColorToHSL(GetColor(ax, ay), Hue, Saturation, arLuminance[1]);
          Count := 0;
          if(bCount = 2)then
            ax := (x2 + x1) div 2;
          repeat
            arLuminance[0] := arLuminance[1];
            case bCount of
              0: ColorToHSL(GetColor(ax - Count, ay), Hue, Saturation, arLuminance[1]);
              1: ColorToHSL(GetColor(ax + Count, ay), Hue, Saturation, arLuminance[1]);
              2: ColorToHSL(GetColor(ax, ay - Count), Hue, Saturation, arLuminance[1]);
              3: ColorToHSL(GetColor(ax, ay + Count), Hue, Saturation, arLuminance[1]);
            end;

            if(Hue > 14)and(Hue < 34)then
            begin
              if(arLuminance[0] < arLuminance[1] - 1.5)or
                (arLuminance[0] > arLuminance[1] + 1.5)then
                aCount := 0
              else
                aCount := aCount + 1;
            end else
              aCount := aCount + 1;

            if(aCount = 3)then
            begin
              case bCount of
                0: x1 := ax - Count + 3;
                1: x2 := ax + Count - 3;
                2: y1 := ay - Count + 3;
                3: y2 := ay + Count - 3;
              end;
            end;
            Count := Count + 1;
          until(Count = 60)or(aCount = 3);
          if(Count = 60)then
          begin
            case bCount of
              0: x1 := ax - Count;
              1: x2 := ax + Count;
              2: y1 := ay - Count;
              3: y2 := ay + Count;
            end;
          end;
        end;

        ay := (y2 + y1) div 2;
        if((x2 - x1) * (y2 - y1) >= MinWCount * MinHCount)then
          Result := True;
      end;
    end;

    //------------------------------------------------------------------------\\
    {               FindTree2 - Finds the tree in the screen                  ||
    \\------------------------------------------------------------------------//}


    function FindTree2(var gx, gy: Integer): Boolean;
    var
      tColors: array[0..8]of Integer;
      xCount, yCount, cCount, zCount, tCount, tColor, FoundCount, HighEnoughLuminanceChangeCount, ABigEnoughTreeCount, NotValidNameCount: Integer;
      Luminance: array[0..8]of Extended;
      Saturation, Hue: Extended;
      x1, y1, x2, y2, a, c, i, tx, ty: Integer;
    begin
      x1 := 245;
      y1 := 165;
      x2 := 277;
      y2 := 185;
      repeat
        if(not LoggedIn)then
          Break;
        a := a + 1;
        if (a = 1) then
          c := c + 1;
        if (a = 3) then
          c := c + 1;
        for i := 1 to c do
        begin
          if (a = 1) then
          begin
            x1 := x1 + 60;
            x2 := x2 + 60;
          end;
          if (a = 2) then
          begin
            y1 := y1 - 40;
            y2 := y2 - 40;
          end;
          if (a = 3) then
          begin
            x1 := x1 - 60;
            x2 := x2 - 60;
          end;
          if (a = 4) then
          begin
            y1 := y1 + 40;
            y2 := y2 + 40;
          end;
          if (x1 = 485) and (x2 = 517) then
            x2 := x2 - 2;
          if (y1 = 325) and (y2 = 345) then
            y2 := y2 - 7;
          if (x2 > 515) then
            Break;
          zCount := 0;
          tx := x2 - x1;
          ty := y2 - y1;
          if(FindColorSpiralTolerance(tx, ty, MSTreeColor, x1, y1, x2, y2, 10))then
          begin
            FoundCount := FoundCount + 1;
            for xCount := 0 to 2 do
              for yCount := 0 to 2 do
                tColors[yCount + xCount * 3] := GetColor(tx - 1 + xCount, ty - 1 + yCount);
            for xCount := 0 to 2 do
            begin
              for yCount := 0 to 2 do
              begin
                cCount := yCount + xCount * 3;
                ColorToHSL(tColors[cCount], Hue, Saturation, Luminance[cCount]);
                if(cCount > 0)then
                begin
                  if(Hue > MinHue)and(Hue < MaxHue)then
                  begin
                    if(cCount = 3)or(cCount = 6)then
                      tCount := cCount - 2
                    else
                      tCount := cCount;
                    if(Luminance[cCount] > Luminance[tCount - 1] + 2)or
                      (Luminance[cCount] < Luminance[tCount - 1] - 2)then
                    zCount := zCount + 1;
                  end;
                end;
              end;
            end;
            if(zCount >= MinzCount)then
            begin
              HighEnoughLuminanceChangeCount := HighEnoughLuminanceChangeCount + 1;
              tColor := GetColor(tx, ty);
              if SLFindMiddleOfTree(tx, ty, tColor) then
              begin
                ABigEnoughTreeCount := ABigEnoughTreeCount + 1;
                MMouse(tx, ty, 3, 3);
                Wait(100 + Random(50));
                tColor := GetColor(tx, ty);
                Result := (ValidateTree(tx, ty))and(not SLFindEnt(tx, ty, tColor));
                if(not Result)then
                  NotValidNameCount := NotValidNameCount + 1;
                if(Result)then
                begin
                  DebugMe('Found: '+IntToStr(FoundCount)+', LuminanceOKS: '+IntToStr(HighEnoughLuminanceChangeCount)+', BigTrees: '+IntToStr(ABigEnoughTreeCount)+', NonValidNames: '+IntToStr(NotValidNameCount), 2);
                  gx := tx;
                  gy := ty;
                  Exit;
                end;
              end;
            end;
          end;
        end;
        if (a = 4) then
          a := 0;
      until (x2 > 515) or (Result);
    end;

    //------------------------------------------------------------------------\\
    {                  UpdateColor - Updates coords of the tree               ||
    \\------------------------------------------------------------------------//}


    function UpdateColor(var ax, ay: Integer; tColor: Integer): boolean;
    var
      Checker: Integer;
    begin
      Checker := GetSystemTime;
      if(ax < 20)then ax := 20; if(ay < 20)then ay := 20;
      while(FindColorSpiralTolerance(ax, ay, tColor, ax - 20, ay - 20, ax + 20, ay + 20, 5))and
           (TimeFromMark(Checker) < 10000)and
           (FlagPresent)do
      begin
        if(ax < 20)then ax := 20; if(ay < 20)then ay := 20;
        Wait(16);
      end;

      for Checker := 0 to 45 do
      begin
          if(not FindColorSpiralTolerance(ax, ay, tColor, ax - 10, ay - 10, ax + 10, ay + 10, 5))then
            Break;
          if(not SLFindHead)then
            Exit;
          Wait(16);
          if(ax < 10)then ax := 10; if(ay < 10)then ay := 10;
      end;

      if(ax < 10)then ax := 10; if(ay < 10)then ay := 10;
      Result := FindColorSpiralTolerance(ax, ay, tColor, ax - 10, ay - 10, ax + 10, ay + 10, 5);
      if(not Result)then
        DebugMe('We lost the color while updating it', 2);
    end;

    //------------------------------------------------------------------------\\
    {      GetEmptyItemPosition2 - Returns first empty inv slot               ||
    \\------------------------------------------------------------------------//}


    function GetEmptyItemPosition2: Integer;
    begin
      if not(LoggedIn)then
        Exit;
      GameTab(4);
      for Result := 1 to 29 do
      begin
        if(Result = 29)then
        begin
          Result := -1;
          Exit;
        end else
          if(not ExistsItem(Result))then
            Break;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                 CheckLeveled - Did we go op a lvl ?                     ||
    \\------------------------------------------------------------------------//}


    function CheckLeveled: Boolean;
    var
      ax, ay: Integer;
    begin
      if(FindColorTolerance(ax, ay, 3303512, 57 - 5, 385 - 5, 57 + 5, 385 + 5, 15))and
        (FindColorTolerance(ax, ay, 16711680, 254 - 5, 441 - 5, 254 + 5, 441 + 5, 15))then
      begin
        Result := True;
        ClickToContinue;
      end;
    end;

    //------------------------------------------------------------------------\\
    {             WaitWhileWorking - Waits while chopping                     ||
    \\------------------------------------------------------------------------//}


    procedure WaitWhileWorking(ax, ay, tempSpot, tColor: Integer);
    var
      CutMark, CutMarkTotal, CutMarkTemp: Integer;
    begin
      CutMark := GetSystemTime;
      CutMarkTotal := GetSystemTime;
      CutMarkTemp := GetSystemTime;
      while (LoggedIn) do
      begin
        if(ax < 10)then
          ax := 10;
        if(ay < 10)then
          ay := 10;
        if(not FindColorSpiralTolerance(ax, ay, tColor, ax - 10, ay - 10, ax + 10, ay + 10, 5))then
        begin
          DebugMe('We lost the color while waiting', 2);
          Exit;
        end;
        if(TimeFromMark(CutMarkTemp) > 5 * 1000)then
        begin
          if(not SLFindMiddleOfTree(ax, ay, tColor))then
          begin
            DebugMe('Lost actual tree', 2);
            Exit;
          end;
          CutMarkTemp := GetSystemTime;
        end;
        if(TimeFromMark(CutMarkTotal) < 5 * 1000)then
        begin
          if(not SLFindHead)then
          begin
            DebugMe('Axe fucked', 2);
            Exit;
          end;
        end;
        Wait(10);
        if SLFindEnt(ax, ay, tColor) then
        begin
          PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wav');
          DebugMe('We got an ent while waiting', 2);
          Exit;
        end;
        Wait(10);
        if CheckLeveled then
        begin
          PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wav');
          DebugMe('We got a level', 2);
          CutMark := GetSystemTime;
        end;
        Wait(10);
        if FindFastRandoms then
        begin
          DebugMe('Found a random while waiting', 2);
          PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wav');
          Exit;
        end;
        Wait(50);
        if(TimeFromMark(CutMark) > MaxSecToWait * 1000)then
        begin
          DebugMe('No logs for '+IntToStr(MaxSecToWait)+' secs ', 2);
          Exit;
        end;
        if(TimeFromMark(CutMarkTotal) > 60 * 1000)then
        begin
          DebugMe('1 minute at the same tree, preventing logout', 1);
          Exit;
        end;
        if(FindFight)then
        begin
          PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wav');
          RunTo(RunDir, True);
          DebugMe('We got into a fight', 2);
          Exit;
        end;
        Wait(10);
        if ExistsItem(tempSpot) then
        begin
          CutMark := GetSystemTime;
          tempSpot := GetEmptyItemPosition2;
          if(tempSpot = -1)then
            Exit;
        end;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                   ChopTree - Main chopping procedure                    ||
    \\------------------------------------------------------------------------//}


    procedure ChopTree;
    var
     ax, ay, tempSpot, tColor: Integer;
    begin
      if LoggedIn then
      begin
        if FindTree2(ax, ay) then
        begin
          gWillowFailSafes := GetSystemTime;
          tColor := GetColor(ax, ay);
          if SLFindEnt(ax, ay, tColor) then
            Exit;
          if(Random(20) < 19)then
            Mouse(ax, ay, 3, 3, True)
          else
          begin
            Mouse(ax, ay, 3, 3, False);
            ChooseOption(ax, ay, 'own');
          end;
          if UpdateColor(ax, ay, tColor) then
          begin

            tempSpot := GetEmptyItemPosition2;
            if(tempSpot = -1)then
              Exit;
            if SLFindMiddleOfTree(ax, ay, tColor) then
            begin
              tColor := GetColor(ax, ay);
              WaitWhileWorking(ax, ay, tempSpot, tColor);
              gWillowFailSafes := GetSystemTime;
            end;
          end;
        end;
      end;
    end;

    //******_Setup stuff_******\\
    //------------------------------------------------------------------------\\
    {               CapitalizeLikeRs - Capitalises like RS does.              ||
    \\------------------------------------------------------------------------//}


    function CapitalizeLikeRs(RawString: string): string;
    begin
      Result := Capitalize(LowerCase(RawString));
    end;

    //------------------------------------------------------------------------\\
    {                    CheckNicks - Checks the set nick names.              ||
    \\------------------------------------------------------------------------//}


    procedure CheckNicks;
    var
      CorrectString: string;
      i: integer;
    begin
      for i := 0 to HowManyPlayers - 1 do
      begin
        if(Players[i].Nick <> LowerCase(Players[i].Nick))then
        begin
           mMemoBox.Lines.Add('--');
           mMemoBox.Lines.Add('ERROR : Please Uncapitalise your NickNames.');
           mMemoBox.Lines.Add('Error occured with player : ' + Players[i].Name);
           Exit;
        end;
        if(pos(' ', Players[i].Nick) > 0)then
        begin
           mMemoBox.Lines.Add('--');
           mMemoBox.Lines.Add('ERROR : Dont use spaces in your Nick.');
           mMemoBox.Lines.Add('Error occured with player : ' + Players[i].Name);
           Exit;
        end;
        CorrectString := CapitalizeLikeRs(Players[i].Name);
        if not(Pos(LowerCase(Players[i].Nick), CorrectString) > 0)then
        begin
          mMemoBox.Lines.Add('--');
          mMemoBox.Lines.Add('ERROR : Nick does NOT match the name.');
          mMemoBox.Lines.Add('Nick : ' + Players[i].Nick + ', does NOT match ' + Players[i].Name);
          mMemoBox.Lines.Add('Nick should be 3-4 letters of ' + Players[i].Name);
          mMemoBox.Lines.Add('No capitalised letters though, be carefull!');
          Break;
        end;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                Signature - To prove its ours, muhaha.                   ||
    \\------------------------------------------------------------------------//}


    procedure Signature;
    begin
      ChangeReportWidth(220);
      Writeln('  ______ __                     __       _');
      Writeln(' /  ___/|  |   _____ __________|__|_____/ |_  _____');
      Writeln(' \__  \ |  |  / ___// ___\_ __ \  \___ \  __\/  __/');
      Writeln(' /     \|  |__\__  \  \___| | \/  | |_> > |  \__  \');
      Writeln('/____  /|_____/__  >\___  >_|  |__|  __/|_| /___  /');
      Writeln('     \/          \/     \/         |_|          \/');
      Writeln('   Bring you :');
      Writeln('             Port Sarim Willow Whacker');
    end;

    //------------------------------------------------------------------------\\
    {             TimeToSwitchPlayers - Time to switch the players ?          ||
    \\------------------------------------------------------------------------//}


    function TimeToSwitchPlayers: boolean;
    begin
      if(TimeFromMark(gPlayerTime) > MaxLoginTime * 1000 * 60 + gRanTime)then
      begin
        Result := True;
        WriteLn('Time is up');
      end;
    end;

    //------------------------------------------------------------------------\\
    {           SetupClient - Prepares the client for the script               ||
    \\------------------------------------------------------------------------//}


    procedure SetupClient;
    begin
      SetupSRL;
      ScriptID := '60';
      LoadChatArray;
      LoadBMPs;
      LoadDTMs;
      ClearDebug;
      ClearReport;
      ShowNormalForm;
      Wait(1000 + Random(500));
      if(UsePlayerForm)then
      begin
        StartPlayers(false, 'string1');
      end else
        DeclarePlayers;
      for x := 0 to HowManyPlayers - 1 do
        Players[x].String2 := 'bank';
      CurrentPlayer := StartPlayer;
      BenMouse := False;
      ActivateClient;
      Wait(1000);
    end;

    //------------------------------------------------------------------------\\
    {                SetupUser - Sets the current player ready                ||
    \\------------------------------------------------------------------------//}


    procedure SetupUser;
    begin
      gWillowFailSafes := GetSystemTime;
      PinNumber := Players[CurrentPlayer].String1;
      MouseSpeed := gMouseSpeed + Random(5);
      LoginPlayer;
      repeat
        Wait(100);
      until(not IsLoading);
      Wait(3000 + Random(1000));
      Players[CurrentPlayer].Level[20] := GetSkillLevel('woodcutting');
      WriteLn('Current woodcutting lvl: ' + IntToStr(Players[CurrentPlayer].Level[20]));
      if(not SLFindAxeHeadColor)then
      begin
        SLBank(true);
        if (not SLFindAxeHeadColor) then
          PlayerLost('We didn''t have an axe');
      end;
      HighestAngle;
      SetChat('on', 1);
      SetChat('friends', 2);
      SetChat('on', 3);
      WaterSymbolColor := GetSymbolColor(x, y, 'water');
      if(not WaterSymbolColor = 0)then
        WriteLn('WaterSymbolColor = ' + IntToStr(WaterSymbolColor))
      else
      begin
        WaterSymbolColor := 14772023;
        WriteLn('Couldn''t find watersymbolcolor - setting from default');
      end;
      MarkTime(gPlayerTime);
      SetRun(false);
      LadderColor := 0;
      FarmingColor := 0;
      QuestColor := 0;
      RoadColor := 0;
      BankColor := 0;
    end;

    //******_Main Loop_******\\
    //------------------------------------------------------------------------\\
    {                          Main line - Its magic.                         ||
    \\------------------------------------------------------------------------//}


    begin
      SetupClient;
      repeat
        SetupUser;
        repeat
          LadderColor := MMLadder;
          ActivateClient;

          if(Players[CurrentPlayer].String2 = 'bank')and
          (LoggedIn)then
          begin
            if(InvCount = 0)and
              (not gBrokenAxe)then
            else
              SLBank(gBrokenAxe);
            BankToWillows;
            gWillowFailSafes := GetSystemTime;
          end;

          if(Players[CurrentPlayer].String2 = 'willows')and
          (LoggedIn)then
          begin
            repeat
              MakeCompass('E');
              Wait(16);
              ChopTree;
              Wait(16);
              FindFastRandoms;
              Wait(16);
              FindBirdsNest;
              Wait(16);
              if(FindFight)then
                RunTo(RunDir, True);
              Wait(16);
              if FindNewBox then
                SolveBox;
              if(1 * 30 * 1000 < GetSystemTime - gWillowFailSafes)then
              begin
                WriteLn('Relocating');
                RelocateAtWillows;
              end;
              if(1 * 60 * 1000 < GetSystemTime - gWillowFailSafes)then
              begin
                WriteLn('We didn''t find any willows');
                LogOut;
                Break;
              end;
              until(TimeToSwitchPlayers)or(InvCount = 28)or
                   (not LoggedIn)or(gBrokenAxe);
              WillowsToBank;
          end;

        until(TimeToSwitchPlayers)or(not LoggedIn);

        PlayerStatus := LoggedIn;
        LogOut;
        NextPlayer(PlayerStatus);
      until(false);
    end.

  11. #11
    Join Date
    Jan 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    P 0 O N age, i get the same exact errors you get with everything. I have found about 3 WC scripts ( not mine ) that will work for me and you until someone fixs this.

  12. #12
    Join Date
    Jul 2007
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I got the same errors to anyways
    But if i download 2.03 from OFFFICIAL SITE!
    I got a trojan =/

  13. #13
    Join Date
    Jun 2007
    Location
    England
    Posts
    262
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, I fixed the script for you.

    SCAR Code:
    {=========================================================================]
    [                      Port Sarim Willow Whacker                          ]
    [                                                                         ]
    [           NAME        : Port Sarim Willow Whacker                       ]
    [           WRITER      : Lorax + Sumilion                                ]
    [           CATEGORY    : Woodcutter                                      ]
    [           DESCRIPTION : Chops willows in PS and banks them              ]
    [           USAGE       : Start at the willows / in the bank              ]
    [           AUTOCOLOR   : Yes                                             ]
    [                                                                         ]
    [                   More Scripts can be found at                          ]
    [                       <a href="http://www.Villu-Reborn.com" target="_blank">www.Villu-Reborn.com</a>                              ]
    [=========================================================================]
    [                           Instructions.                                 ]
    [=========================================================================]
    [ 1. USE Runescape with Low Detail, Very Bright.                          ]
    [ 2. Set your Screen to 32 bit TRUE color.                                ]
    [ 3. Set Playernames and Passwords in the form (comes when started).      ]
    [ 4. Start script Logged Out / Logged in                                  ]
    [ 5. Set Colors or Leave at Zero to autopick                              ]
    [ 6. Have Axe in First inventoryslot or wielded and more in the bank      ]
    [ 7. Setup lines below                                                    ]
    [=========================================================================]
    [ Credits to :                                                            ]
    [  WT-Fakawi   --> For SRL and the SRL Community + FindFastRandoms ^^     ]
    [  StarBlaster100 --> For helping with all sorts of stuff                 ]
    [=========================================================================}

    program SLPSWW;
    {.include SRL/SRL.scar}
    {.include SRL/SRL/misc/Loading.scar}
    {.include SRL/SRL/misc/Trade.scar}
    {.include SRL/SRL/skill/WoodCutting.scar}

    //***********_Setup these_**********\\
    const
      PartOfRCName   = ''; // Your .Nick for your Remote Controll man
      UsePlayerForm  = True;  // If false, then DeclarePlayers(below) is used.

    //***********_Setup if wanted.._**********\\
    const
      MaxSecToWait   = 15;      // Will check for wc axe every x sec
      MaxLoginTime   = 25;      // Per playerturn - in minuts
      RanLoginTime   = 3;       // + x mins random time
      StartPlayer    = 0;       // Player to start with
      MinzCount      = 6;       // If it fails to find trees - lower this.
      MinWCount      = 20;      // Lower if it fails to find trees
      MinHCount      = 20;      // Lower this together with MinWCount

    //***********_No need to setup these_**********\\
    const
      DebugStyle     = 'Write'; // Write / Disguise / Status / None.
      DebugLevel     = 1;       // None: 0, Walking: 1, Tree finding: 2
      RunDir         = 'W';     // Changing wouldn't be necessary..
      RunFar         = True;    // Same here
      gMouseSpeed    = 20;      // Adds a random of 5
      MMLadder       = 1062250; // Autocolor doesnt work all to well...
      MSTreeColor    = 4350048; // Currently you don't need to change this

    //***********_Don't change_**********\\
    const
      VersionNumber  = '0.97';
      MinHue = 10;
      MaxHue = 34;
      MaxFenceCount = 7;

    //------------------------------------------------------------------------\\
    {                 DeclarePlayers - Sets Player array.                      ||
    \\------------------------------------------------------------------------//}


    procedure DeclarePlayers;
    begin
         HowManyPlayers := 6;
         CurrentPlayer := StartPlayer;
         NumberOfPlayers(HowManyPlayers); // set arraylength

         Players[0].Name :='Username';
         Players[0].Pass :='Password';
         Players[0].Nick :='sern';
         Players[0].Active:= True;
         Players[0].String1 := '0000';//PinNumber

         Players[1].Name :='Username';
         Players[1].Pass :='Password';
         Players[1].Nick :='sern';
         Players[1].Active:= True;
         Players[1].String1 := '0000';

         Players[2].Name :='Username';
         Players[2].Pass :='Password';
         Players[2].Nick :='sern';
         Players[2].Active:= True;
         Players[2].String1 := '0000';

         Players[3].Name :='Username';
         Players[3].Pass :='Password';
         Players[3].Nick :='sern';
         Players[3].Active:= True;
         Players[3].String1 := '0000';

         Players[4].Name :='Username';
         Players[4].Pass :='Password';
         Players[4].Nick :='sern';
         Players[4].Active:= True;
         Players[4].String1 := '0000';

         Players[5].Name :='Username';
         Players[5].Pass :='Password';
         Players[5].Nick :='sern';
         Players[5].Active:= True;
         Players[5].String1 := '0000';
    end;

    type
      RespondType = record
        Question: array of string;
        Answer: Integer;
      end;

    { FORM variables }

    var
      SLPSWWForm : TForm;
      mMemoBox : TMemo;
      bNews : TButton;
      bVersionCheck : TButton;
      bSetupUsers : TButton;
      bReportBug : TButton;
      bStartScript : TButton;
      bBestReport : TButton;

    { SCRIPT variables }

    var
      LadderColor, FarmingColor, QuestColor, WaterSymbolColor, BarColor, BankCount: Integer;
      LogMask, LogsChopped, Loads, gPlayerTime, gRanTime, gWillowFailSafes, WalkTries: Integer;
      dtmAxes: array[0..6] of Integer;
      gBrokenAxe, PlayerStatus: Boolean;
      PinNumber: string;

    { AUTO CHATTER variables }
    var
      OldChatText, NewChatText, OldChatter, NewChatter: string;
      arChatLines: array of RespondType;


    //******_Small usefull stuff_******\\
    //------------------------------------------------------------------------\\
    {                         DebugMe - Outputs Debug info                    ||
    \\------------------------------------------------------------------------//}


    procedure DebugMe(aString: string; Importance: Integer);
    begin
      if(DebugLevel >= Importance)then
      begin
        case LowerCase(DebugStyle) of
          'write' : WriteLn(astring);
          'disguise' : DisguiseScar(astring);
          'status' : Status(astring);
        end;
      end;
    end;

    //------------------------------------------------------------------------\\
    {              ChangeLoc - Changes the Loc of the player                   ||
    \\------------------------------------------------------------------------//}


    procedure ChangeLoc(aString: string);
    begin
      Players[CurrentPlayer].String2 := LowerCase(aString);
      WriteLn('We are at ' + aString);
    end;

    //------------------------------------------------------------------------\\
    {                PlayerLost - Logs out player when lost                   ||
    \\------------------------------------------------------------------------//}


    procedure PlayerLost(Info:string);
    begin
      Writeln('Player Lost, '+ Info);
      Logout;
    end;

    //------------------------------------------------------------------------\\
    {             ProgressReport - Prints the progressreport                  ||
    \\------------------------------------------------------------------------//}


    procedure ProgressReport;//Made by Fakawi, i think, edited by Sumilion
    var
      PActive, Spaces: string;
      i, K, MaxSpace, SpaceNumber: Integer;
    begin
      SRLRandomsReport;
      If Players[CurrentPlayer].Active then PActive:='True' else PActive:='False';
      Writeln(' ');
      Writeln('//=============== SL PSWW ================\\');
      Writeln('\\======== -'+VersionNumber+'- Progress Report ========//');
      Writeln('/==========================================\');
      Writeln('|      Worked for '+ TimeRunning);
      Writeln('|      Chopped '+ IntToStr(LogsChopped)+(' logs.'));
      Writeln('|      Banked '+ IntToStr(Loads)+(' times.'));
      Writeln('\==========================================/');
      Writeln('    Name       : '+Players[CurrentPlayer].Name);
      Writeln('    Wcing Lvl  : '+IntToStr(Players[CurrentPlayer].Level[20]));
      Writeln('    Worked for : '+IntToStr(Players[CurrentPlayer].Worked)+' minutes.');
      Writeln('    Active     : '+PActive);
      Writeln('    Location   : '+Players[CurrentPlayer].Loc);
      Writeln('\\----------------------------------------//');
      for i := 0 to HowManyPlayers-1 do
        if(Length(Players[i].Name) > MaxSpace)then
          MaxSpace := Length(Players[i].Name);
      for i := 0 to HowManyPlayers-1 do
      begin
        SpaceNumber := MaxSpace - Length(Players[i].Name);
        for K := 0 to SpaceNumber do
          Spaces := Spaces + ' ';
        if Players[i].Active=True then PActive:='True' else PActive:='False';
        Writeln( (IntToStr(I))+': '+ Players[i].Name + Spaces+ '= '+PActive+
        ' , Wc lvl : '+IntToStr(Players[i].Level[20])+
        ' , Worked '+IntToStr(Players[i].Worked)+ ' minutes, '+
        'Loc: '+Players[i].Loc)
        Spaces := '';
      end;
      Writeln('\\========================================//');
      if(ScriptTime(3) > StrToIntDef(LoadSetting('PSWW', 'LongestTime'), 0))then
      begin
        Writeln('Saved Proggie!');
        SaveSetting('PSWW', 'LongestTime', IntToStr(ScriptTime(3)));
        SaveSetting('PSWW', 'BestTime', TimeRunning);
        SaveSetting('PSWW', 'BestLogs', IntToStr(LogsChopped));
        SaveSetting('PSWW', 'BestBanks', IntToStr(Loads));
      end;
    end;

    //------------------------------------------------------------------------\\
    {             LoadBMPs - Loads LOTS of bmps in the memory ^^.             ||
    \\------------------------------------------------------------------------//}


    procedure LoadBMPs;
    begin
      LogMask := BitmapFromString(13, 10, 'z78DA33301805E40037BC8' +
           '0BAB6D0C2E5F451494998D02E5471010034299979');
    end;

    //------------------------------------------------------------------------\\
    {                LoadDTMs - Loads the DTMs in the memory.                 ||
    \\------------------------------------------------------------------------//}


    procedure LoadDTMs;
    begin
      dtmAxes[1] := DTMFromString('78DA633CC4C4C050CCC8800C1A13F91852803' +
         '448F43F10309E05AA294055631B18C5C0055503028CE7816A3251' +
         'D5384725A3AA3981A9C6333107450D00A4080D5C'); //rune
      dtmAxes[2] := DTMFromString('78DA63746162602865644006AD297C0C29401' +
         'A24FA1F0818FD816A0A50D5587B5B337041D580006320504D26AA' +
         '1AC7204754355E986ADCA33D51D40000E10C0AEF'); //addy
      dtmAxes[3] := DTMFromString('78DA633CC4C4C010C0C8800C5A53F81852803' +
         '448F43F10309E05AAF14155636111CCC0055503028CE7816A5C51' +
         'D5D839C4A2AA3981A9C6C52D0D450D0061FC0C64'); //mith
      dtmAxes[4] := DTMFromString('78DA63CC636260D8C3C8800C5A53F81852803' +
         '448F43F10305602D5EC4055939B9ACAC0055503028CD540351B51' +
         'D594E5E5A2AA29C154D3545989A20600C3BC0E32'); //steel
      dtmAxes[5] := DTMFromString('78DA639CC1C4C0309D9101193426F231A4006' +
         '990E87F20605C0C543305558DA78B0B0317540D08302E05AAE945' +
         '5513E4ED8DAA661EA69AA8E0601435008C000CFF'); //iron
      dtmAxes[6] := DTMFromString('78DA63CC636260D0666440068D897C0C29401' +
         'A24FA1F08182B816A3450D5B898C8317041D580006335508D22AA' +
         '1A5F6B65543525986A02ED5451D400009DDA09E3'); //bronze
    end;

    //------------------------------------------------------------------------\\
    {     BestProgressReport - Writes the best progress report made.          ||
    \\------------------------------------------------------------------------//}


    procedure BestProgressReport;
    begin
      if(LoadSetting('PSWW', 'BestTime') = '')then
      begin
        mMemoBox.Lines.Add('--');
        mMemoBox.Lines.Add('Currently unavailable.');
        Exit;
      end;
      mMemoBox.Lines.Add('--');
      mMemoBox.Lines.Add('//=========== SL PSWW   ===========\\');
      mMemoBox.Lines.Add('\\======  -Best- Progress Report ========//');
      mMemoBox.Lines.Add('/===============================\');
      mMemoBox.Lines.Add('|  Worked for '+ LoadSetting('PSWW', 'BestTime'));
      mMemoBox.Lines.Add('|  Chopped '+ LoadSetting('PSWW', 'BestLogs')+(' logs.'));
      mMemoBox.Lines.Add('|  Banked '+ LoadSetting('PSWW', 'BestBanks')+(' times.'));
      mMemoBox.Lines.Add('\===============================/');
    end;

    //------------------------------------------------------------------------\\
    {                      WriteNews - Writes the News.                       ||
    \\------------------------------------------------------------------------//}


    procedure WriteNews(HowMany: Integer);//Thnx to StarBlaster
    var
      Timer, i, x, y: Integer;
      News :array of string;
      New, TheNews: string;
    begin
      SetArrayLength(News, HowMany+1);
      Wait(1);
      TheNews := Getpage('http://sumilionscripts.freehostia.com/PSWWNews.txt');
      x := 0;
      mMemoBox.Lines.Add('--');
      mMemoBox.Lines.Add('//==============================\\');
      mMemoBox.Lines.Add('| >> PSWW News      (v' + VersionNumber + ')');
      mMemoBox.Lines.Add('|');
      y := 1;
      for i := 1 to HowMany do
      begin
        MarkTime(Timer);
        repeat
          x := x + 1;
          new := copy(TheNews, x, x+1);
          if(new = '|')then
          begin
            i := HowMany;
            Break;
          end;
        until(copy(new, 1, 1) = ',')or(TimeFromMark(Timer) >= 2000);
      news[i]:= copy(TheNews, y, (x-y));
      y := x + 1;
      mMemoBox.Lines.Add('|       --   '+news[i]);
      Wait(1);
      end;
      mMemoBox.Lines.Add('|');
      mMemoBox.Lines.Add('\\==============================//');
    end;

    //------------------------------------------------------------------------\\
    {             CheckVersion - Checks the current version.                  ||
    \\------------------------------------------------------------------------//}


    procedure CheckVersion;
    var
      CurrentVersion: Extended;
    begin
      CurrentVersion := StrToFloat(GetPage('http://sumilionscripts.freehostia.com/PSWWVersion.txt'));
      if(CurrentVersion > StrToFloat(VersionNumber))then
      begin
        mMemoBox.Lines.Add('--');
        mMemoBox.Lines.Add('Your current version is outdated.');
        mMemoBox.Lines.Add('Contact Lorax or Sumilion for an update.');
        Exit;
      end;
      mMemoBox.Lines.Add('--');
      mMemoBox.Lines.Add('You are up to date.');
    end;

    //------------------------------------------------------------------------\\
    {             FormStuff - Different stuff for the form.                   ||
    \\------------------------------------------------------------------------//}


    procedure CheckNicks; forward;
    procedure ButtonClick(Sender: TObject);
    begin
      case Sender of
        bStartScript :
        begin
          SLPSWWForm.Caption:= SLPSWWForm.Caption + '.';
          SLPSWWForm.ModalResult:= mrOk;
        end;
        bSetupUsers :
        begin
          StartPlayers(true, 'string1');
          mMemoBox.Lines.Add('--');
          mMemoBox.Lines.Add('Players Saved.');
          CheckNicks;
        end;
        bReportBug :
        begin
          mMemoBox.Lines.Add('--');
          mMemoBox.Lines.Add('Currently unavailable.');
        end;
        bVersionCheck :
          CheckVersion;
        bNews :
          WriteNews(10);
        bBestReport :
          BestProgressReport;
      end;
    end;

    {Normal Form}
    procedure LoadSLPSWWForm;
    begin
      SLPSWWForm := CreateForm;
      SLPSWWForm.Left := 250;
      SLPSWWForm.Top := 114;
      SLPSWWForm.Width := 439;
      SLPSWWForm.Height := 351;
      SLPSWWForm.Caption := 'SL PSWW - Form';
      SLPSWWForm.Color := clBtnFace;
      SLPSWWForm.Font.Color := clWindowText;
      SLPSWWForm.Font.Height := -11;
      SLPSWWForm.Font.Name := 'MS Sans Serif';
      SLPSWWForm.Font.Style := [];
      SLPSWWForm.Visible := False;
      SLPSWWForm.PixelsPerInch := 96;
      mMemoBox := TMemo.Create(SLPSWWForm);
      mMemoBox.Font.Name := 'Segoe UI';
      mMemoBox.Font.Height := -12;
      mMemoBox.Parent := SLPSWWForm;
      mMemoBox.Left := 134;
      mMemoBox.Top := 16;
      mMemoBox.Width := 272;
      mMemoBox.Height := 225;
      mMemoBox.Lines.Add('Thank you for using the PSWW.');
      mMemoBox.TabOrder := 4;
      bNews := TButton.Create(SLPSWWForm);
      bNews.Parent := SLPSWWForm;
      bNews.Left := 30;
      bNews.Top := 20;
      bNews.Width := 83;
      bNews.Height := 25;
      bNews.Caption := 'News';
      bNews.TabOrder := 0;
      bNews.OnClick := @ButtonClick;
      bVersionCheck := TButton.Create(SLPSWWForm);
      bVersionCheck.Parent := SLPSWWForm;
      bVersionCheck.Left := 30;
      bVersionCheck.Top := 55;
      bVersionCheck.Width := 83;
      bVersionCheck.Height := 25;
      bVersionCheck.Caption := 'Version Check';
      bVersionCheck.TabOrder := 1;
      bVersionCheck.OnClick := @ButtonClick;
      bSetupUsers := TButton.Create(SLPSWWForm);
      bSetupUsers.Parent := SLPSWWForm;
      bSetupUsers.Left := 30;
      bSetupUsers.Top := 160;
      bSetupUsers.Width := 83;
      bSetupUsers.Height := 25;
      bSetupUsers.Caption := 'Setup Users';
      bSetupUsers.TabOrder := 4;
      bSetupUsers.OnClick := @ButtonClick;
      bStartScript := TButton.Create(SLPSWWForm);
      bStartScript.Parent := SLPSWWForm;
      bStartScript.Left := 163;
      bStartScript.Top := 266;
      bStartScript.Width := 197;
      bStartScript.Height := 25;
      bStartScript.Caption := 'Start Script!';
      bStartScript.TabOrder := 5;
      bStartScript.OnClick := @ButtonClick;
      bReportBug := TButton.Create(SLPSWWForm);
      bReportBug.Parent := SLPSWWForm;
      bReportBug.Left := 30;
      bReportBug.Top := 90;
      bReportBug.Width := 83;
      bReportBug.Height := 25;
      bReportBug.Caption := 'Report Bug';
      bReportBug.TabOrder := 2;
      bReportBug.OnClick := @ButtonClick;
      bBestReport := TButton.Create(SLPSWWForm);
      bBestReport.Parent := SLPSWWForm;
      bBestReport.Left := 30;
      bBestReport.Top := 125;
      bBestReport.Width := 83;
      bBestReport.Height := 25;
      bBestReport.Caption := 'Best Report';
      bBestReport.TabOrder := 3;
      bBestReport.OnClick := @ButtonClick;
    end;

    procedure ShowFormModal;
    begin
      SLPSWWForm.ShowModal;
    end;

    procedure Signature; forward;
    procedure ShowNormalForm;
    var
      v: TVariantArray;
    begin
      Signature;
      SetArrayLength(V, 0);
      ThreadSafeCall('LoadSLPSWWForm', v);
      SetArrayLength(v, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    //------------------------------------------------------------------------\\
    {              LoadChatArray - Loads Chat text in the memory.             ||
    \\------------------------------------------------------------------------//}


    procedure LoadChatArray;
    begin
      SetArrayLength(arChatLines, 20);
        //b
      SetArrayLength(arChatLines[0].Question, 1);
      arChatLines[0].Question[0] := 'ban';
      arChatLines[0].Answer   := 2;
        //c
      SetArrayLength(arChatLines[1].Question, 1);
      arChatLines[1].Question[0] := 'cheat';
      arChatLines[1].Answer   := 2;
        //g
      SetArrayLength(arChatLines[2].Question, 1);
      arChatLines[2].Question[0] := 'gf';
      arChatLines[2].Answer   := 3;
      SetArrayLength(arChatLines[3].Question, 1);
      arChatLines[3].Question[0] := 'girl friend';
      arChatLines[3].Answer   := 3;
        //h
      SetArrayLength(arChatLines[4].Question, 1);
      arChatLines[4].Question[0] := 'hi';
      arChatLines[4].Answer   := 0;
      SetArrayLength(arChatLines[5].Question, 1);
      arChatLines[5].Question[0] := 'hey';
      arChatLines[5].Answer   := 0;
      SetArrayLength(arChatLines[6].Question, 1);
      arChatLines[6].Question[0] := 'hello';
      arChatLines[6].Answer   := 0;
      SetArrayLength(arChatLines[7].Question, 1);
      arChatLines[7].Question[0] := 'how are';
      arChatLines[7].Answer   := 1;
        //r
      SetArrayLength(arChatLines[8].Question, 1);
      arChatLines[8].Question[0] := 'report';
      arChatLines[8].Answer   := 2;
        //w
      SetArrayLength(arChatLines[9].Question, 3);
      arChatLines[9].Question[0] := 'wc';
      arChatLines[9].Question[1] := '+level';
      arChatLines[9].Question[2] := '+lvl';
      arChatLines[9].Answer   := 4;
      SetArrayLength(arChatLines[10].Question, 3);
      arChatLines[10].Question[0] := 'woodcut';
      arChatLines[10].Question[1] := '+level';
      arChatLines[10].Question[2] := '+lvl';
      arChatLines[10].Answer   := 4;
    end;

    //------------------------------------------------------------------------\\
    {                 LoadAnswer - Loads answers in the memory.               ||
    \\------------------------------------------------------------------------//}


    function LoadAnswer(AnswerType: Integer): string;
    begin
      case AnswerType of
        0: begin
             case Random(5) of
               0: Result := 'hi';
               1: Result := 'hey';
               2: Result := 'whats up?';
               3: Result := 'hello';
               4: Result := 'hey you';
             end;
           end;
        1: begin
             case Random(4) of
               0: Result := 'fine';
               1: Result := 'good';
               2: Result := 'ok';
               3: Result := 'splendid';
             end;
           end;
        2: begin
             case Random(6) of
               0: Result := 'why?';
               1: Result := 'me?';
               2: Result := 'sure';
               3: Result := 'if you feel like it';
               4: Result := 'please don''t';
               5: Result := 'that''s not nice';
             end;
           end;
        3: begin
             case Random(5) of
               0: Result := 'lol';
               1: Result := 'ew';
               2: Result := 'haha';
               3: Result := 'go away!';
               4: Result := 'let''s not';
             end;
           end;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                  CompareStrings - Compares the string.                  ||
    \\------------------------------------------------------------------------//}


    function CompareStrings(comText: string; var Count: Integer): Boolean;
    var
      bolMatch: array of Boolean;
      Count2, Count3: Integer;
      tmpString: string;
    begin
      WriteLn('we got to comparestrings');
      for Count := 0 to GetArrayLength(arChatLines) - 1 do
      begin
        Count3 := 0;
        SetArrayLength(bolMatch, Count3);
        for Count2 := 0 to GetArrayLength(arChatLines[Count].Question) - 1 do
        begin
          if(arChatLines[Count].Question[Count2][1] = '+')then
          begin
            if(Count2 <> 0)then
            begin
              if(arChatLines[Count].Question[Count2-1][1] <> '+')then
              begin
                Count3 := Count3 + 1;
                SetArrayLength(bolMatch, Count3);
              end;
            end else
            begin
             Count3 := Count3 + 1;
             SetArrayLength(bolMatch, Count3);
            end;

            tmpString := Copy(arChatLines[Count].Question[Count2], 2, Length(arChatLines[Count].Question[Count2]));
            WriteLn('+:'+tmpString);
            if(bolMatch[Count3 - 1] <> True)then
              if(Pos(tmpString, comText) <> 0)then
                bolMatch[Count3 - 1] := True;

          end else
          begin

            Count3 := Count3 + 1;
            SetArrayLength(bolMatch, Count3);
            tmpString := arChatLines[Count].Question[Count2];

            if(Pos(tmpString, comText) <> 0)then
              bolMatch[Count3 - 1] := True;
          end;

        end;

        Result := True;
        for Count3 := 0 to GetArrayLength(bolMatch) - 1 do
        begin
          if(bolMatch[Count3] = False)then
            WriteLn('bolMatch['+IntToStr(Count3)+']:False');
          if(bolMatch[Count3] = True)then
            WriteLn('bolMatch['+IntToStr(Count3)+']:True');
          if(bolMatch[Count3] = False)then
            Result := False;
        end;
        if Result then
          Exit;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                       ChatBack - Should we chat ?                       ||
    \\------------------------------------------------------------------------//}


    function ChatBack: Boolean;
    var
      MyAnswer: string;
      Count: Integer;
    begin
      OldChatText := NewChatText;
      OldChatter := NewChatter;
      GetLastChatText(NewChatText);
      LastChatter(NewChatter);

      WriteLn('NewChatText: '+NewChatText);
      WriteLn('OldChatText: '+OldChatText);

      if(NewChatter = '')then
        Exit;

      if(NewChatter <> LowerCase(Players[CurrentPlayer].Name))then
        WriteLn('Newchatter <> us')
      else
        WriteLn('NewChatter = us');
      if(OldChatText <> NewChatText)then
        WriteLn('Old text <> New text')
      else
        WriteLn('OldChatText = NewChatText');
      if(NewChatter <> LowerCase(Players[CurrentPlayer].Name))and
        (OldChatText <> NewChatText)then
      begin

        if CompareStrings(NewChatText, Count)then
          Result := True;

        if Result then
        begin
          MyAnswer := LoadAnswer(arChatLines[Count].Answer);
          TypeSend(MyAnswer);
        end;
      end;
    end;

    //******_Anti Randoms_******\\
    //------------------------------------------------------------------------\\
    {              FindFastRandoms - Finds basic randoms                      ||
    \\------------------------------------------------------------------------//}


    function FindFastRandoms: Boolean; //WT-Fawki
    var
      i: Integer;
    begin
      for i:=1 to 9 do
      begin
        case I of
         1:  If FindDead then
               Result := True;
         2:  If FindMod then
               Result := True;
         3:  If FindMime then
               Result := True;
         4:  If FindMaze then
               Result := True;
         5:  If FindQuiz then
               Result := True;
         6:  If FindDemon then
               Result := True;
         7: begin
               if NoGameTab then
               begin
                 Result := True;
                 ChangeLoc('No GameTab');
                 Logout;
                 Exit;
               end;
             end;
         7: begin
               if InBlack then
               begin
                 Result := True;
                 ChangeLoc('InBlack');
                 Logout;
                 Exit;
               end;
             end;
         8: if(RC)or(HandleTrade)then
              Result := True;
         9: if FindTalk then
              Result := True;
    //     10:  if ChatBack then
    //            Result := True;
        end;
        wait(1);
      end;
    end;

    //******_Math procedures_******\\
    //------------------------------------------------------------------------\\
    {                 FindColorsArray - Finds Raw colors                      ||
    \\------------------------------------------------------------------------//}


    function FindColorsArray(Color, Tolerance, Step, MaxTol: Integer): TPointArray;
    var
      Count, tx, ty: Integer;
    begin
      while (not FindColorTolerance(tx, ty, Color, MSX1, MSY1, MSCX, MSY2, Tolerance + Count * Step))and
            (Count * Step <= MaxTol) do
        Count := Count + 1;
      FindColorsSpiralTolerance(MSCX, MSCY, Result, Color, MSX1, MSY1, MSCX, MSY2, Tolerance + Count * Step);
    end;

    //------------------------------------------------------------------------\\
    {                getArrayFromBox - Gets colors in groups                  ||
    \\------------------------------------------------------------------------//}


    function getArrayFromBox(arColor: TPointArray; Width, Height: Integer): TPointArray;
    var
      Count, Count2, Count3: Integer;
      Match: Boolean;
    begin
      Count2 := 1;
      SetArrayLength(Result, Count2);
      Result[Count2 - 1].x := arColor[0].x;
      Result[Count2 - 1].y := arColor[0].y;
      for Count := 1 to GetArrayLength(arColor) - 1 do
      begin
        Match := False;
        for Count3 := 0 to GetArrayLength(Result) - 1 do
        begin
          if(arColor[Count].x < Result[Count3].x + Width)and
            (arColor[Count].y < Result[Count3].y + Height)and
            (arColor[Count].x > Result[Count3].x - Width)and
            (arColor[Count].y > Result[Count3].y - Height)then
            Match := True;
        end;
        if(Match = False)then
        begin
          Count2 := Count2 + 1;
          SetArrayLength(Result, Count2);
          Result[Count2 - 1].x := arColor[Count].x;
          Result[Count2 - 1].y := arColor[Count].y;
        end;
      end;
    end;

    //------------------------------------------------------------------------\\
    {              CheckColor - Checks that we haven't found a player         ||
    \\------------------------------------------------------------------------//}


    function CheckColor(ax, ay: Integer): Boolean;
    var
      xCount, yCount, zCount: Integer;
    begin
      for xCount := 0 to 4 do
        for yCount := 0 to 4 do
          if SimilarColors(GetColor(ax - 2 + xCount, ay - 2 + yCount), 16183532, 15) then
            zCount := zCount + 1;

      if(zCount <= MaxFenceCount)then
        Result := True;
    end;

    //------------------------------------------------------------------------\\
    {        IsFenceInLine - Checks for fence between two points              ||
    \\------------------------------------------------------------------------//}


    function IsFenceInLine(var ax, ay: Integer; x1, y1, x2, y2, fromPercent, toPercent: Integer): Boolean;
    var
      a, b: Extended;
      t1, t2, Count: Integer;
    begin
      t1 := x1; t2 := x2;
      x1 := Min(t1, t2);
      x2 := Max(t1, t2);
      if x1 <> t1 then begin t1 := y1; t2 := y2; y1 := t2; y2 := t1; end;
      t1 := -y1;
      t2 := -y2;
      a := (t2 - t1) div (x2 - x1);
      b := t1 - (a * x1);

      for Count := Trunc((fromPercent div 100.0) * (x2 - x1)) to Trunc((toPercent div 100.0) * (x2 - x1)) - 1 do
      begin
        ax := Count + x1;
        ay := Trunc(-1 * (a * ax + b));
        if SimilarColors(GetColor(ax, ay), 16183532, 15) then
        begin
          if CheckColor(ax, ay) then
          begin
            Result := True;
            Exit;
          end;
        end;
      end;
    end;

    //******_Walking procedures_******\\
    //------------------------------------------------------------------------\\
    {             SLWaterWalk - Walks along the water / road                  ||
    \\------------------------------------------------------------------------//}


    function SLWaterWalk(StartRadial, EndRadial: Integer; Radius,
      FFlagBreakOut: Integer; Xoff, Yoff, Xmod, Ymod: Integer): Boolean;
        // By Wizzup? and WT-Fakawi.
    var
      i, X1, Y1: Integer;
    begin
      Result := False;
      if not(LoggedIn)then
        Exit;
      if (StartRadial < EndRadial) then
      begin
        repeat
          for i := StartRadial to EndRadial do
          begin
            x1 := Round(Radius * Sine(i)) + 646;
            y1 := Round(-Radius * Cose(i)) + 84;
            if FindColor(x, y, RoadColor, X1, Y1, X1 + 1, Y1 + 1) then
            begin
              MouseFindNoFlag(x + Xoff, y + Yoff, Xmod, Ymod);
              Result := True;
              FFlag(FFlagBreakOut);
              Exit;
            end;
          end;
          Radius := Radius - 4;
        until Radius <= 1;
      end;
      if (StartRadial > EndRadial) then
      begin
        repeat
          for i := StartRadial downto EndRadial do
          begin
            x1 := Round(Radius * Sine(i)) + 646;
            y1 := Round(-Radius * Cose(i)) + 84;
            if (FindColor(x, y, RoadColor, X1, Y1, X1 + 1, Y1 + 1)) then
            begin
              MouseFindNoFlag(x + Xoff, y + Yoff, Xmod, Ymod);
              Result := True;
              FFlag(FFlagBreakOut);
              Exit;
            end;
          end;
          Radius := Radius - 4;
        until Radius <= 1;
      end;
    end;

    //------------------------------------------------------------------------\\
    {               SLGetSymbol - Lowers acc for better finding               ||
    \\------------------------------------------------------------------------//}


    function SLGetSymbol(var ax, ay: Integer; Symbol: string): Integer;
    begin
      SymbolAccuracy := 0.7;
      if(Lowercase(Symbol) = 'bank')then
        SymbolAccuracy := 0.3;
      Result := GetSymbolColor(ax, ay, Symbol);
      DebugMe(IntToStr(ax)+' '+IntToStr(ay), 1);
      SymbolAccuracy := 0.8;
    end;

    //------------------------------------------------------------------------\\
    {               GotColor - Do we got the wanted color ?                   ||
    \\------------------------------------------------------------------------//}


    function GotColor(ColorType: string): Boolean;
    begin
      case LowerCase(ColorType) of
        'bank'  : Result := (BankColor    > 0);
        'road'  : Result := (RoadColor    > 0);
        'ladder': Result := (LadderColor  > 0);
        'quest' : Result := (QuestColor   > 0);
        'farm'  : Result := (FarmingColor > 0);
      end;
      if not(Result)then
      begin
        Writeln(ColorType + 'Color NOT found, setting to false');
        LogOut;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                   RelocateAtWillows - Resets player                     ||
    \\------------------------------------------------------------------------//}


    procedure RelocateAtWillows;
    var
      ax, ay: Integer;
    begin
      if not(LoggedIn)then
        Exit;
      MakeCompass('N');
      if(SLGetSymbol(ax, ay, 'farming spot') <> 0)then
      begin
        DebugMe('Relocated - used farm spot', 1);
        MouseFindNoFlag(ax + 10, ay + 15, 5, 5);
        FFlag(0);
        Exit;
      end else
        DebugMe('Didn''t find farm spot', 1);

      if(QuestColor = 0)then
        QuestColor := SLGetSymbol(ax, ay, 'quest');
      if(QuestColor <> 0)then
        if FindColor(ax, ay, QuestColor, MMX1, MMCY, MMX2, MMY2) then
        begin
          DebugMe('Relocated - used QuestColor', 1);
          MouseFindNoFlag(ax + 20, ay - 20, 4, 4);
          FFlag(0);
          RelocateAtWillows;
          Exit;
        end else
          DebugMe('Didn''t find QuestSymbol', 1);

      if(BarColor = 0)then
        BarColor := SLGetSymbol(ax, ay, 'bar');
      if(BarColor <> 0)then
        if FindColor(ax, ay, BarColor, MMX1, MMY1, MMX2, MMY2) then
        begin
          DebugMe('Relocated - used BarColor', 1);
          MouseFindNoFlag(ax + 30, ay + 10, 4, 4);
          FFlag(0);
          RelocateAtWillows;
          Exit;
        end else
          DebugMe('Didn''t find BarColor', 1);

      WriteLn('We didn''t find any points - while relocating');
      LogOut;
    end;

    //------------------------------------------------------------------------\\
    {                 BankToWillows - Walks to the willows                    ||
    \\------------------------------------------------------------------------//}


    procedure BankToWillows;
    var
      ax, ay, Count: Integer;
    begin
      if LoggedIn then
      begin
        MouseSpeed := 5 + Random(5);
        MakeCompass('N');
        WriteLn('Bank to willows');
        FindRoadColor;
        GotColor('Road');
        if(BankColor = 0)then
          BankColor := SLGetSymbol(ax, ay, 'bank');
        GotColor('Bank');
        if(LadderColor = 0)then
        begin
          LadderColor := FindLadderColor;
          GotColor('Ladder');
        end;

        SLWaterWalk(300, 220, 60, 8, 0, 0, 3, 3);
        DebugMe('Walked left of bank using RoadWalk', 1);

        if(QuestColor = 0)then
        begin
          DebugMe('QuestColor was 0, now finding QuestColor using symbol', 1);
          QuestColor := SLGetSymbol(ax, ay, 'quest');
          if(QuestColor = 0)then
            DebugMe('Didn''t find QuestColor at first try', 1);
        end;

        if(QuestColor <> 0)then
          DebugMe('QuestColor is not zero - QuestColor: '+IntToStr(QuestColor), 1);

        if(QuestColor = 0)or(not FindColor(ax, ay, QuestColor, MMX1, MMY1, MMX2, MMY2))then
        begin
          Wait(500 + Random(100));
          FFlag(0);
          DebugMe('Making FFlag(0) because of previously not found QuestColor, QuestColor: '+IntToStr(QuestColor), 1);
          if(QuestColor = 0)then
            QuestColor := SLGetSymbol(ax, ay, 'quest');

          if(QuestColor = 0)or(not FindColor(ax, ay, QuestColor, MMX1, MMY1, MMX2, MMY2))then
          begin
            DebugMe('Didn''t find QuestColor using FFlag(0) - using RoadWalk now, QuestColor: '+IntToStr(QuestColor), 1);
            FindRoadColor;
            SLWaterWalk(300, 220, 50, 0, 0, 0, 0, 0);
            if(QuestColor = 0)then
              QuestColor := SLGetSymbol(ax, ay, 'quest');

            if(QuestColor = 0)or(not FindColor(ax, ay, QuestColor, MMX1, MMY1, MMX2, MMY2))then
            begin
              DebugMe('Didn''t find QuestColor using RoadWalk then GetSymbolColor - setting False', 1);
              LogOut;
              Players[CurrentPlayer].Active := False;
            end;
          end;
        end;

        if FindColor(ax, ay, QuestColor, MMX1, MMY1, MMX2, MMY2) then
        begin
          DebugMe('Found QuestColor - Clicking x coordinate - 22', 1);
          MouseFindNoFlag(ax - 22, ay, 3, 3);
        end;

        FFlag(10);

        for Count := 3 downto 0 do
        begin
          if(SLGetSymbol(ax, ay, 'farming spot') <> 0)then
          begin
            DebugMe('Found farming spot', 1);
            if(ay - 25 > 25)then
            begin
              DebugMe('ay - 25 > 25 = true - we can safely click now', 1);
              Break;
            end else
              DebugMe('farming spot coordinates is to close to upper edge of MM', 1);
          end else
            DebugMe('Farming spot not visible yet', 1);

          if(QuestColor <> 0)then
            if FindColor(ax, ay, QuestColor, MMX1, MMY1, MMX2, MMY2) then
            begin
              MouseFindNoFlag(ax - 22 - 24 + (Count * 6), ay, 3, 3);
              DebugMe('Found QuestColor clicking closer to the fence ('+IntToStr(4-Count)+') - using FFlag(0)', 1);
            end;

          FFlag(0);
        end;

        if(SLGetSymbol(ax, ay, 'farming spot') <> 0)then
        begin
          DebugMe('Found farm spot clicking x + 20 + Random(5), y - 25 - Random(3)', 1);
          MouseFindNoFlag(ax + 20 + Random(5), ay - 25 - Random(3), 0, 7);
          if(not FlagPresent)then
          begin
            DebugMe('There were no flag (Waiting 3000 + Random(1000))', 1);
            Wait(3000 + Random(1000));
          end;
        end else
        begin
          DebugMe('Found no farm symbol - using QuestSymbol (x - 50), (y - 30), 3, 3', 1);
          if FindColor(ax, ay, QuestColor, MMX1, MMY1, MMX2, MMY2) then
            MouseFindNoFlag(ax - 50, ay - 30, 3, 3);
        end;

        FFlag(0);
        if(SLGetSymbol(ax, ay, 'farming spot') <> 0)then
        begin
          DebugMe('Found farm spot - clicking (ax + 10), (ay + 15)', 1);
          MouseFindNoFlag(ax + 10, ay + 15, 5, 5);
        end else
        begin
          DebugMe('Didn''t find farm spot number 2 - trying again', 1);
          FFlag(0);
          if(SLGetSymbol(ax, ay, 'farming spot') <> 0)then
          begin
            DebugMe('Found farm spot - clicking (ax + 10), (ay + 15)', 1);
            MouseFindNoFlag(ax + 10, ay + 15, 5, 5);
            FFlag(0);
          end else
          begin
            DebugMe('Didn''t find farm spot number 2 second try', 1);
            for Count := 0 to 2 do
            begin
              DebugMe('Making blind click', 1);
              MouseFindNoFlag(635, 105, 5, 5);
              FFlag(0);
              if(SLGetSymbol(ax, ay, 'farming spot') <> 0)then
              begin
                Count := -1;
                Break;
              end;
            end;
            if(Count <> 2)then
            begin
              DebugMe('Found farm spot - clicking (ax + 10), (ay + 15)', 1);
              MouseFindNoFlag(ax + 10, ay + 15, 5, 5)
            end else
            begin
              WriteLn('Didn''t find farm spot number 2 - setting active: false');
              LogOut;
              Exit;
            end;
          end;
        end;

        FFlag(0);
        ChangeLoc('willows');
      MouseSpeed := gMouseSpeed + Random(5);
      end;
    end;

    //------------------------------------------------------------------------\\
    {                    WillowsToBank - Walks to the bank                    ||
    \\------------------------------------------------------------------------//}


    procedure WillowsToBank;
    var
      ax, ay, bx, by, cx, cy, Count: Integer;
    begin
      if LoggedIn then
      begin
        MouseSpeed := 5 + Random(5);
        MakeCompass('N');
        WriteLn('Willows to bank');
        if(FarmingColor = 0)then
          FarmingColor := SLGetSymbol(ax, ay, 'farming spot');
        GotColor('Farm');

        if(QuestColor = 0)then
          QuestColor := SLGetSymbol(ax, ay, 'quest');
        GotColor('Quest');

        while(not FindColor(bx, by, QuestColor, 678, MMY1, MMX2, MMY2))and
             (Count <= 24)do
        begin
          DebugMe('Didn''t find QuestColor', 1);
          if FindColor(ax, ay, FarmingColor, MMX1, MMY1, MMX2, MMY2) then
          begin
            MouseFindNoFlag(ax + 10 + Count, ay, 3, 3);
            DebugMe('Found farm color - optimating location (ax + 10 + '+IntToStr(Count)+')', 1);
            FFlag(0);
          end;
          Count := Count + 6;
        end;

        if Count = 30 then
        begin
          WalkTries := WalkTries + 1;
          if(WalkTries = 4)then
          begin
            WriteLn('Player lost during walkback - WalkTries = 4 - setting false');
            Players[CurrentPlayer].Active := False;
          end;
          RelocateAtWillows;
          WillowsToBank;
          Exit;
        end else
          WalkTries := 0;

        if(FindColor(ax, ay, FarmingColor, MMX1, MMY1, MMX2, MMY2))and
          (FindColor(bx, by, QuestColor, 678, MMY1, MMX2, MMY2))then
        begin
          DebugMe('Found Farm + Quest color', 1);
          if IsFenceInLine(cx, cy, ax, ay, bx, by, 40, 60)then
          begin
            DebugMe('Used fence to walk clicking (cx + 8), ((by + ay) div 2 - 25)', 1);
            MouseFindNoFlag(cx + 8, (by + ay) div 2 - 25, 3, 3);
          end else
          begin
            DebugMe('used 30% Farm (x) and 70% Quest x, (by + ay) div 2 - 25', 1);
            MouseFindNoFlag( Trunc(ax * 0.3 + bx * 0.7), (by + ay) div 2 - 25, 3, 3);
          end;
        end;

        FFlag(0);
        if(not FindColor(bx, by, QuestColor, MMCX, MMY1, MMX2, MMY2))then
        begin
          DebugMe('We didn''t get all the way - Waiting(4000 + Random(1000)) and then do another FFlag(0)', 1);
          Wait(4000 + Random(1000));
          FFlag(0);
        end;

        if(FindColor(bx, by, QuestColor, MMCX, MMY1, MMX2, MMY2))then
        begin
          DebugMe('Found QuestColor - clicking Quest symbol', 1);
          MouseFindNoFlag(bx, by, 3, 3)
        end else
        begin
          WriteLn('Didn''t find QuestColor - setting player: false');
          Players[CurrentPlayer].Active := False;
          LogOut;
        end;

        if(RoadColor = 0)then
        begin
          DebugMe('RoadColor = 0, using FFlag(0)', 1);
          FFlag(0);
        end else
        begin
          DebugMe('RoadColor <> 0, using FFlag(10)', 1);
          FFlag(10);
        end;

        FindRoadColor;
        GotColor('Road');
        for Count := 0 to 2 do
        begin
          SLWaterWalk(150, 80, 60, 10, 0, 0, 4, 4);
          DebugMe('Walking the road - '+IntToStr(Count + 1)+'th time', 1);
          FindRoadColor;
          if(BankColor = 0)then
          begin
            DebugMe('BankColor = 0, trying to find BankSymbol', 1);
            BankColor := SLGetSymbol(ax, ay, 'bank');
            if(BankColor <> 0)then
            begin
              DebugMe('Found BankSymbol', 1);
              Break;
            end;
          end else
          begin
            DebugMe('BankColor <> 0, trying to find BankColor', 1);
            if FindColor(ax, ay, BankColor, MMX1, MMY1, MMX2, MMY2) then
            begin
              DebugMe('Found BankSymbol', 1);
              Break;
            end;
          end;
        end;

        if(BankColor <> 0)then
        begin
          DebugMe('BankColor <> 0, trying to find Bank using BankColor', 1);
          if(FindColor(ax, ay, BankColor, MMX1, MMY1, MMX2, MMY2))then
          begin
            DebugMe('Found BankColor on MM, walking to bank', 1);
            MouseFindNoFlag(ax, ay, 5, 5);
            FFlag(0);
          end else
          begin
            WriteLn('Didn''t find BankColor on MM, setting active: false');
            Players[CurrentPlayer].Active := False;
            LogOut;
          end;
        end else
        if(LadderColor <> 0)then
        begin
          DebugMe('BankColor = 0 and LadderColor <> 0 trying to find bank with LadderColor', 1);
          if(FindColor(ax, ay, LadderColor, MMX1, MMY1, MMX2, MMY2))then
          begin
            DebugMe('Found LadderColor - clicking LadderColor (ax + 20), (ay + 40), 5, 5', 1);
            MouseFindNoFlag(ax + 20, ay + 40, 5, 5);
            FFlag(0);
          end;
        end else
        begin
          WriteLn('Sorry we couldn''t find Ladder or BankColor - terminating');
          LogOut;
          Exit;
        end;

        ChangeLoc('bank');
        MouseSpeed := gMouseSpeed + Random(5);
      end;
    end;

    //******_AxeHead procedures_******\\
    //------------------------------------------------------------------------\\
    {               FindBestAxe - Gets best axe in the bank                   ||
    \\------------------------------------------------------------------------//}


    function FindBestAxe(var fx, fy: Integer; InBank: Boolean): Boolean;
    var
      I, x1, y1, x2, y2 : Integer;
    begin
      if LoggedIn then
      begin
        for I := 1 to 6 do
        begin
          if(InBank)then
          begin
            x1 := MSX1; y1 := MSY1; x2 := MSX2; y2 := MSY2;
          end else
          begin
            x1 := MIX1; y1 := MIY1; x2 := MIX2; y2 := MIY2;
          end;
          if(FindDtm(dtmAxes[i], fx, fy, x1, y1, x2, y2))then
          begin
            Result := True;
            Break;
          end;
        end;
        if not(Result)then
          PlayerLost('We don''t have an axe - FindBestAxe');
      end;
    end;

    //------------------------------------------------------------------------\\
    {               SLFindAxeHeadColor - Finds axe at the player              ||
    \\------------------------------------------------------------------------//}


    function SLFindAxeHeadColor: Boolean;
    var
      InvAxe, WieldAxe, Ix, Iy: integer;
    begin
      if LoggedIn then
      begin
        GameTab(4);
        for InvAxe := 1 to 7 do
        begin
          if(InvAxe = 7)then Break;
          if(FindDtm(dtmAxes[InvAxe], Ix, Iy, MIX1, MIY1, MIX2, MIY2))then
           Break;
        end;
        GameTab(5);
        for WieldAxe := 1 to 7 do
        begin
          if(WieldAxe = 7)then Break;
          if(FindDtm(dtmAxes[WieldAxe], x, y, MIX1, MIY1, MIX2, MIY2))then
            Break;
        end;

        if(InvAxe = 7)and(WieldAxe = 7)then
        begin
          Result := False;
          Exit;
        end;
        if((InvAxe-WieldAxe) < 0)then
          EquipAxe := False
        else
          EquipAxe := True;
        Result := true;
        if(EquipAxe)then
        begin
          GameTab(5);
          Wait(1000 + Random(500));
          HeadColor[0] := GetColor(597, 294);
          HeadColor[1] := GetColor(600, 295);
          HeadColor[2] := GetColor(599, 298);
        end else
        begin
          GameTab(4);
          if FindBestAxe(ix, iy, False) then
            Mouse(ix, iy, 3, 3, True);
          Wait(2000 + Random(1000));
          if(InChat('You need'))then
            PlayerLost('Noob alert - you do not have the required att to wield axe');
          GameTab(5);
          HeadColor[0] := GetColor(597, 294);
          HeadColor[1] := GetColor(600, 295);
          HeadColor[2] := GetColor(599, 298);
        end;
        WriteLn('Axe head colors: ' + IntToStr(HeadColor[0]) + ' ' + IntToStr(HeadColor[1]) + ' ' +
                IntToStr(HeadColor[1]));
      end;
    end;

    //------------------------------------------------------------------------\\
    {          AttachHead2 - Attaches found head, needed modifying.           ||
    \\------------------------------------------------------------------------//}


    function AttachHead2: Boolean;
    var
      AxeHandleDTM, AxeHeadDTM, ax, ay: Integer;
      Reequip: Boolean;
    begin
      AxeHandleDTM := DTMFromString('78DA637465626078C48002CA2379191E02694' +
        '620FE0F048C0E40352F19D000231209A4ED806A3E1150E30454F3' +
        '86801A2FA09AEB04D47800D5DC23A0C616A8E61D01358E4035EF0' +
        '9A80185CF03FC6A00E1CD105C');
      AxeHeadDTM := DTMFromString('78DA63CC62626078C180021C2312191E02694' +
        '620FE0F048C694035CF18D000231209A473816A9E12A1E6150135' +
        'A94035AF09A801B9F9090135994498930C54F392809A3CCCF0415' +
        '70300FB8311DF');

      WriteLn('Attaching head');
      if not(LoggedIn)then
        Exit;
      if EquipAxe then
      begin
        GameTab(5);
        Wait(200 + Random(200));
        Mouse(592, 297, 2, 2, True);
        Wait(2000 + Random(800));
        Reequip := True;
      end;
      GameTab(4);
      if (FindDTM(AxeHeadDTM, x, y, MIX1, MIY1, MIX2, MIY2)) and
         (FindDTM(AxeHandleDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
      begin
        if (FindDTM(AxeHeadDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
        begin
          Mouse(x, y, 3, 3, True);
          Wait(600 + Random(400));
        end;
        if (FindDTM(AxeHandleDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
        begin
          Mouse(x, y, 3, 3, True);
          Wait(500 + Random(200));
          AxeAttaches := AxeAttaches + 1;
          Result := True;
          WriteLn('Attached Axe Head!');
          GameTab(4);
          MakeCompass('N');
        end;
        if ReEquip then
        begin
          Wait(1000 + Random(1000));
          if FindBestAxe(ax, ay, False) then
            Mouse(ax, ay, 3, 3, True);
          Wait(500 + Random(500));
        end;
      end;
      FreeDTM(AxeHandleDTM);
      FreeDTM(AxeHeadDTM);
    end;

    //------------------------------------------------------------------------\\
    {           SLFindHead - Finds the AxeHead if not on the handle           ||
    \\------------------------------------------------------------------------//}


    function SLFindHead: Boolean;
    var
      AxeHeadDTM, Tries, ax, ay, ChatText: Integer;
      a, c: Extended;
    begin
      if LoggedIn then
      begin
        Result := True;

        ChatText := CreateBitmapMaskFromText('ou do not have an axe', SmallChars);
        if FindBitmapMaskTolerance(ChatText, x, y, 17, 399, 188, 440, 10, 85) then
        begin
          AxeHeadDTM := DTMFromString('78DA63CC62626078C180021C2312191E02694' +
        '620FE0F048C694035CF18D000231209A473816A9E12A1E6150135' +
        'A94035AF09A801B9F9090135994498930C54F392809A3CCCF0415' +
        '70300FB8311DF');

          Result := False;
          Tries := 0;
          a := 1.0;
          repeat
            if not LoggedIn then Exit;
            GameTab(4);
            if (FindDTM(AxeHeadDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
              Break;

            a := a + 1;
            c := Trunc(a div 2.0) * 1.0;
            if(c = a div 2.0)then
            begin
              if(FindObjMulti('ake', HeadColor[0], HeadColor[1], HeadColor[2], 5))then
              begin
                WriteLn('Axe head found - picking it up');
                Wait(450 + Random(400));
                GetMousePos(ax, ay);
                Mouse(ax, ay, 0, 0, False);
                Popup('ake');
                FFlag(0);
                Wait(1000 + Random(500));
              end else
              begin
                Tries := Tries + 1;
                WriteLn('Axe head was not found. Taken ' + IntToStr(Tries) + ' tries');
                KeyDown(VK_LEFT);
                Wait(1000 + Random(400));
                KeyUp(VK_LEFT);
                Wait(300 + Random(150));
              end;
            end else
            begin
              WriteLn('Axe head wasn''t found - Moving to a Red dot');
              ax := MMCX;
              ay := MMCY;
              if(FindColorSpiral(ax, ay, 241, MMCX + 3, MMY1, MMX2, MMY2))or
                (FindColorSpiral(ax, ay, 241, MMX1, MMY1, MMCX - 3, MMY2))or
                (FindColorSpiral(ax, ay, 241, MMX1, MMCY + 3, MMX2, MMY2))or
                (FindColorSpiral(ax, ay, 241, MMX1, MMY1, MMX2, MMCY - 3))then
                MouseFindNoFlag(ax + 3, ay + 3, 2, 2);
              FFlag(0);
              Wait(500 + Random(500));
            end;
          until(Tries > 5)or
          (FindDTM(AxeHeadDTM, ax, ay, MIX1, MIY1, MIX2, MIY2));

          if AttachHead2 then
            Result := True;

          Wait(500);
          if(InChat('You need'))then
            PlayerLost('Noob alert - not high enough att level to wear axe');

          RelocateAtWillows;
        end;

        gBrokenAxe := (not Result);

        if(AxeHeadDTM <> 0)then
          FreeDTM(AxeHeadDTM);
        FreeBitmap(ChatText);
      end;
    end;

    //******_Bank procedures_******\\
    //------------------------------------------------------------------------\\
    {                        SLOpenBank - Opents the bank                     ||
    \\------------------------------------------------------------------------//}


    function SLOpenBank: Boolean;
    var
      BankTime, I: Integer;
      arBankColor, arBankColorResults: TPointArray;
    begin
      if LoggedIn then
      begin
        MarkTime(BankTime);
        while(not(BankScreen))and(TimeFromMark(BankTime) < 20000)do
        begin
          arBankColor := FindColorsArray(541273, 0, 2, 10);
          if(GetArrayLength(arBankColor) = 0)then
            Break;
          arBankColorResults := getArrayFromBox(arBankColor, 40, 40);
          for I := 1 to GetArrayLength(arBankColorResults)-1 do
          begin
            if not(LoggedIn)then Exit;
            FFlag(0);
            Wait(100 + Random(100));
            MMouse(arBankColorResults[i].x, arBankColorResults[i].y, 5, 5);
            if(IsUpTextMulti('se Ban', 'ank b', 'booth'))then
            begin
              GetMousePos(x, y);
              Mouse(x, y, 2, 2, false);
              Wait(100+Random(100));
              ChooseOption(x, y, 'uickly');
            end;
            if(PinScreen)then
              if not(InPin(PinNumber))then
                Writeln('Player lost.');
            if(BankScreen)or(TimeFromMark(BankTime) > 20000)then
              Break;
          end;
        end;
        FFlag(0);
        Wait(4000 + Random(500));
        Result := BankScreen;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                    SLBank - Main banking procedure                      ||
    \\------------------------------------------------------------------------//}


    procedure SLBank(WithdrawAxe: Boolean);
    var
      dtmLogs, ax, ay: Integer;
    begin
      if LoggedIn then
      begin
        if(BankCount = 3)then
          PlayerLost('We failed the bank');

        if(WithdrawAxe)then
        begin
          if(InvCount = 28)then
          begin
            dtmLogs := DTMFromString('78DA637CC3C0C0308B010538588AC3D9FF818' +
              '0F13590B184010D30229140FA2790984F40CD57203109BF1A001E' +
              '6D0ACB');
            if(FindDtm(dtmLogs, x, y, MIX1, MIY1, MIX2, MIY2))then
            begin
              Mouse(x, y, 5, 5, false);
              ChooseOption(x, y, 'rop');
            end;
            FreeDtm(dtmLogs);
          end;
          GameTab(5);
          Mouse(591, 304, 10, 10, true);
          GameTab(4);
        end;
        SLOpenBank;
        if(not BankScreen)then
        begin
          Writeln('Failed to open the bank.');
          ax := MMCX; ay := MMCY;
          if FindColorSpiral2(ax, ay, RoadColor, MMX1, MMY1, MMX2, MMY2) then
            MouseFindNoFlag(ax, ay, 3, 3);
          FFlag(0);
          BankCount := BankCount + 1;
          SLBank(WithdrawAxe);
        end else
          BankCount := 0;
        FixBank;
        if(InvCount = 28)then
          Loads := Loads + 1;
        LogsChopped := LogsChopped + CountItemBmpMaskTol(LogMask, 5, 5);
        ReportVars[0] := ReportVars[0] + CountItemBmpMaskTol(LogMask, 5, 5);
        DepositAll;
        if(InvCount > 0)then
          DepositAll;
        if(WithDrawAxe)then
        begin
          if(FindBestAxe(x, y, True))then
          begin
            Mouse(x, y, 5, 5, true);
            Wait(200+Random(300));
          end;
        end;
        CloseBank;
        Wait(200+Random(200));
        if(BankScreen)then
          CloseBank;
        if(WithDrawAxe)then
        begin
          Wait(400 + Random(400));
          if(not SLFindAxeHeadColor)then
            PlayerLost('You don''t have an axe');
        end;
        gBrokenAxe := false;
      end;
      ProgressReport;
    end;

    //******_Chopping procedures_******\\
    //------------------------------------------------------------------------\\
    {                   SLFindEnt - Finds the evil ent !                      ||
    \\------------------------------------------------------------------------//}


    function SLFindEnt(var ax, ay: Integer; tColor: Integer): Boolean;
    var
      TempMouseSpeed, mx, my, Count: integer;
    begin
      GetMousePos(mx, my);
      if(ax < 5)then
        ax := 5;
      if(ay < 5)then
        ay := 5;
      if(mx < ax + 5)and(mx > ax - 5)and(my < ay + 5)and(my > ay - 5)then
      else
        if(FindColorSpiralTolerance(ax, ay, tColor, ax - 5, ay - 5, ax + 5, ay + 5, 5))then
        begin
          MMouse(ax, ay, 2, 2);
          Wait(75 + Random(30));
        end;
      if(FindColorTolerance(ax, ay, 122333, 84, 1, 123, 15, 10))then
      begin
        for Count := 0 to 4 do
        begin
          Result := IsUpTextMulti('hop', 'own', 'down');
          if(Result)then
            Break;
          Wait(25);
        end;
        if(Result)then
        begin
          Writeln('Ent found!!! Waiting...');
          TempMouseSpeed := MouseSpeed;
          MouseSpeed := 2 + Random(2);
          Mouse(MMCX, MMCY, 2, 2, true);
          IdleTime(5000 + Random(10000), 500, 1.0);
          EntsAvoided := EntsAvoided + 1;
          MouseSpeed := TempMouseSpeed;
        end;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                ValidateTree - Is it the correct tree ?                  ||
    \\------------------------------------------------------------------------//}


    function ValidateTree(ax, ay: Integer): boolean;
    begin
      if(IsUpText('hop'))or(IsUpText('own'))then
      begin
        if IsUpTextMulti('ree', 'ak', 'ew') then
          Exit;
        if IsUpText('illow') then
          Result := True;
      end;
    end;

    //------------------------------------------------------------------------\\
    {        SLFindMiddleOfTree - Finds ... the middle of the tree            ||
    \\------------------------------------------------------------------------//}


    function SLFindMiddleOfTree(var ax, ay: Integer; tColor: Integer): Boolean;
    var
      Count, x1, y1, x2, y2, bCount, aCount: Integer;
      arLuminance: array[0..1] of Extended;
      Hue, Saturation: Extended;
    begin
      if(ax < 10)then
        ax := 10;
      if(ay < 10)then
        ay := 10;
      if(FindColorSpiralTolerance(ax, ay, tColor, ax - 10, ay - 10, ax + 10, ay + 10, 5))and
        (LoggedIn)then
      begin
        for bCount := 0 to 3 do
        begin
          ColorToHSL(GetColor(ax, ay), Hue, Saturation, arLuminance[1]);
          Count := 0;
          if(bCount = 2)then
            ax := (x2 + x1) div 2;
          repeat
            arLuminance[0] := arLuminance[1];
            case bCount of
              0: ColorToHSL(GetColor(ax - Count, ay), Hue, Saturation, arLuminance[1]);
              1: ColorToHSL(GetColor(ax + Count, ay), Hue, Saturation, arLuminance[1]);
              2: ColorToHSL(GetColor(ax, ay - Count), Hue, Saturation, arLuminance[1]);
              3: ColorToHSL(GetColor(ax, ay + Count), Hue, Saturation, arLuminance[1]);
            end;

            if(Hue > 14)and(Hue < 34)then
            begin
              if(arLuminance[0] < arLuminance[1] - 1.5)or
                (arLuminance[0] > arLuminance[1] + 1.5)then
                aCount := 0
              else
                aCount := aCount + 1;
            end else
              aCount := aCount + 1;

            if(aCount = 3)then
            begin
              case bCount of
                0: x1 := ax - Count + 3;
                1: x2 := ax + Count - 3;
                2: y1 := ay - Count + 3;
                3: y2 := ay + Count - 3;
              end;
            end;
            Count := Count + 1;
          until(Count = 60)or(aCount = 3);
          if(Count = 60)then
          begin
            case bCount of
              0: x1 := ax - Count;
              1: x2 := ax + Count;
              2: y1 := ay - Count;
              3: y2 := ay + Count;
            end;
          end;
        end;

        ay := (y2 + y1) div 2;
        if((x2 - x1) * (y2 - y1) >= MinWCount * MinHCount)then
          Result := True;
      end;
    end;

    //------------------------------------------------------------------------\\
    {               FindTree2 - Finds the tree in the screen                  ||
    \\------------------------------------------------------------------------//}


    function FindTree2(var gx, gy: Integer): Boolean;
    var
      tColors: array[0..8]of Integer;
      xCount, yCount, cCount, zCount, tCount, tColor, FoundCount, HighEnoughLuminanceChangeCount, ABigEnoughTreeCount, NotValidNameCount: Integer;
      Luminance: array[0..8]of Extended;
      Saturation, Hue: Extended;
      x1, y1, x2, y2, a, c, i, tx, ty: Integer;
    begin
      x1 := 245;
      y1 := 165;
      x2 := 277;
      y2 := 185;
      repeat
        if(not LoggedIn)then
          Break;
        a := a + 1;
        if (a = 1) then
          c := c + 1;
        if (a = 3) then
          c := c + 1;
        for i := 1 to c do
        begin
          if (a = 1) then
          begin
            x1 := x1 + 60;
            x2 := x2 + 60;
          end;
          if (a = 2) then
          begin
            y1 := y1 - 40;
            y2 := y2 - 40;
          end;
          if (a = 3) then
          begin
            x1 := x1 - 60;
            x2 := x2 - 60;
          end;
          if (a = 4) then
          begin
            y1 := y1 + 40;
            y2 := y2 + 40;
          end;
          if (x1 = 485) and (x2 = 517) then
            x2 := x2 - 2;
          if (y1 = 325) and (y2 = 345) then
            y2 := y2 - 7;
          if (x2 > 515) then
            Break;
          zCount := 0;
          tx := x2 - x1;
          ty := y2 - y1;
          if(FindColorSpiralTolerance(tx, ty, MSTreeColor, x1, y1, x2, y2, 10))then
          begin
            FoundCount := FoundCount + 1;
            for xCount := 0 to 2 do
              for yCount := 0 to 2 do
                tColors[yCount + xCount * 3] := GetColor(tx - 1 + xCount, ty - 1 + yCount);
            for xCount := 0 to 2 do
            begin
              for yCount := 0 to 2 do
              begin
                cCount := yCount + xCount * 3;
                ColorToHSL(tColors[cCount], Hue, Saturation, Luminance[cCount]);
                if(cCount > 0)then
                begin
                  if(Hue > MinHue)and(Hue < MaxHue)then
                  begin
                    if(cCount = 3)or(cCount = 6)then
                      tCount := cCount - 2
                    else
                      tCount := cCount;
                    if(Luminance[cCount] > Luminance[tCount - 1] + 2)or
                      (Luminance[cCount] < Luminance[tCount - 1] - 2)then
                    zCount := zCount + 1;
                  end;
                end;
              end;
            end;
            if(zCount >= MinzCount)then
            begin
              HighEnoughLuminanceChangeCount := HighEnoughLuminanceChangeCount + 1;
              tColor := GetColor(tx, ty);
              if SLFindMiddleOfTree(tx, ty, tColor) then
              begin
                ABigEnoughTreeCount := ABigEnoughTreeCount + 1;
                MMouse(tx, ty, 3, 3);
                Wait(100 + Random(50));
                tColor := GetColor(tx, ty);
                Result := (ValidateTree(tx, ty))and(not SLFindEnt(tx, ty, tColor));
                if(not Result)then
                  NotValidNameCount := NotValidNameCount + 1;
                if(Result)then
                begin
                  DebugMe('Found: '+IntToStr(FoundCount)+', LuminanceOKS: '+IntToStr(HighEnoughLuminanceChangeCount)+', BigTrees: '+IntToStr(ABigEnoughTreeCount)+', NonValidNames: '+IntToStr(NotValidNameCount), 2);
                  gx := tx;
                  gy := ty;
                  Exit;
                end;
              end;
            end;
          end;
        end;
        if (a = 4) then
          a := 0;
      until (x2 > 515) or (Result);
    end;

    //------------------------------------------------------------------------\\
    {                  UpdateColor - Updates coords of the tree               ||
    \\------------------------------------------------------------------------//}


    function UpdateColor(var ax, ay: Integer; tColor: Integer): boolean;
    var
      Checker: Integer;
    begin
      Checker := GetSystemTime;
      if(ax < 20)then ax := 20; if(ay < 20)then ay := 20;
      while(FindColorSpiralTolerance(ax, ay, tColor, ax - 20, ay - 20, ax + 20, ay + 20, 5))and
           (TimeFromMark(Checker) < 10000)and
           (FlagPresent)do
      begin
        if(ax < 20)then ax := 20; if(ay < 20)then ay := 20;
        Wait(16);
      end;

      for Checker := 0 to 45 do
      begin
          if(not FindColorSpiralTolerance(ax, ay, tColor, ax - 10, ay - 10, ax + 10, ay + 10, 5))then
            Break;
          if(not SLFindHead)then
            Exit;
          Wait(16);
          if(ax < 10)then ax := 10; if(ay < 10)then ay := 10;
      end;

      if(ax < 10)then ax := 10; if(ay < 10)then ay := 10;
      Result := FindColorSpiralTolerance(ax, ay, tColor, ax - 10, ay - 10, ax + 10, ay + 10, 5);
      if(not Result)then
        DebugMe('We lost the color while updating it', 2);
    end;

    //------------------------------------------------------------------------\\
    {      GetEmptyItemPosition2 - Returns first empty inv slot               ||
    \\------------------------------------------------------------------------//}


    function GetEmptyItemPosition2: Integer;
    begin
      if not(LoggedIn)then
        Exit;
      GameTab(4);
      for Result := 1 to 29 do
      begin
        if(Result = 29)then
        begin
          Result := -1;
          Exit;
        end else
          if(not ExistsItem(Result))then
            Break;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                 CheckLeveled - Did we go op a lvl ?                     ||
    \\------------------------------------------------------------------------//}


    function CheckLeveled: Boolean;
    var
      ax, ay: Integer;
    begin
      if(FindColorTolerance(ax, ay, 3303512, 57 - 5, 385 - 5, 57 + 5, 385 + 5, 15))and
        (FindColorTolerance(ax, ay, 16711680, 254 - 5, 441 - 5, 254 + 5, 441 + 5, 15))then
      begin
        Result := True;
        ClickToContinue;
      end;
    end;

    //------------------------------------------------------------------------\\
    {             WaitWhileWorking - Waits while chopping                     ||
    \\------------------------------------------------------------------------//}


    procedure WaitWhileWorking(ax, ay, tempSpot, tColor: Integer);
    var
      CutMark, CutMarkTotal, CutMarkTemp: Integer;
    begin
      CutMark := GetSystemTime;
      CutMarkTotal := GetSystemTime;
      CutMarkTemp := GetSystemTime;
      while (LoggedIn) do
      begin
        if(ax < 10)then
          ax := 10;
        if(ay < 10)then
          ay := 10;
        if(not FindColorSpiralTolerance(ax, ay, tColor, ax - 10, ay - 10, ax + 10, ay + 10, 5))then
        begin
          DebugMe('We lost the color while waiting', 2);
          Exit;
        end;
        if(TimeFromMark(CutMarkTemp) > 5 * 1000)then
        begin
          if(not SLFindMiddleOfTree(ax, ay, tColor))then
          begin
            DebugMe('Lost actual tree', 2);
            Exit;
          end;
          CutMarkTemp := GetSystemTime;
        end;
        if(TimeFromMark(CutMarkTotal) < 5 * 1000)then
        begin
          if(not SLFindHead)then
          begin
            DebugMe('Axe fucked', 2);
            Exit;
          end;
        end;
        Wait(10);
        if SLFindEnt(ax, ay, tColor) then
        begin
          PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wav');
          DebugMe('We got an ent while waiting', 2);
          Exit;
        end;
        Wait(10);
        if CheckLeveled then
        begin
          PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wav');
          DebugMe('We got a level', 2);
          CutMark := GetSystemTime;
        end;
        Wait(10);
        if FindFastRandoms then
        begin
          DebugMe('Found a random while waiting', 2);
          PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wav');
          Exit;
        end;
        Wait(50);
        if(TimeFromMark(CutMark) > MaxSecToWait * 1000)then
        begin
          DebugMe('No logs for '+IntToStr(MaxSecToWait)+' secs ', 2);
          Exit;
        end;
        if(TimeFromMark(CutMarkTotal) > 60 * 1000)then
        begin
          DebugMe('1 minute at the same tree, preventing logout', 1);
          Exit;
        end;
        if(FindFight)then
        begin
          PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wav');
          RunTo(RunDir, True);
          DebugMe('We got into a fight', 2);
          Exit;
        end;
        Wait(10);
        if ExistsItem(tempSpot) then
        begin
          CutMark := GetSystemTime;
          tempSpot := GetEmptyItemPosition2;
          if(tempSpot = -1)then
            Exit;
        end;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                   ChopTree - Main chopping procedure                    ||
    \\------------------------------------------------------------------------//}


    procedure ChopTree;
    var
     ax, ay, tempSpot, tColor: Integer;
    begin
      if LoggedIn then
      begin
        if FindTree2(ax, ay) then
        begin
          gWillowFailSafes := GetSystemTime;
          tColor := GetColor(ax, ay);
          if SLFindEnt(ax, ay, tColor) then
            Exit;
          if(Random(20) < 19)then
            Mouse(ax, ay, 3, 3, True)
          else
          begin
            Mouse(ax, ay, 3, 3, False);
            ChooseOption(ax, ay, 'own');
          end;
          if UpdateColor(ax, ay, tColor) then
          begin

            tempSpot := GetEmptyItemPosition2;
            if(tempSpot = -1)then
              Exit;
            if SLFindMiddleOfTree(ax, ay, tColor) then
            begin
              tColor := GetColor(ax, ay);
              WaitWhileWorking(ax, ay, tempSpot, tColor);
              gWillowFailSafes := GetSystemTime;
            end;
          end;
        end;
      end;
    end;

    //******_Setup stuff_******\\
    //------------------------------------------------------------------------\\
    {               CapitalizeLikeRs - Capitalises like RS does.              ||
    \\------------------------------------------------------------------------//}


    function CapitalizeLikeRs(RawString: string): string;
    begin
      Result := Capitalize(LowerCase(RawString));
    end;

    //------------------------------------------------------------------------\\
    {                    CheckNicks - Checks the set nick names.              ||
    \\------------------------------------------------------------------------//}


    procedure CheckNicks;
    var
      CorrectString: string;
      i: integer;
    begin
      for i := 0 to HowManyPlayers - 1 do
      begin
        if(Players[i].Nick <> LowerCase(Players[i].Nick))then
        begin
           mMemoBox.Lines.Add('--');
           mMemoBox.Lines.Add('ERROR : Please Uncapitalise your NickNames.');
           mMemoBox.Lines.Add('Error occured with player : ' + Players[i].Name);
           Exit;
        end;
        if(pos(' ', Players[i].Nick) > 0)then
        begin
           mMemoBox.Lines.Add('--');
           mMemoBox.Lines.Add('ERROR : Dont use spaces in your Nick.');
           mMemoBox.Lines.Add('Error occured with player : ' + Players[i].Name);
           Exit;
        end;
        CorrectString := CapitalizeLikeRs(Players[i].Name);
        if not(Pos(LowerCase(Players[i].Nick), CorrectString) > 0)then
        begin
          mMemoBox.Lines.Add('--');
          mMemoBox.Lines.Add('ERROR : Nick does NOT match the name.');
          mMemoBox.Lines.Add('Nick : ' + Players[i].Nick + ', does NOT match ' + Players[i].Name);
          mMemoBox.Lines.Add('Nick should be 3-4 letters of ' + Players[i].Name);
          mMemoBox.Lines.Add('No capitalised letters though, be carefull!');
          Break;
        end;
      end;
    end;

    //------------------------------------------------------------------------\\
    {                Signature - To prove its ours, muhaha.                   ||
    \\------------------------------------------------------------------------//}


    procedure Signature;
    begin
      ChangeReportWidth(220);
      Writeln('  ______ __                     __       _');
      Writeln(' /  ___/|  |   _____ __________|__|_____/ |_  _____');
      Writeln(' \__  \ |  |  / ___// ___\_ __ \  \___ \  __\/  __/');
      Writeln(' /     \|  |__\__  \  \___| | \/  | |_> > |  \__  \');
      Writeln('/____  /|_____/__  >\___  >_|  |__|  __/|_| /___  /');
      Writeln('     \/          \/     \/         |_|          \/');
      Writeln('   Bring you :');
      Writeln('             Port Sarim Willow Whacker');
    end;

    //------------------------------------------------------------------------\\
    {             TimeToSwitchPlayers - Time to switch the players ?          ||
    \\------------------------------------------------------------------------//}


    function TimeToSwitchPlayers: boolean;
    begin
      if(TimeFromMark(gPlayerTime) > MaxLoginTime * 1000 * 60 + gRanTime)then
      begin
        Result := True;
        WriteLn('Time is up');
      end;
    end;

    //------------------------------------------------------------------------\\
    {           SetupClient - Prepares the client for the script               ||
    \\------------------------------------------------------------------------//}


    procedure SetupClient;
    begin
      SetupSRL;
      ScriptID := '60';
      LoadChatArray;
      LoadBMPs;
      LoadDTMs;
      ClearDebug;
      ClearReport;
      ShowNormalForm;
      Wait(1000 + Random(500));
      if(UsePlayerForm)then
      begin
        StartPlayers(false, 'string1');
      end else
        DeclarePlayers;
      for x := 0 to HowManyPlayers - 1 do
        Players[x].String2 := 'bank';
      CurrentPlayer := StartPlayer;
      BenMouse := False;
      ActivateClient;
      Wait(1000);
    end;

    //------------------------------------------------------------------------\\
    {                SetupUser - Sets the current player ready                ||
    \\------------------------------------------------------------------------//}


    procedure SetupUser;
    begin
      gWillowFailSafes := GetSystemTime;
      PinNumber := Players[CurrentPlayer].String1;
      MouseSpeed := gMouseSpeed + Random(5);
      LoginPlayer;
      repeat
        Wait(100);
      until(not IsLoading);
      Wait(3000 + Random(1000));
      Players[CurrentPlayer].Level[20] := GetSkillLevel('woodcutting');
      WriteLn('Current woodcutting lvl: ' + IntToStr(Players[CurrentPlayer].Level[20]));
      if(not SLFindAxeHeadColor)then
      begin
        SLBank(true);
        if (not SLFindAxeHeadColor) then
          PlayerLost('We didn''t have an axe');
      end;
      HighestAngle;
      SetChat('on', 1);
      SetChat('friends', 2);
      SetChat('on', 3);
      WaterSymbolColor := GetSymbolColor(x, y, 'water');
      if(not WaterSymbolColor = 0)then
        WriteLn('WaterSymbolColor = ' + IntToStr(WaterSymbolColor))
      else
      begin
        WaterSymbolColor := 14772023;
        WriteLn('Couldn''t find watersymbolcolor - setting from default');
      end;
      MarkTime(gPlayerTime);
      SetRun(false);
      LadderColor := 0;
      FarmingColor := 0;
      QuestColor := 0;
      RoadColor := 0;
      BankColor := 0;
    end;

    //******_Main Loop_******\\
    //------------------------------------------------------------------------\\
    {                          Main line - Its magic.                         ||
    \\------------------------------------------------------------------------//}


    begin
      SetupClient;
      repeat
        SetupUser;
        repeat
          LadderColor := MMLadder;
          ActivateClient;

          if(Players[CurrentPlayer].String2 = 'bank')and
          (LoggedIn)then
          begin
            if(InvCount = 0)and
              (not gBrokenAxe)then
            else
              SLBank(gBrokenAxe);
            BankToWillows;
            gWillowFailSafes := GetSystemTime;
          end;

          if(Players[CurrentPlayer].String2 = 'willows')and
          (LoggedIn)then
          begin
            repeat
              MakeCompass('E');
              Wait(16);
              ChopTree;
              Wait(16);
              FindFastRandoms;
              Wait(16);
              FindBirdsNest;
              Wait(16);
              if(FindFight)then
                RunTo(RunDir, True);
              Wait(16);
              if FindNewBox then
                SolveBox;
              if(1 * 30 * 1000 < GetSystemTime - gWillowFailSafes)then
              begin
                WriteLn('Relocating');
                RelocateAtWillows;
              end;
              if(1 * 60 * 1000 < GetSystemTime - gWillowFailSafes)then
              begin
                WriteLn('We didn''t find any willows');
                LogOut;
                Break;
              end;
              until(TimeToSwitchPlayers)or(InvCount = 28)or
                   (not LoggedIn)or(gBrokenAxe);
              WillowsToBank;
          end;

        until(TimeToSwitchPlayers)or(not LoggedIn);

        PlayerStatus := LoggedIn;
        LogOut;
        NextPlayer(PlayerStatus);
      until(false);
    end.

  14. #14
    Join Date
    May 2007
    Posts
    127
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    good work on your script
    you attempt to light a fire, you light the fire, you place the raw shrimp on the fire, you accidentally burn the shrimp. DAMMIT!

    Evil Walrus's will control the world someday...

  15. #15
    Join Date
    Aug 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    look all i wont is a auto wcer,fishing.flaxer.miner something to make me some cash now can someone send me a message to lil_protto@hotmail.com plz

  16. #16
    Join Date
    Jun 2007
    Location
    England
    Posts
    262
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Scar isn't a money making program. As Fawki once said our objective is to " beat the game"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •