Need help with this Script

Discussion in 'Scar/Simba Help' started by IllusionNZ, Nov 9, 2008.

Need help with this Script
  1. Unread #1 - Nov 9, 2008 at 3:13 AM
  2. IllusionNZ
    Referrals:
    0

    IllusionNZ Guest

    Need help with this Script

    Here it is it says: Line 1: [Error] (1:1): Unable to register function function FindGapsTPA(TPA : TPointArray; MinPixels: Integer): T2DPointArray; in script C:\Users\Rupert\Desktop\Flaxer + Spinner (None).scar
    Failed when compiling


    And here the script please fix it?

    Thanks alot scar is running on SCAR Divi 3.12 i dunno if that makes a diffrence heres the script...


    program FlaxPicker;
    {.include SRL\SRL.scar}

    var
    x, y, h, j, NewLoads, MMTree, MMFlax, FlaxColor, MSLadder, AmtBee: integer;

    var
    cUser: Integer;
    frmDesign: TForm;
    Title, Label1, Label2, Label4, Label5, aString1, aString2, aNeeded, lblUser, aFlax1,
    aSRLID, aSRLPass, aMSLadder, aPin, aDebug: TLabel;
    gbControl: TGroupBox;
    CloseOther, MoreSettings, StartButton, btnBack, btnNext, btnCreate, btnDelete:
    TButton;
    edFlax1, edMSLadder, edUser, edPass, edNick, edString1,
    edSRLID, edSRLPass, edString2, edPin: TEdit;
    cbActive, cbDebug: TComboBox;
    StartScript: Boolean;

    //-----------------------------------------------//

    procedure AddUser;
    begin
    SetArrayLength(Players, GetArrayLength(Players) + 1);
    Players[GetArrayLength(Players) - 1].Name := 'New Name';
    Players[GetArrayLength(Players) - 1].Pass := 'New Pass';
    Players[GetArrayLength(Players) - 1].Nick := 'New Nick';
    Players[GetArrayLength(Players) - 1].Active := True;
    Players[GetArrayLength(Players) - 1].Strings[1] := 'New # Loads';
    Players[GetArrayLength(Players) - 1].Strings[2] := 'New Job';
    end;

    //-----------------------------------------------//

    procedure LoadNewSettings;
    begin
    Players[cUser].Nick := edNick.Text;
    Players[cUser].Name := edUser.Text;
    Players[cUser].Pass := edPass.Text;
    Players[cUser].Strings[1] := edString1.Text;
    Players[cUser].Strings[2] := edString2.Text;
    if (cbActive.Text = 'True') then
    Players[cUser].Active := True
    else
    Players[cUser].Active := False;
    Players[cUser].Strings[3] := edPin.Text;
    FlaxColor := StrToInt(edFlax1.Text);
    MSLadder := StrToInt(edMSLadder.Text);
    if (not (edSRLID.Text = '')) then
    SRLID := edSRLID.Text;
    if (not (edSRLPass.Text = '')) then
    SRLPassword := edSRLPass.Text;
    if (cbDebug.Text = 'All') then
    Players[cUser].Booleans[1] := True
    else
    Players[cUser].Booleans[1] := False;
    end;

    //-----------------------------------------------//

    procedure SaveNewSettings(Sender: TObject);
    begin
    lblUser.Caption := 'Current User: '+IntToStr(cUser);
    edString1.Text := Players[cUser].Strings[1];
    edString2.Text := Players[cUser].Strings[2];
    edNick.Text := Players[cUser].Nick;
    edUser.Text := Players[cUser].Name;
    edPass.Text := Players[cUser].Pass;
    if (Players[cUser].Active) then
    cbActive.Text := 'True'
    else
    cbActive.Text := 'False';
    edFlax1.Text := IntToStr(FlaxColor);
    edMSLadder.Text := IntToStr(MSLadder);
    edPin.Text := Players[cUser].Strings[3];
    edSRLID.Text := SRLID;
    edSRLPass.Text := SRLPassword;
    if (Players[cUser].Booleans[1]) then
    cbDebug.Text := 'All'
    else
    cbDebug.Text := 'Proggies';
    end;

    //-----------------------------------------------//

    procedure CreateUser(Sender: TObject);
    begin
    LoadNewSettings;
    AddUser;
    cUser := GetArrayLength(Players) - 1;
    SaveNewSettings(Sender);
    end;

    //-----------------------------------------------//

    procedure ForwardUser(Sender: TObject);
    begin
    LoadNewSettings;
    if (cUser + 1 > GetArrayLength(Players) - 1) then
    cUser := 0
    else
    cUser := cUser + 1;
    SaveNewSettings(Sender);
    end;

    //-----------------------------------------------//

    procedure BackUser(Sender: TObject);
    begin
    LoadNewSettings;
    if (cUser - 1 < 0) then
    cUser := GetArrayLength(Players) - 1
    else
    cUser := cUser - 1;
    SaveNewSettings(Sender);
    end;

    //-----------------------------------------------//

    procedure DeleteUser(Sender: TObject);
    var
    lo, na, ni, bs: string;
    ac: Boolean;
    begin
    lo := Players[GetArrayLength(Players) - 1].Strings[1];
    bs := Players[GetArrayLength(Players) - 1].Strings[2];
    na := Players[GetArrayLength(Players) - 1].Name;
    ni := Players[GetArrayLength(Players) - 1].Nick;
    ac := Players[GetArrayLength(Players) - 1].Active;
    Players[cUser].Strings[1] := lo;
    Players[cUser].Strings[2] := bs;
    Players[cUser].Name := na;
    Players[cUser].Nick := ni;
    Players[cUser].Active := ac;
    SetArrayLength(Players, GetArrayLength(Players) - 1);
    if (cUser + 1 > GetArrayLength(Players) - 1) then
    cUser := 0
    else
    cUser := cUser + 1;
    SaveNewSettings(Sender);
    end;

    //-----------------------------------------------//

    procedure SaveUs1;
    var
    f, CharsFile: Integer;
    begin
    if (filename = '') then filename := 'chars'
    CharsFile := RewriteFile(AppPath + FileName + '.dat', False)
    for f := 0 to GetArrayLength(players) - 1 do
    begin
    WriteFileString(charsfile, 'name' + IntToStr(f) + '=' + players[f].name +
    Chr(13))
    WriteFileString(charsfile, 'pass' + IntToStr(f) + '=' + players[f].pass
    + Chr(13))
    WriteFileString(charsfile, 'nick' + IntToStr(f) + '=' + players[f].nick
    + Chr(13))
    WriteFileString(charsfile, 'string1' + IntToStr(f) + '=' +
    players[f].Strings[1]
    + Chr(13))
    WriteFileString(charsfile, 'active' + IntToStr(f) + '=' +
    BoolToStr(players[f].active) + Chr(13))
    WriteFileString(charsfile, 'boolean1' + IntToStr(f) + '=' +
    BoolToStr(players[f].booleans[1]) + Chr(13))
    WriteFileString(charsfile, 'string2' + IntToStr(f) + '=' +
    players[f].Strings[2] + Chr(13))
    WriteFileString(charsfile, 'string3' + IntToStr(f) + '=' +
    players[f].Strings[3] + Chr(13))
    WriteFileString(CharsFile, 'flaxcolor' + IntToStr(f) + '=' +
    IntToStr(FlaxColor) + Chr(13))
    WriteFileString(CharsFile, 'msladder' + IntToStr(f) + '=' +
    IntToStr(MSLadder) + Chr(13))
    WriteFileString(CharsFile, 'srlid' + IntToStr(f) + '=' +
    SRLID + Chr(13))
    WriteFileString(CharsFile, 'srlpassword' + IntToStr(f) + '=' +
    SRLPassword + Chr(13))
    end;
    CloseFile(charsfile)
    end;

    //-----------------------------------------------//

    function CountPlayers(CharsStr: string): Integer;
    var
    f: Integer;
    FailSafe: LongInt;
    begin
    FailSafe := GetSystemTime; //can't be too careful
    repeat
    if (Pos('pass' + IntToStr(f) + '=', CharsStr) = 0) then
    begin
    Result := f;
    Break;
    end
    f := f + 1
    until (GetSystemTime - FailSafe > 10000);
    end;

    procedure LoadUs1;
    var
    f, CharsFile, temp: Integer;
    CharsFileString: string;
    begin
    if (filename = '') then filename := 'chars';
    CharsFile := OpenFile(AppPath + filename + '.dat', False)
    if (CharsFile < 0) then
    begin
    SaveUs1
    CharsFile := OpenFile(AppPath + filename + '.dat', False)
    if (CharsFile < 0) then
    begin
    WriteLn('Error Loading Chars');
    Exit;
    end
    end
    ReadFileString(CharsFile, CharsFileString, FileSize(CharsFile))
    CloseFile(CharsFile)
    Temp := CountPlayers(CharsFileString);
    If (Temp <= 0) then Temp:= 1;
    SetArrayLength(players, Temp);
    HowManyPlayers := GetArrayLength(players);
    NumberOfPlayers(HowManyPlayers);
    for f := 0 to GetArrayLength(players) - 1 do
    begin
    players[f].Name := Between('name' + IntToStr(f) + '=', chr(13), CharsFileString);
    players[f].Pass := Between('pass' + IntToStr(f) + '=', chr(13), CharsFileString);
    players[f].Nick := Between('nick' + IntToStr(f) + '=', chr(13), CharsFileString);
    players[f].Active := StrToBoolDef(Between('active' + IntToStr(f) + '=', chr(13), CharsFileString), True);
    players[f].Booleans[0] := StrToBoolDef(Between('boolean1' + IntToStr(f) + '=', chr(13), CharsFileString), True);
    players[f].Strings[1] := Between('string1' + IntToStr(f) + '=', chr(13), CharsFileString);
    players[f].Strings[2] := Between('string2' + IntToStr(f) + '=', chr(13), CharsFileString);
    players[f].Strings[3] := Between('string3' + IntToStr(f) + '=', chr(13), CharsFileString);
    FlaxColor := StrToIntDef(Between('flaxcolor' + IntToStr(f) + '=', chr(13), CharsFileString), 0);
    MSLadder := StrToIntDef(Between('msladder' + IntToStr(f) + '=', chr(13), CharsFileString), 0);
    SRLID := Between('srlid' + IntToStr(f) + '=', chr(13), CharsFileString);
    SRLPassword := Between('srlpassword' + IntToStr(f) + '=', chr(13), CharsFileString);
    end
    CloseFile(CharsFile);
    end;

    //-----------------------------------------------//

    procedure FormClose2(sender: TObject; var CanClose: Boolean);
    begin
    LoadNewSettings;
    HowManyPlayers := GetArrayLength(players)
    NumberOfPlayers(HowManyPlayers);
    CanClose := True
    end;

    //-----------------------------------------------//

    procedure Clicked(Sender: TObject); forward;

    //-----------------------------------------------//

    procedure ChangeToExtra;
    begin
    aSRLID.Visible := True;
    aSRLPass.Visible := True;
    edSRLID.Visible := True;
    edSRLPass.Visible := True;
    aDebug.Visible := True;
    cbDebug.Visible := True;
    aPin.Visible := True;
    edPin.Visible := True;
    aFlax1.Visible := True;
    aMSLadder.Visible := True;
    edFlax1.Visible := True;
    edMSLadder.Visible := True;
    CloseOther.Visible := True;
    Label1.Visible := False;
    Label2.Visible := False;
    Label4.Visible := False;
    Label5.Visible := False;
    aString1.Visible := False;
    aString2.Visible := False;
    aNeeded.Visible := False;
    lblUser.Visible := False;
    StartButton.Visible := False;
    gbControl.Visible := False;
    btnBack.Visible := False;
    btnNext.Visible := False;
    btnCreate.Visible := False;
    btnDelete.Visible := False;
    edUser.Visible := False;
    edPass.Visible := False;
    edString1.Visible := False;
    edString2.Visible := False;
    edNick.Visible := False;
    cbActive.Visible := False;
    MoreSettings.Visible := False;
    end;

    //-----------------------------------------------//

    procedure ChangeFromExtra;
    begin
    aSRLID.Visible := False;
    aSRLPass.Visible := False;
    edSRLID.Visible := False;
    edSRLPass.Visible := False;
    aDebug.Visible := False;
    cbDebug.Visible := False;
    aPin.Visible := False;
    edPin.Visible := False;
    aFlax1.Visible := False;
    aMSLadder.Visible := False;
    edFlax1.Visible := False;
    edMSLadder.Visible := False;
    CloseOther.Visible := False;
    Label1.Visible := True;
    Label2.Visible := True;
    Label4.Visible := True;
    Label5.Visible := True;
    aString1.Visible := True;
    aString2.Visible := True;
    aNeeded.Visible := True;
    lblUser.Visible := True;
    StartButton.Visible := True;
    gbControl.Visible := True;
    btnBack.Visible := True;
    btnNext.Visible := True;
    btnCreate.Visible := True;
    btnDelete.Visible := True;
    edUser.Visible := True;
    edPass.Visible := True;
    edString1.Visible := True;
    edString2.Visible := True;
    edNick.Visible := True;
    cbActive.Visible := True;
    MoreSettings.Visible := True;
    end;

    procedure MouseMove(Sender:TObject; Shift:TShiftState; x,y:integer);
    var
    p: Integer;
    begin
    Wait(1);
    Case Random(20) of
    0: p := clRed;
    1: p := clBlue;
    2: p := clPurple;
    3: p := clLightBlue;
    4: p := clGreen;
    5: p := clSkyBlue;
    6: p := 12632256;
    7: p := clBlack;
    8: p := 32768;
    9: p := clWhite;
    10: p := 14898176;
    11: p := 39423;
    12: p := 255;
    13: p := 13421670;
    14: p := 16777093;
    15: p := 2531790;
    16: p := 7591562;
    17: p := 8443349;
    18: p := 11482328;
    19: p := 33023;
    end;
    Title.Font.Color := p;
    end;

    //-----------------------------------------------//

    procedure LoadForm;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 275;
    frmDesign.Top := 122;
    frmDesign.Width := 395;
    frmDesign.Height := 310;
    frmDesign.BorderStyle := bsNone;
    frmDesign.Caption := 'User Setup';
    frmDesign.Visible := False;
    frmDesign.PixelsPerInch := 96;
    frmDesign.Color := clBlack;
    frmDesign.OnMouseMove := @MouseMove;
    frmDesign.OnShow := @SaveNewSettings;
    frmDesign.OnCloseQuery := @FormClose2;
    Title := TLabel.Create(frmDesign);
    Title.Parent := frmDesign;
    Title.Left := 48;
    Title.Top := 33;
    Title.Width := 250;
    Title.Height := 250;
    Title.Font.Size := 26;
    Title.Caption := 'Towns Flaxer + Spinner';
    Title.Transparent := True;
    Label1 := TLabel.Create(frmDesign);
    Label1.Parent := frmDesign;
    Label1.Left := 48;
    Label1.Top := 25;
    Label1.Width := 51;
    Label1.Height := 13;
    Label1.Font.Color := clRed;
    Label1.Caption := 'Username:';
    Label2 := TLabel.Create(frmDesign);
    Label2.Parent := frmDesign;
    Label2.Left := 48;
    Label2.Top := 50;
    Label2.Width := 49;
    Label2.Height := 13;
    Label2.Font.Color := clRed;
    Label2.Caption := 'Password:';
    Label4 := TLabel.Create(frmDesign);
    Label4.Parent := frmDesign;
    Label4.Left := 48;
    Label4.Top := 75;
    Label4.Width := 25;
    Label4.Height := 13;
    Label4.Font.Color := clRed;
    Label4.Caption := 'Nick:';
    Label5 := TLabel.Create(frmDesign);
    Label5.Parent := frmDesign;
    Label5.Left := 48;
    Label5.Top := 100;
    Label5.Width := 33;
    Label5.Height := 13;
    Label5.Font.Color := clRed;
    Label5.Caption := 'Active:';
    aString1 := TLabel.Create(frmDesign);
    aString1.Parent := frmDesign;
    aString1.Left := 48;
    aString1.Top := 125;
    aString1.Width := 33;
    aString1.Height := 13;
    aString1.Caption := 'Loads:';
    aString1.Font.Color := clRed;
    aString2 := TLabel.Create(frmDesign);
    aString2.Parent := frmDesign;
    aString2.Left := 48;
    aString2.Top := 150;
    aString2.Width := 33;
    aString2.Height := 13;
    aString2.Caption := 'Flax, Spin, :';
    aString2.Font.Color := clRed;
    aNeeded := TLabel.Create(frmDesign);
    aNeeded.Parent := frmDesign;
    aNeeded.Left := 48
    aNeeded.Top := 160;
    aNeeded.Width := 33;
    aNeeded.Height := 13;
    aNeeded.Caption := 'or Both';
    aNeeded.Font.Color := clRed;
    aSRLID := TLabel.Create(frmDesign);
    aSRLID.Parent := frmDesign;
    aSRLID.Left := 215;
    aSRLID.Top := 15;
    aSRLID.Width := 80;
    aSRLID.Height := 13;
    aSRLID.Caption := 'SRLID';
    aSRLID.Font.Color := clRed;
    aSRLPass := TLabel.Create(frmDesign);
    aSRLPass.Parent := frmDesign;
    aSRLPass.Left := 215;
    aSRLPass.Top := 75;
    aSRLPass.Width := 80;
    aSRLPass.Height := 13;
    aSRLPass.Caption := 'SRLIDPass';
    aSRLPass.Font.Color := clRed;
    lblUser := TLabel.Create(frmDesign);
    lblUser.Parent := frmDesign;
    lblUser.Left := 45;
    lblUser.Top := 9;
    lblUser.Width := 32;
    lblUser.Height := 13;
    lblUser.Caption := 'Current User: lblUser';
    lblUser.Font.Color := clRed;
    lblUser.Transparent := False;
    StartButton := TButton.Create(frmDesign);
    StartButton.Parent := frmDesign;
    StartButton.Left := 177;
    StartButton.Top := 180;
    StartButton.Width := 75;
    StartButton.Height := 25;
    StartButton.Hint := 'Click to Start the Script';
    StartButton.Caption := 'Start Script';
    StartButton.ParentShowHint := False;
    StartButton.ShowHint := True;
    StartButton.TabOrder := 6;
    StartButton.OnClick := @Clicked;
    gbControl := TGroupBox.Create(frmDesign);
    gbControl.Parent := frmDesign;
    gbControl.Left := 13;
    gbControl.Top := 211;
    gbControl.Width := 272;
    gbControl.Height := 58;
    gbControl.Caption := ' Control ';
    gbControl.TabOrder := 0;
    btnBack := TButton.Create(gbControl);
    btnBack.Parent := gbControl;
    btnBack.Left := 12;
    btnBack.Top := 22;
    btnBack.Width := 45;
    btnBack.Height := 25;
    btnBack.Caption := '<';
    btnBack.TabOrder := 0;
    btnBack.OnClick := @BackUser;
    btnNext := TButton.Create(gbControl);
    btnNext.Parent := gbControl;
    btnNext.Left := 216;
    btnNext.Top := 23;
    btnNext.Width := 45;
    btnNext.Height := 25;
    btnNext.Caption := '>';
    btnNext.TabOrder := 1;
    btnNext.OnClick := @ForwardUser;
    btnCreate := TButton.Create(gbControl);
    btnCreate.Parent := gbControl;
    btnCreate.Left := 138;
    btnCreate.Top := 22;
    btnCreate.Width := 75;
    btnCreate.Height := 25;
    btnCreate.Caption := 'Create';
    btnCreate.TabOrder := 2;
    btnCreate.OnClick := @CreateUser;
    btnDelete := TButton.Create(gbControl);
    btnDelete.Parent := gbControl;
    btnDelete.Left := 59;
    btnDelete.Top := 22;
    btnDelete.Width := 75;
    btnDelete.Height := 25;
    btnDelete.Caption := 'Delete';
    btnDelete.OnClick := @DeleteUser;
    btnDelete.TabOrder := 3;
    edUser := TEdit.Create(frmDesign);
    edUser.Parent := frmDesign;
    edUser.Left := 110;
    edUser.Top := 25;
    edUser.Width := 121;
    edUser.Height := 21;
    edUser.TabOrder := 9;
    edUser.Text := 'edUser';
    edPass := TEdit.Create(frmDesign);
    edPass.Parent := frmDesign;
    edPass.Left := 110;
    edPass.Top := 50;
    edPass.Width := 121;
    edPass.Height := 21;
    edPass.TabOrder := 10;
    edPass.Text := 'edPass';
    edString1 := TEdit.Create(frmDesign);
    edString1.Parent := frmDesign;
    edString1.Left := 110;
    edString1.Top := 125;
    edString1.Width := 121;
    edString1.Height := 21;
    edString1.TabOrder := 11;
    edString1.Text := 'edInteger1';
    edString2 := TEdit.Create(frmDesign);
    edString2.Parent := frmDesign;
    edString2.Left := 110;
    edString2.Top := 150;
    edString2.Width := 121;
    edString2.Height := 21;
    edString2.TabOrder := 12;
    edString2.Text := 'edInteger2';
    edNick := TEdit.Create(frmDesign);
    edNick.Parent := frmDesign;
    edNick.Left := 110;
    edNick.Top := 75;
    edNick.Width := 121;
    edNick.Height := 21;
    edNick.TabOrder := 13;
    edNick.Text := 'edNick';
    cbActive := TComboBox.Create(frmDesign);
    cbActive.Parent := frmDesign;
    cbActive.Left := 110;
    cbActive.Top := 100;
    cbActive.Width := 122;
    cbActive.Height := 21;
    cbActive.DropDownCount := 2;
    cbActive.ItemHeight := 13;
    cbActive.TabOrder := 14;
    cbActive.Text := 'True';
    cbActive.Items.Add('True');
    cbActive.Items.Add('False');
    MoreSettings := TButton.Create(frmDesign);
    MoreSettings.Parent := frmDesign;
    MoreSettings.Left := 75;
    MoreSettings.Top := 180;
    MoreSettings.Width := 75;
    MoreSettings.Height := 25;
    MoreSettings.Caption := 'More Settings';
    MoreSettings.TabOrder := 15;
    MoreSettings.OnClick := @Clicked;
    aFlax1 := TLabel.Create(frmDesign);
    aFlax1.Parent := frmDesign;
    aFlax1.Left := 18;
    aFlax1.Top := 15;
    aFlax1.Width := 74;
    aFlax1.Height := 13;
    aFlax1.Hint := 'Ctrl + Alt + P To Pick A Color';
    aFlax1.Caption := 'Flax Color 1';
    aFlax1.Font.Color := clRed;
    aMSLadder := TLabel.Create(frmDesign);
    aMSLadder.Parent := frmDesign;
    aMSLadder.Left := 18;
    aMSLadder.Top := 75;
    aMSLadder.Width := 80;
    aMSLadder.Height := 13;
    aMSLadder.Hint := 'Ctrl + Alt + P To Pick A Color';
    aMSLadder.Caption := 'MS Ladder Color';
    aMSLadder.Font.Color := clRed;
    aPin := TLabel.Create(frmDesign);
    aPin.Parent := frmDesign;
    aPin.Left := 18;
    aPin.Top := 95;
    aPin.Width := 80;
    aPin.Height := 13;
    aPin.Hint := 'Enter 0000 If You Dont Have A Pin';
    aPin.Caption := 'Have A Pin?';
    aPin.Font.Color := clRed;
    aDebug := TLabel.Create(frmDesign);
    aDebug.Parent := frmDesign;
    aDebug.Left := 18;
    aDebug.Top := 115;
    aDebug.Width := 80;
    aDebug.Height := 13;
    aDebug.Caption := 'How Much Debug Text?';
    aDebug.Font.Color := clRed;
    edFlax1 := TEdit.Create(frmDesign);
    edFlax1.Parent := frmDesign;
    edFlax1.Left := 85;
    edFlax1.Top := 15;
    edFlax1.Width := 75;
    edFlax1.Height := 21;
    edFlax1.TabOrder := 11;
    edFlax1.Text := '';
    edMSLadder := TEdit.Create(frmDesign);
    edMSLadder.Parent := frmDesign;
    edMSLadder.Left := 105;
    edMSLadder.Top := 75;
    edMSLadder.Width := 75;
    edMSLadder.Height := 21;
    edMSLadder.TabOrder := 13;
    edPin := TEdit.Create(frmDesign);
    edPin.Parent := frmDesign;
    edPin.Left := 105;
    edPin.Top := 95;
    edPin.Width := 75;
    edPin.Height := 21;
    edPin.TabOrder := 14;
    edSRLID := TEdit.Create(frmDesign);
    edSRLID.Parent := frmDesign;
    edSRLID.Left := 285;
    edSRLID.Top := 15;
    edSRLID.Width := 75;
    edSRLID.Height := 21;
    edSRLID.TabOrder := 17;
    edSRLPass := TEdit.Create(frmDesign);
    edSRLPass.Parent := frmDesign;
    edSRLPass.Left := 285;
    edSRLPass.Top := 85;
    edSRLPass.Width := 75;
    edSRLPass.Height := 21;
    edSRLPass.TabOrder := 18;
    cbDebug := TComboBox.Create(frmDesign);
    cbDebug.Parent := frmDesign;
    cbDebug.Left := 175;
    cbDebug.Top := 115;
    cbDebug.Width := 75;
    cbDebug.Height := 21;
    cbDebug.TabOrder := 15;
    cbDebug.Text := 'Proggies';
    cbDebug.Items.Add('Proggies');
    cbDebug.Items.Add('All');
    CloseOther := TButton.Create(frmDesign);
    CloseOther.Parent := frmDesign;
    CloseOther.Left := 177;
    CloseOther.Top := 180;
    CloseOther.Width := 175;
    CloseOther.Height := 25;
    CloseOther.Hint := 'Click to Go Back To User Manager';
    CloseOther.Caption := 'Back To User Page';
    CloseOther.ParentShowHint := False;
    CloseOther.ShowHint := True;
    CloseOther.TabOrder := 16;
    CloseOther.OnClick := @Clicked;
    end;

    //-----------------------------------------------//

    procedure Clicked(Sender: TObject);
    var
    v: TVariantArray;
    begin
    case Sender of
    StartButton:
    begin
    SetArrayLength(V, 0);
    frmDesign.ModalResult := mrOk;
    StartScript := True;
    end;
    MoreSettings:
    ChangeToExtra;
    CloseOther:
    ChangeFromExtra;
    end;
    end;

    //-----------------------------------------------//

    procedure TheForm;
    var
    v: TVariantArray;
    begin
    SetArrayLength(V, 0);
    ThreadSafeCall('LoadForm', v);
    end;

    //-----------------------------------------------//

    procedure ShowFormModal;
    begin
    frmDesign.ShowModal;
    end;

    //-----------------------------------------------//

    procedure TehForm;
    var
    v: TVariantArray;
    begin
    SetArrayLength(V, 0);
    ThreadSafeCall('ShowFormModal', v);
    end;

    //-----------------------------------------------//

    var
    Bee: Array[0..3] of Integer;
    BoxArray: TBoxArray;
    Done: Array[0..3] of Boolean;

    procedure DeclareDTMs;
    begin
    Bee[3] := DTMFromString('78DA63DCC6C0C0709D0105AC5DB890811F483' +
    '302F17F20603C0F64BC4555B36CF62CB81A10609C0324DEA1AA59' +
    '3C633AAA9A2940E226AA9A6DAB57A1AAB90C246EA1AA99DCD989A' +
    '20600DCDF158B');
    Bee[2] := DTMFromString('78DA6364666460F8C08002440405192481345' +
    '086E13F10303E07321EA2AAD9B369135C0D0830CA02590F50D5AC' +
    '9C3B17558D2290F50555CDCCFE3E54354F1830D4EC58BB16450D0' +
    '045CA132D');
    Bee[1] := DTMFromString('78DA6364656460B8C48002766FDCC8C00FA48' +
    '1320CFF8180F12590710C55CDA15D3BE16A4080F10990B883AAE6' +
    'E89E3DA86A9480ACE3A86A56CD9B8BAA460DC8BA8BAA66D6847E5' +
    '435FF31EDDAB96E2DAA1A5E4CBBB6AC5A89A2060093191BA1');
    Bee[0] := DTMFromString('78DA639CCDC0C0708701055CBF7491811F483' +
    '302F17F2060AC05329EA3AA7970FB365C0D0830760289CBA86A9E' +
    '3F7982AA662690388DAAE6C2C993A86AD600896BA86AF66DD982A' +
    'A662BA67B56CF9F8FAA660E90788DAA66D7860D286A0066D81EFE' +
    '');
    SetArrayLength(BoxArray, 11);
    BoxArray[0].x1 := 0;
    BoxArray[0].y1 := 0;
    BoxArray[0].x2 := 26;
    BoxArray[0].y2 := 338;
    BoxArray[1].x1 := 0;
    BoxArray[1].y1 := 0;
    BoxArray[1].x2 := 515;
    BoxArray[1].y2 := 50;
    BoxArray[2].x1 := 495;
    BoxArray[2].y1 := 31;
    BoxArray[2].x2 := 516;
    BoxArray[2].y2 := 338;
    BoxArray[3].x1 := 19;
    BoxArray[3].y1 := 304;
    BoxArray[3].x2 := 515;
    BoxArray[3].y2 := 337;
    BoxArray[4].x1 := 86;
    BoxArray[4].y1 := 226;
    BoxArray[4].x2 := 516;
    BoxArray[4].y2 := 304;
    BoxArray[5].x1 := 179;
    BoxArray[5].y1 := 28;
    BoxArray[5].x2 := 193;
    BoxArray[5].y2 := 226;
    BoxArray[6].x1 := 325;
    BoxArray[6].y1 := 27;
    BoxArray[6].x2 := 340;
    BoxArray[6].y2 := 226;
    BoxArray[7].x1 := 191;
    BoxArray[7].y1 := 71;
    BoxArray[7].x2 := 326;
    BoxArray[7].y2 := 77;
    BoxArray[8].x1 := 191;
    BoxArray[8].y1 := 123;
    BoxArray[8].x2 := 325;
    BoxArray[8].y2 := 131;
    BoxArray[9].x1 := 191;
    BoxArray[9].y1 := 174;
    BoxArray[9].x2 := 325;
    BoxArray[9].y2 := 185;
    BoxArray[10].x1 := 426;
    BoxArray[10].y1 := 192;
    BoxArray[10].x2 := 516;
    BoxArray[10].y2 := 338;
    end;

    function ConvertTPAToBox(TPA: TPointArray): TBoxArray;
    var
    i: Integer;
    begin
    SetArrayLength(Result, GetArrayLength(TPA));
    for i := 0 to GetArrayLength(TPA) - 1 do
    begin
    Result.X1 := TPA.x - 1; Result.X2 := TPA.x + 1;
    Result.Y1 := TPA.y - 1; Result.Y1 := TPA.y + 1;
    end;
    end;

    function AddBoxArray(Box1, Box2: TBoxArray): TBoxArray;
    var
    i: Integer;
    begin
    SetArrayLength(Result, GetArrayLength(Box1));
    for i := 0 to GetArrayLength(Box2) - 1 do
    begin
    SetArrayLength(Result, GetArrayLength(Result) + 1);
    Result[GetArrayLength(Result) - 1].X1 := Box2.X1;
    Result[GetArrayLength(Result) - 1].X2 := Box2.X2;
    Result[GetArrayLength(Result) - 1].Y1 := Box2.Y1;
    Result[GetArrayLength(Result) - 1].Y2 := Box2.Y2;
    end;
    end;

    procedure TalkTo; // Talks to Bee Keeper
    var
    Points: TPointArray;
    i: Integer;
    PointBox: TBoxArray;
    begin
    if (not (LoggedIn)) then Exit;
    FindColorsTolerance(Points, 10329514, MSX1, MSY1, MSX2, MSY2, 30);
    PointBox := ConvertTPAToBox(Points);
    BoxArray := AddBoxArray(PointBox, BoxArray);
    FindColorsTolerance(Points, 5000274, MSCX + 20, MSCY - 35, MSCX + 65, MSCY + 35, 25);
    if (GetArrayLength(Points) = 0) then Logout;
    if (not (LoggedIn)) then Exit;
    for i := 0 to GetArrayLength(Points) - 1 do
    begin
    MMouse(Points.x, Points.y, 2, 2);
    Wait(250 + Random(450));
    if (IsUpText('alk')) then Break;
    if (i = GetArrayLength(Points) - 1) then
    begin
    Logout;
    Exit;
    end;
    end;
    GetMousePos(x, y);
    Mouse(x, y, 2, 2, true);
    MarkTime(i);
    repeat
    if (ClickToContinue) then MarkTime(i);
    Wait(1000 + Random(1000));
    until (TimeFromMark(i) > 8000);
    end;

    procedure MovePiece(Num: Integer);
    begin
    case Num of
    1: MouseBox(138, 279, 159, 292, 1);
    2: MouseBox(191, 268, 209, 284, 1);
    3: MouseBox(303, 281, 328, 288, 1);
    4: MouseBox(357, 283, 380, 289, 1);
    end;
    end;

    procedure MoveToCorner(Num: Integer); // Moves each piece to the corner so they aren't overlapping
    var
    p, i: Integer;
    begin
    if (not (LoggedIn)) then Exit;
    case Num of
    1: begin
    repeat
    MovePiece(1);
    for i := 0 to 4 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, MSX1, MSY1, MSX2, 80)) then Break;
    end;
    until (FindDTM(Bee[Num - 1], x, y, MSX1, MSY1, MSX2, 80));
    repeat
    MovePiece(3);
    for i := 0 to 4 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, MSX1, MSY1, 100, 80)) then
    begin
    Done[0] := True;
    Exit;
    end;
    end;
    until (FindDTM(Bee[Num - 1], x, y, MSX1, MSY1, 100, 80));
    end;
    2: begin
    repeat
    MovePiece(3);
    for i := 0 to 4 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, MSX1, MSY1, 105, MSY2)) then Break;
    end;
    until (FindDTM(Bee[Num - 1], x, y, MSX1, MSY1, 105, MSY2));
    repeat
    MovePiece(2);
    for i := 0 to 4 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, MSX1, 190, 105, 230)) then
    begin
    Done[1] := True;
    Exit;
    end;
    end;
    until (FindDTM(Bee[Num - 1], x, y, MSX1, 190, 105, 230));
    end;
    3: begin
    repeat
    MovePiece(1);
    for i := 0 to 4 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, MSX1, MSY1, MSX2, 85)) then Break;
    end;
    until (FindDTM(Bee[Num - 1], x, y, MSX1, MSY1, MSX2, 85));
    repeat
    MovePiece(4);
    for i := 0 to 4 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, 400, MSY1, MSX2, 85)) then
    begin
    Done[2] := True;
    Exit;
    end;
    end;
    until (FindDTM(Bee[Num - 1], x, y, 400, MSY1, MSX2, 85));
    end;
    4: begin
    repeat
    MovePiece(4);
    for i := 0 to 4 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, 350, MSY1, MSX2, MSY2)) then Break;
    end;
    p := p + 1;
    until (p > 16 + Random(3) + Random(4)); // I call it "quality over perfection" as opposed to "quality of quantity"
    repeat
    MovePiece(2);
    for i := 0 to 4 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, 400, MSY1, MSX2, MSY2))
    or (not (FindDTM(Bee[Num - 1], x, y, MSX1, MSY1, MSX2, MSY2))) then
    begin
    Done[3] := True;
    Exit;
    end;
    end;
    until (FindDTM(Bee[Num - 1], x, y, 400, 200, MSX2, 250));
    end;
    end;
    end;


    procedure MoveToSpot(Num: Integer); // Moves pieces from the corners to their spots
    var
    i: Integer;
    begin
    if (not (LoggedIn)) then Exit;
    case Num of
    1: Mouse(56, 52, 8, 8, true);
    2: Mouse(66, 216, 8, 8, true);
    3: Mouse(436, 67, 8, 8, true);
    4: Mouse(425, 216, 8, 8, true);
    end;
    case Num of
    1: repeat
    MovePiece(4);
    for i := 0 to 5 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, 210, 25, 310, 75)) then
    begin
    Done[0] := True;
    Exit;
    end;
    end;
    until (FindDTM(Bee[Num - 1], x, y, 210, 25, 310, 75));
    2: begin
    repeat
    MovePiece(4);
    for i := 0 to 4 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, 210, 195, 310, 240)) then Break;
    end;
    until (FindDTM(Bee[Num - 1], x, y, 210, 195, 310, 240));
    repeat
    MovePiece(1);
    for i := 0 to 5 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, 210, 80, 310, 125)) then
    begin
    Done[1] := True;
    Exit;
    end;
    end;
    until (FindDTM(Bee[Num - 1], x, y, 210, 80, 310, 125));
    end;
    3: begin
    repeat
    MovePiece(2);
    for i := 0 to 4 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, 400, 140, MSX2, 175)) then Break;
    end;
    until (FindDTM(Bee[Num - 1], x, y, 400, 140, MSX2, 175));
    repeat
    MovePiece(3);
    for i := 0 to 5 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, 210, 140, 310, 175)) then
    begin
    Done[2] := True;
    Exit;
    end;
    end;
    until (FindDTM(Bee[Num - 1], x, y, 210, 140, 310, 175));
    end;
    4: begin
    repeat
    MovePiece(3);
    for i := 0 to 5 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, 210, 185, 310, 245)) then Break;
    end;
    until (FindDTM(Bee[Num - 1], x, y, 210, 185, 310, 245));
    repeat
    MovePiece(1);
    for i := 0 to 5 do
    begin
    Wait(100 + Random(400));
    if (FindDTM(Bee[Num - 1], x, y, 210, 185, 310, 230)) then
    begin
    Done[3] := True;
    Exit;
    end;
    end;
    until (FindDTM(Bee[Num - 1], x, y, 210, 185, 310, 245));
    end;
    end;
    end;

    function FindFirstPiece: TPoint; // Finds a piece that has not been moved yet
    var
    Cur: Integer;
    begin
    repeat
    if (not (LoggedIn)) then Exit;
    if (FindColorSkipBoxArrayTolerance(x, y, 10329514, MSX1, MSY1, MSX2, MSY2, 30, BoxArray)) then
    begin
    // WriteLN('x: ' + IntToStr(x) + ' y: ' + IntToStr(y));
    Cur := GetColor(x, y);
    Wait(10);
    if (GetColor(x, y) = Cur) then
    begin
    SetArrayLength(BoxArray, GetArrayLength(BoxArray) + 1);
    BoxArray[GetArrayLength(BoxArray) - 1].x1 := x - 1;
    BoxArray[GetArrayLength(BoxArray) - 1].x2 := x + 1;
    BoxArray[GetArrayLength(BoxArray) - 1].y1 := y - 1;
    BoxArray[GetArrayLength(BoxArray) - 1].y2 := y + 1;
    end else Break;
    end else
    begin
    Result.y := -1;
    Exit;
    end;
    until (false);
    Mouse(x, y, 2, 2, false);
    Wait(250 + Random(450));
    if (ChooseOption('Ok')) then
    begin
    Result.x := x;
    Result.y := y;
    Exit;
    end else
    begin
    SetArrayLength(BoxArray, GetArrayLength(BoxArray) + 1);
    BoxArray[GetArrayLength(BoxArray) - 1].x1 := x - 1;
    BoxArray[GetArrayLength(BoxArray) - 1].x2 := x + 1;
    BoxArray[GetArrayLength(BoxArray) - 1].y1 := y - 1;
    BoxArray[GetArrayLength(BoxArray) - 1].y2 := y + 1;
    Result.x := -1;
    end;
    end;

    function MoveFirstPiece: Integer; // Moves piece to the bottem so it can be identified
    var
    Coord: TPoint;
    i: Integer;
    begin
    repeat
    Coord := FindFirstPiece;
    if (Coord.x > 0) and (Coord.y > 0) then Break;
    if (Coord.y = 0) then MMouse(641, 298, 40, 40);
    Wait(100 + Random(1900));
    if (not (LoggedIn)) then Exit;
    until (false);
    if (Coord.x < 200) then
    begin
    MovePiece(4);
    Wait(100 + Random(400));
    if (Coord.x < 175) then
    begin
    MovePiece(4);
    Wait(100 + Random(400));
    if (Coord.x < 150) then
    begin
    MovePiece(4);
    Wait(100 + Random(400));
    if (Coord.x < 125) then
    begin
    MovePiece(4);
    Wait(100 + Random(400));
    if (Coord.x < 100) then
    begin
    MovePiece(4);
    Wait(100 + Random(400));
    if (Coord.x < 80) then
    begin
    MovePiece(4);
    Wait(100 + Random(400));
    end;
    end;
    end;
    end;
    end;
    end;
    repeat
    MovePiece(2);
    for i := 0 to 3 do
    if (FindDTM(Bee, x, y, 60, MSCY + 27, MSX2 - 150, MSY2)) then
    begin
    case i of
    0: begin
    SetArrayLength(BoxArray, GetArrayLength(BoxArray) + 1);
    BoxArray[GetArrayLength(BoxArray) - 1].x1 := 25;
    BoxArray[GetArrayLength(BoxArray) - 1].x2 := 110;
    BoxArray[GetArrayLength(BoxArray) - 1].y1 := 30;
    BoxArray[GetArrayLength(BoxArray) - 1].y2 := 100;
    end;
    1: begin
    SetArrayLength(BoxArray, GetArrayLength(BoxArray) + 1);
    BoxArray[GetArrayLength(BoxArray) - 1].x1 := 25;
    BoxArray[GetArrayLength(BoxArray) - 1].x2 := 105;
    BoxArray[GetArrayLength(BoxArray) - 1].y1 := 170;
    BoxArray[GetArrayLength(BoxArray) - 1].y2 := 225;
    end;
    2: begin
    SetArrayLength(BoxArray, GetArrayLength(BoxArray) + 1);
    BoxArray[GetArrayLength(BoxArray) - 1].x1 := 385;
    BoxArray[GetArrayLength(BoxArray) - 1].x2 := MMX2;
    BoxArray[GetArrayLength(BoxArray) - 1].y1 := 30;
    BoxArray[GetArrayLength(BoxArray) - 1].y2 := 115;
    end;
    3: begin
    SetArrayLength(BoxArray, GetArrayLength(BoxArray) + 1);
    BoxArray[GetArrayLength(BoxArray) - 1].x1 := 395;
    BoxArray[GetArrayLength(BoxArray) - 1].x2 := MMX2;
    BoxArray[GetArrayLength(BoxArray) - 1].y1 := 200;
    BoxArray[GetArrayLength(BoxArray) - 1].y2 := MMY2;
    end;
    end;
    Result := i + 1;
    WriteLN(IntToStr(i));
    Exit;
    end;
    Wait(100 + Random(400));
    until (not (LoggedIn));
    end;

    function SolveBeeKeeper: Boolean; // Main loop
    var
    i: Integer;
    Sec: Boolean;
    begin
    Sec := False;
    DeclareDTMs;
    TalkTo;
    repeat
    i := MoveFirstPiece;
    MoveToCorner(i);
    if (Done[0] = True) and (Done[1] = True) and (Done[2] = True) and (Done[3] = True) then Break;
    until (not (LoggedIn));
    for i := 0 to 3 do
    Done := False;
    i := 1;
    repeat
    MoveToSpot(i);
    i := i + 1;
    if (Done[0] = True) and (Done[1] = True) and (Done[2] = True) and (Done[3] = True) then Break;
    until (not (LoggedIn));
    Mouse(257, 279, 4, 4, true); // Clicks build
    Result := True;
    for i := 0 to 200 do
    begin
    Wait(100);
    if (FindColorSpiral(x, y, MMFlax, MMX1, MMY1, MMX2, MMY2)) then Break;
    if (i = 200) then
    begin
    Mouse(498, 20, 4, 4, true);
    Wait(1000 + Random(1000));
    if (Sec) then
    begin
    Result := False;
    Logout;
    Exit;
    end;
    Sec := True;
    SolveBeeKeeper;
    end;
    end;
    end;

    //-----------------------------------------------//

    procedure Setup;
    begin
    SetupSRL;
    ScriptID := '164';
    LoadUs1;
    if (GetArrayLength(Players) = 0) then AddUser;
    TheForm;
    ChangeFromExtra;
    TehForm;
    SaveUs1;
    FreeForm(frmDesign);
    ClearDebug;
    ActivateClient;
    Wait(100);
    if (not (LoggedIn)) then LoginPlayer
    else NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, upchars);
    HighestAngle;
    SetRun(True);
    GameTab(4);
    h := 1;
    end;

    //-----------------------------------------------//

    procedure ProgressReport;
    var
    i: Integer;
    begin
    ClearDebug;
    WriteLN('This Player Has Done: ' + IntToStr(NewLoads) + ' Loads');
    if (not (NewLoads = Banks)) then
    WriteLN('All Players Have Combined For: ' + IntToStr(Banks) +
    ' Loads');
    if (Players[CurrentPlayer].Strings[2] = 'Both') then
    ReportVars[0] := ReportVars[0] + 28;
    if (Players[CurrentPlayer].Strings[2] = 'Flax') then
    ReportVars[1] := ReportVars[1] + 28;
    if (Players[CurrentPlayer].Strings[2] = 'Spin') then
    ReportVars[2] := ReportVars[2] + 28;
    WriteLN('Running For: '+TimeRunning);
    if (not (Players[0].Booleans[0])) then
    begin
    if (Players[CurrentPlayer].Strings[2] = 'Both') then
    WriteLN('Picked And Spun: '+ IntToStr(Banks * 28) + ' Flax');
    if (Players[CurrentPlayer].Strings[2] = 'Flax') then
    WriteLN('Picked: '+ IntToStr(Banks * 28) + ' Flax');
    if (Players[CurrentPlayer].Strings[2] = 'Spin') then
    WriteLN('Spun: '+ IntToStr(Banks * 28) + ' Flax');
    WriteLN('Grew About: '+ IntToStr(j/2) +' Levels');
    if (not (Players[CurrentPlayer].Strings[2] = 'Flax')) then
    WriteLN('Gained: '+ IntToStr(Banks * (28 * 15)) +' Crafting Experience');
    if (not (Players[CurrentPlayer].Strings[2] = 'Spin')) then
    WriteLN('BeeKeepers Solved: ' + IntToStr(AmtBee));
    end;
    WriteLN('');
    WriteLN('Name | Loads Done | Active');
    for i := 0 to GetArrayLength(Players) - 1 do
    begin
    WriteLN('');
    WriteLN('' + Players.Name + ' | ' + IntToStr(Players.Banked) + ' | ' + BoolToStr(Players.Active));
    end;
    SRLRandomsReport;
    end;

    //-----------------------------------------------//

    function FindMyNormalRandoms: Boolean;
    var
    p, i: Integer;
    begin
    for i := 1 to 12 do
    begin
    case I of
    1: if SolveChatRandom then
    Result := True;
    2: Respond;
    3: if FindTalk then
    Result := True;
    4: if FindDead then
    Result := True;
    5: if FindMime then
    Result := True;
    6: if FindMaze then
    Result := True;
    7: if FindQuiz then
    Result := True;
    8: if FindTalk then // Call it twice
    Result := True;
    9: if FindLamp(LampSkill) then // Maybe we missed it?
    Result := True;
    10: if (FindBox) then
    begin
    Result := True;
    if (UseBoxSolver) then
    SolveBox
    else
    GambleBox;
    end;
    11:
    begin
    if NoGameTab then
    begin
    Result := True;
    if (InBlack) then
    begin
    if (SolveBeeKeeper) then
    begin
    AmtBee := AmtBee + 1
    for p := 0 to 50 do
    begin
    Wait(100);
    if (not (InBlack)) then
    begin
    Wait(3000 + Random(3000));
    Exit;
    end;
    end;
    end;
    end else Logout;
    Exit;
    end;
    end;
    end;
    if Result then
    Break;
    Wait(1);
    end;
    end;

    //-----------------------------------------------//

    function FindLadderArea2(var x, y: Integer; ObjectText: TStringArray; x1, y1, x2, y2,
    ObjectColor, ObjectTolerance: Integer; Center: Boolean): Boolean; forward;
    function FindLadderArea(var x, y: Integer; ObjectText: TStringArray; x1, y1, x2, y2,
    ObjectColor, ObjectTolerance: Integer; Center: Boolean): Boolean; forward;


    function FindAFight: Boolean;
    var
    xf, yf: integer;
    begin
    if (FindColor(xf, yf, 65280, 217, 129, 297, 209)) then
    begin
    GameTab(2);
    Wait(500 + Random(100));
    if (HpPercent < 100) then
    begin
    Result := True;
    WriteLn('******** FOUND FIGHTING RANDOM ********');
    WriteFileString(TheFile, '******** FOUND FIGHTING RANDOM ********' +
    Chr(13))
    Fights := Fights + 1;
    end
    end;
    GameTab(4);
    end;

    //-----------------------------------------------//

    procedure UpLadder; forward;

    function DoRandoms: Boolean;
    var
    i: integer;
    begin
    Wait(1);
    if (FindAFight) then
    begin
    Result := True
    if (not (Players[CurrentPlayer].Loc = 'Spinner')) then RunTo('W', false);
    if (Players[CurrentPlayer].Loc = 'Spinner') then
    begin
    if (FindLadderArea(x, y, ['down', '-d', 'own', 'ow'], 258, 135, 515, 337, MSLadder, 5, True)) then
    begin
    Mouse(x, y, 1, 1, false);
    ClickOption('down', 1);
    Flag;
    DoRandoms;
    end else
    begin
    if (FindColorTolerance(x, y, MSLadder, 340, 150, 475, 270, 5)) then
    begin
    Mouse(x, y, 1, 1, true);
    repeat
    DoRandoms;
    until (not (FlagPresent)) or (not (LoggedIn));
    For i := 0 to 10 do
    Begin
    if (not (GetColor(478, 320) = 0)) then Break;
    Wait(100);
    end;
    UpLadder;
    end;
    end;
    end;
    end;
    if (FindMyNormalRandoms) then Result := True;
    end;

    function CountItemDtm(dtm: Integer): Integer;
    //based of PPLSUQBAWLZ's InventoryCount
    var
    used, i, e: Integer;
    begin
    GameTab(4);
    while (i < 6) do
    begin
    if (i = 5) and (e < 8) then
    begin
    i := 0;
    e := e + 1;
    end;
    if (FindDTM(dtm, x, y, (518 + 42 * i), (172 + 36 * e), (560 + 42 * i),
    (210 + 36 * e))) then
    used := used + 1;
    if (i = 4) and (e = 7) then
    Break;
    i := i + 1;
    end;
    Result := used;
    end;

    function LastItemDTM(DTM: Integer): Boolean;
    begin
    Result := FindDTM(dtm, x, y, 684, 427, 727, 463);
    end;

    //-----------------------------------------------//

    function FindSpinnerArea(var x, y: Integer; ObjectText: string; x1, y1, x2, y2,
    ObjectColor, ObjectTolerance: Integer; Center: Boolean): Boolean;
    var
    Pointss: TPointArray;
    i, Numss, CenX, CenY, n: Integer;
    begin
    Numss := 0;
    if (Center) then
    begin
    CenX := x2 / 2;
    CenY := y2 / 2;
    FindColorsSpiralTolerance(CenX, CenY, Pointss, ObjectColor, x1, y1, x2, y2,
    ObjectTolerance);
    end else
    begin
    FindColorsTolerance(Pointss, ObjectColor, x1, y1, x2, y2, ObjectTolerance);
    end;
    n := GetArrayLength(Pointss);
    if (n <> 0) then
    begin
    repeat
    repeat
    try
    if (not (FindColorTolerance(x, y, 6188407, Pointss[Numss].x - 10, Pointss[Numss].y, Pointss[Numss].x, Pointss[Numss].y + 10, 20))) then Numss := Numss + 1
    except
    Exit;
    end;
    i := i + 1;
    until (i > Numss);
    MMouse(Pointss[Numss].x, Pointss[Numss].y, 0, 0);
    Wait(450 + Random(50));
    if (IsUpText(ObjectText)) then
    begin
    Result := True;
    x := Pointss[Numss].x;
    y := Pointss[Numss].y;
    end else
    begin
    Numss := Numss + 1;
    end;
    until (Numss = n) or (Result)
    end;
    end;

    procedure FindSpinningWheel;
    var
    i: Integer;
    begin
    Players[CurrentPlayer].Loc := 'Spinner';
    if (not (LoggedIn)) then Exit;
    for i := 1 to 5 do
    begin
    if (FindSpinnerArea(x, y, 'pin', 1, 79, 361, 241, 13224399, 10, True)) then
    begin
    Mouse(x, y, 1, 1, false);
    if (ClickOption('pin', 1)) then
    begin
    DoRandoms;
    Flag;
    Exit;
    end;
    end;
    Wait(100);
    end;
    if (FindObj(x, y, 'pin', 6188407, 5)) then
    begin
    Mouse(x, y, 1, 1, false);
    if (ClickOption('pin', 1)) then
    begin
    DoRandoms;
    Flag;
    end;
    end else
    begin
    if (FindObj(x, y, 'pin', 6188407, 25)) then
    begin
    Mouse(x, y, 1, 1, true);
    DoRandoms;
    Flag;
    end;
    end;
    end;

    //-----------------------------------------------//

    procedure WalkFlax;
    var
    i, f: Integer;
    Points: TPointArray;
    begin
    if (not (LoggedIn)) then Exit;
    MarkTime(f);
    MMTree := GetSymbolColor(x, y, 'rare trees');
    if (not (FindColor(x, y, MMTree, 616, 111, 689, 156))) then
    begin
    if (FindColor(x, y, MMTree, 629, 30, 716, 95)) then
    begin
    Mouse(x, y + 40, 4, 4, true);
    Flag;
    end;
    end;
    if (FindColor(x, y, MMTree, 616, 111, 689, 156)) then
    begin
    case Random(3) of
    0: Mouse(x - 25, y + 20, 1, 1, true);
    1: Mouse(x - 20, y + 20, 1, 1, true);
    2: Mouse(x - 23, y + 18, 1, 1, true);
    end;
    Wait(1500 + Random(1500));
    if (not (FlagPresent)) then
    begin
    if (FindColor(x, y, MMTree, 616, 111, 689, 156)) then
    begin
    Mouse(x, y, 1, 1, true);
    Flag;
    if (FindColor(x, y, MMTree, 626, 65, 679, 114)) then
    begin
    case Random(3) of
    0: Mouse(x - 25, y + 23, 1, 1, true);
    1: Mouse(x - 20, y + 22, 1, 1, true);
    2: Mouse(x - 28, y + 22, 1, 1, true);
    end;
    end;
    end;
    end;
    Wait(1000 + Random(1000));
    Flag;
    if (FindColor(x, y, MMTree, 567, 90, 715, 157)) then
    begin
    case random(4) of
    0: Mouse(x + 5, y + 10, 1, 1, true);
    1: Mouse(x, y, 1, 1, true);
    2: Mouse(x + 5, y + 3, 1, 1, true);
    3: Mouse(x, y, 6, 6, true);
    end;
    Wait(2000 + Random(2000));
    FFlag(5);
    MMTree := GetSymbolColor(x, y, 'rare trees');
    if (FindColorSpiral(x, y, MMTree, 630, 69, 665, 108)) then
    begin
    case Random(4) of
    0: Mouse(x + 45, y + 45, 3, 3, true);
    1: Mouse(x + 45, y + 47, 3, 3, true);
    2: Mouse(x + 48, y + 48, 3, 3, true);
    3: Mouse(x + 47, y + 47, 4, 4, true);
    end;
    Wait(5000 + Random(4000));
    Flag;
    if (MMFlax = 0) then
    begin
    FindColorsTolerance(Points, 11297872, MMCX, MMCY, MMX2, MMY2, 75);
    For i := 0 to GetArrayLength(Points) - 1 do
    begin
    while CountColor(GetColor(Points.x, Points[i].y), MMCX, MMCY, MMX2, MMY2) > 200 do
    begin
    i := i + 1;
    if (i = GetArrayLength(Points) - 1) then Logout;
    if (not (LoggedIn)) then Exit;
    end;
    if (CountColor(GetColor(Points[i].x, Points[i].y), MMCX, MMCY, MMX2, MMY2) > 50) then
    begin
    MMFlax := GetColor(Points[i].x, Points[i].y);
    Break;
    end;
    Wait(10);
    end;
    end;
    if (not (LoggedIn)) then Exit;
    if (FindColorSpiralTolerance(x, y, MMFlax, MMCX, MMCY, MMX2, MMY2, 20)) then
    begin
    Mouse(x, y, 4, 4, true);
    Flag;
    Wait(1500 + Random(1500));
    Flag;
    end else
    begin
    Mouse(443, 326, 12, 8, true);
    Wait(100 + Random(1000));
    Flag;
    end;
    if (FindColorTolerance(x, y, FlaxColor, 0, 0, 674, 410, 25)) or (FlaxColor = 0) then
    begin
    if (Players[0].Booleans[0]) then WriteLN('Bank To Flax In ' + IntToStr(TimeFromMark(f) / 1000) +
    ' Seconds');
    Exit;
    end;
    if (not (FindColorTolerance(x, y, FlaxColor, 0, 0, 674, 410, 25))) then
    begin
    Mouse(443, 326, 12, 8, true);
    Wait(100 + Random(1000));
    Flag;
    if (FindColorTolerance(x, y, FlaxColor, 0, 0, 674, 410, 25)) then
    begin
    if (Players[0].Booleans[0]) then WriteLN('Bank To Flax In ' + IntToStr(TimeFromMark(f) / 1000)
    +' Seconds');
    end;
    end;
    end;
    end;
    end;
    end;

    //-----------------------------------------------//

    Procedure PickFlax2;
    Var
    i, Current: Integer;
    Begin
    If not(LoggedIn) then Exit;
    Current := InvCount; //Count items in inventory to start with

    If (not (IsUpTextMulti('Pick', 'lax', 'ck Fl'))) then //If the up text isn't already "Pick Flax"
    begin
    If (FlaxColor = 0) then
    begin
    if (not (FindObj(x, y, 'Pick Flax', 941321, 20))) then Exit; // And it can't find flax using a default color
    end else If (not (FindObj(x, y, 'Pick Flax', FlaxColor, 15))) then Exit; // Or with the set color then it exits
    end;
    GetMousePos(x, y);
    Mouse(x, y, 2, 2, True);
    Repeat
    Wait(100);
    i := i + 1;
    If (i > 34) then Exit;
    until not(FlagPresent) // Wait for the Flag
    For i := 0 to 5 do
    Begin
    DoRandoms;
    Wait(100); //Waits 1/2 secs for the inventory count to change
    If not(InvCount = Current) then Break;
    end;
    Exit;
    end;

    //-----------------------------------------------//

    procedure WalkBank;
    var
    Tol, c, f, p: Integer;
    begin
    if (not (LoggedIn)) then Exit;
    MarkTime(f);
    if (MMFlax = 0) then
    begin
    MMFlax := 11884646;
    For Tol := 20 to 50 do
    begin
    if (FindColorSpiralTolerance(x, y, MMFlax, 631, 49, 727, 151, Tol)) then Break;
    end;
    MMFlax := GetColor(x, y);
    end;
    if (not (LoggedIn)) then Exit;
    MarkTime(f);
    if (FindColorTolerance(x, y, MMFlax, 601, 20, 727, 151, 20)) then
    begin
    Mouse(x, y, 4, 4, true);
    Flag;
    end;
    repeat
    Mouse(55, 50, 8, 8, true);
    Flag;
    c := c + 1;
    until (FindColor(x, y, MMTree, 584, 0, 642, 83)) or (c > 4);
    FFlag(5);
    if (FindColor(x, y, MMTree, 584, 0, 642, 83)) then
    begin
    case Random(4) of
    0: Mouse(x, y, 1, 1, true);
    1: Mouse(x + 5, y + 5, 1, 1, true);
    2: Mouse(x + 3, y - 3, 1, 1, true);
    3: Mouse(x + 3, y + 3, 1, 1, true);
    end;
    Wait(1000 + Random(1000));
    FFlag(5);
    if (not (FindColor(x, y, MMTree, 622, 1, 713, 50))) then
    begin
    if (FindColor(x, y, MMTree, 619, 72, 686, 102)) then
    begin
    case Random(2) of
    0: Mouse(x, y - 15, 1, 1, true);
    1: Mouse(x, y - 20, 1, 1, true);
    end;
    Wait(1500 + Random(1500));
    FFlag(10);
    if (FindColor(x, y, MMTree, 622, 1, 713, 50)) then
    begin
    Mouse(x, y, 1, 1, true);
    Wait(3000 + Random(2000));
    FFlag(5);
    end;
    end;
    end else Mouse(x, y, 1, 1, true);
    Wait(1500 + Random(1500));
    Flag;
    if (FindColorSpiral(x, y, MMTree, 615, 42, 685, 117)) then
    begin
    Wait(500 + Random(1000));
    Mouse(x - 18, y - 48, 1, 1, true);
    Wait(1500 + Random(1000));
    MarkTime(p);
    repeat
    Wait(100);
    until (not (FlagPresent)) or (not (LoggedIn)) or (TimeFromMark(p) > 20000);
    if (Players[0].Booleans[1]) then WriteLN('Flax To Bank In ' + IntToStr(TimeFromMark(f) / 1000) +
    ' Seconds');
    end;
    end;
    end;

    //-----------------------------------------------//

    procedure OpenBank4;
    var
    x, y, fs, fs2: Integer;
    begin
    if not LoggedIn then Exit;
    if not BankScreen then
    repeat
    case fs2 of
    0: if (FindObj(x, y, 'oth', 10266798, 15)) then Mouse(x, y, 4, 4, False);
    1: if (FindObj(x, y, 'oth', 5269623, 15)) then Mouse(x, y, 4, 4, False);
    2: if (FindObj(x, y, 'oth', 3626083, 15)) then Mouse(x, y, 4, 4, False);
    3: if (FindObj(x, y, 'oth', 4746624, 15)) then Mouse(x, y, 4, 4, False);
    4: if (FindObj(x, y, 'oth', 2838626, 15)) then Mouse(x, y, 4, 4, False);
    5: if (FindObj(x, y, 'oth', 3626083, 35)) then Mouse(x, y, 4, 4, False);
    end;
    Wait(220 + Random(120));
    if (ClickOption('quickly', 1)) then
    begin
    Flag;
    repeat
    Wait(100);
    fs := fs + 1;
    if (PinScreen) then Exit;
    until (BankScreen) or (fs >= 50) or (not (Loggedin));
    end;
    fs2 := fs2 + 1;
    until (BankScreen) or (fs2 > 5) or (not (LoggedIn));
    end;

    //-----------------------------------------------//

    procedure DoBank;
    var
    t, f, z: Integer;
    begin
    if (not (LoggedIn)) then Exit;
    MarkTime(f);
    OpenBank4;
    InPin(Players[CurrentPlayer].Strings[3]);
    repeat
    DepositAll;
    Wait(500+Random(500));
    z := z + 1;
    until (not (LoggedIn)) or (z > 2);
    if (not (LoggedIn)) then Exit;
    Banks := Banks + 1;
    NewLoads := NewLoads + 1;
    Players[CurrentPlayer].Banked := Players[CurrentPlayer].Banked + 1;
    if (Players[0].Booleans[0]) then WriteLN('Found Bank In ' + IntToStr(TimeFromMark(f) / 1000) +
    ' Seconds');
    if (Players[CurrentPlayer].Strings[2] = 'Spin') then Withdraw(1, 1, 0);
    if (h = 0) then
    begin
    CloseBank;
    repeat
    Wait(100);
    t := t + 1;
    until (not (BankScreen)) or (not (LoggedIn)) or (t > 9);
    SetRun(True);
    GameTab(4);
    end;
    h := h + 1;
    if (h > 4 + Random(3)) then h := 0;
    end;

    //-----------------------------------------------//

    procedure RunToWheel;
    var
    f: Integer;
    begin
    if (not (LoggedIn)) then Exit;
    MarkTime(f);
    MMTree := GetSymbolColor(x, y, 'rare trees');
    if (FindColor(x, y, MMTree, 616, 111, 689, 156)) then
    begin
    case Random(3) of
    0: Mouse(x - 25, y + 25, 1, 1, true);
    1: Mouse(x - 20, y + 22, 1, 1, true);
    2: Mouse(x - 28, y + 25, 1, 1, true);
    end;
    Wait(1500 + Random(1500));
    if (not (FlagPresent)) then
    begin
    if (FindColor(x, y, MMTree, 616, 111, 689, 156)) then
    begin
    Mouse(x, y, 1, 1, true);
    Flag;
    if (FindColor(x, y, MMTree, 626, 65, 679, 114)) then
    begin
    case Random(3) of
    0: Mouse(x - 25, y + 23, 1, 1, true);
    1: Mouse(x - 20, y + 22, 1, 1, true);
    2: Mouse(x - 28, y + 22, 1, 1, true);
    end;
    end;
    end;
    end;
    Wait(1000 + Random(1000));
    FFlag(5);
    Wait(500 + Random(500));
    MMTree := GetSymbolColor(x, y, 'rare trees');
    if (FindColor(x, y, MMTree, 567, 103, 715, 157)) then
    begin
    Mouse(x - 27, y - 18, 1, 1, true);
    Flag;
    if (Players[0].Booleans[0]) then WriteLN('Flax To Ladder In ' + IntToStr(TimeFromMark(f) / 1000) +
    ' Seconds');
    Wait(500 + Random(1000));
    end;
    end;
    end;

    //-----------------------------------------------//

    function SpinScreen: Boolean;
    var
    fx, fy: Integer;
    begin
    Result := FindColor(fx, fy, 2070783, 190, 30, 310, 50);
    end;

    procedure SureSpin;
    var
    t, o: Integer;
    begin
    repeat
    Flag;
    Wait(200 + Random(200));
    if (SpinScreen) then Break;
    Wait(100);
    T := T + 1;
    if (T > 24) then
    begin
    FindSpinningWheel;
    T := 0;
    o := o + 1;
    end;
    if (o > 2) then Logout;
    if (not (LoggedIn)) then Exit;
    DoRandoms;
    until (SpinScreen);
    end;

    function FindDoorArea(var x, y: Integer; ObjectText: string; x1, y1, x2, y2,
    ObjectColor, ObjectTolerance: Integer; Center: Boolean): Boolean;
    var
    Pointss: TPointArray;
    i, Numss, CenX, CenY, n, m: Integer;
    begin
    Numss := 0;
    if (Center) then
    begin
    CenX := x2 / 2;
    CenY := y2 / 2;
    FindColorsSpiralTolerance(CenX, CenY, Pointss, ObjectColor, x1, y1, x2, y2,
    ObjectTolerance);
    end else
    begin
    FindColorsTolerance(Pointss, ObjectColor, x1, y1, x2, y2, ObjectTolerance);
    end;
    n := GetArrayLength(Pointss);
    MarkTime(m);
    if (n <> 0) then
    begin
    repeat
    repeat
    try
    if (not (GetColor(Pointss[Numss].x, Pointss[Numss].y - 1) = (GetColor(Pointss[Numss].x, Pointss[Numss].y))))
    and (not (GetColor(Pointss[Numss].x - 1, Pointss[Numss].y) = (GetColor(Pointss[Numss].x, Pointss[Numss].y))))
    and (not (GetColor(Pointss[Numss].x, Pointss[Numss].y + 1) = (GetColor(Pointss[Numss].x, Pointss[Numss].y))))
    and (not (GetColor(Pointss[Numss].x + 1, Pointss[Numss].y) = (GetColor(Pointss[Numss].x, Pointss[Numss].y)))) then Numss := Numss + 1
    if (TimeFromMark(m) > 10000) then Exit;
    except
    Exit;
    end;
    i := i + 1;
    until (i > Numss);
    MMouse(Pointss[Numss].x, Pointss[Numss].y, 0, 0);
    Wait(450 + Random(50));
    if (IsUpText(ObjectText)) then
    begin
    Result := True;
    x := Pointss[Numss].x;
    y := Pointss[Numss].y;
    end else
    begin
    Numss := Numss + 1;
    end;
    until (Numss = n) or (Result)
    end;
    end;

    function FindLadderArea2(var x, y: Integer; ObjectText: TStringArray; x1, y1, x2, y2,
    ObjectColor, ObjectTolerance: Integer; Center: Boolean): Boolean;
    var
    Pointss: TPointArray;
    d, i, Numss, CenX, CenY, n: Integer;
    begin
    Numss := 0;
    if (Center) then
    begin
    CenX := x2 / 2;
    CenY := y2 / 2;
    FindColorsSpiralTolerance(CenX, CenY, Pointss, ObjectColor, x1, y1, x2, y2,
    ObjectTolerance);
    end else
    begin
    FindColorsTolerance(Pointss, ObjectColor, x1, y1, x2, y2, ObjectTolerance);
    end;
    n := GetArrayLength(Pointss);
    if (n <> 0) then
    begin
    repeat
    repeat
    try
    if (not (FindColorTolerance(x, y, 12505300, Pointss[Numss].x, Pointss[Numss].y, Pointss[Numss].x + 10, Pointss[Numss].y + 10, 10))) then Numss := Numss + 1
    except
    Exit;
    end;
    i := i + 1;
    until (i > Numss);
    MMouse(Pointss[Numss].x - 4, Pointss[Numss].y, 0, 0);
    Wait(450 + Random(50));
    For d := 0 to GetArrayLength(ObjectText) - 1 do
    begin
    if (IsUpText(ObjectText[d])) then
    begin
    Result := True;
    x := Pointss[Numss].x;
    y := Pointss[Numss].y;
    Exit;
    end;
    end;
    Numss := Numss + 1;
    until (Numss >= n) or (Result)
    end;
    end;

    function FindObjEd(var cx, cy: Integer; Text: TStringArray; color, tolerance: Integer): Boolean;
    var
    d, a, c, i, x1, y1, x2, y2: Integer;
    begin
    x1 := 245;
    y1 := 165;
    x2 := 277;
    y2 := 185;
    repeat
    if (not (Loggedin)) then
    Break;
    a := a + 1;
    if (a = 1) or (a = 3) then
    c := c + 1;
    for i := 1 to c do
    begin
    if (a = 1) then
    begin
    x1 := x1 + 30;
    x2 := x2 + 30;
    end else
    if (a = 2) then
    begin
    y1 := y1 - 20;
    y2 := y2 - 20;
    end else
    if (a = 3) then
    begin
    x1 := x1 - 30;
    x2 := x2 - 30;
    end else
    if (a = 4) then
    begin
    y1 := y1 + 20;
    y2 := y2 + 20;
    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;
    if (FindColorTolerance(cx, cy, color, x1, y1, x2, y2, tolerance)) then
    begin
    MMouse(cx, cy, 0, 0)
    Wait(250 + Random(250));
    For d := 0 to GetArrayLength(Text) - 1 do
    begin
    if (IsUpText(Text[d])) then
    begin
    Result := True;
    Exit;
    end else
    begin
    MMouse(cx - 5 - Random(2), cy, 0, 0);
    Wait(250 + Random(250));
    if (IsUpText(Text[d])) then
    begin
    Result := True;
    Exit;
    end;
    end;
    end;
    end;
    end;
    if (a = 4) then
    a := 0;
    until (x2 > 515) or (Result = True);
    end;

    procedure UpLadder;
    var
    a, p, i, Tol, Ax, Ay: Integer;
    begin
    if (not (LoggedIn)) then Exit;
    if (MSLadder = 0) then
    begin
    For Tol := 4 to 40 do
    begin
    if (not (FindLadderArea2(x, y, ['cli', 'imb', 'up', 'dd'], 137, 109, 366, 294, 6583422, Tol, True))) then
    begin
    if (FindObjEd(x, y, ['cli', 'imb', 'up', 'dd'], 6583422, Tol)) then
    begin
    MSLadder := GetColor(x, y);
    Break;
    end;
    end else
    begin
    MSLadder := GetColor(x, y);
    Break;
    end;
    end;
    if (MSLadder = 0) then Logout;
    end;
    MarkTime(a);
    repeat
    if (TimeFromMark(a) > 120000) then Logout;
    if (not (LoggedIn)) then Exit;
    if (FindLadderArea2(x, y, ['cli', 'imb', 'up', 'dd'], 137, 109, 366, 294, MSLadder, 5, True)) then
    begin
    Mouse(x, y, 0, 0, false);
    ClickOption('Climb', 1);
    Wait(100 + Random(100));
    Flag;
    DoRandoms;
    Wait(200 + Random(1000));
    end else
    begin
    MMouseItem(1 + Random(27));
    if (FindObjEd(x, y, ['cli', 'imb', 'up', 'dd'], MSLadder, 5)) then
    begin
    if (not (FindSymbol(ax, ay, 'rare trees'))) then Exit;
    Mouse(x, y, 1, 1, false);
    ClickOption('Climb', 1);
    Wait(100 + Random(100));
    Flag;
    DoRandoms;
    Wait(200 + Random(1000));
    end;
    end;
    For i := 0 to 30 do
    Begin
    if (GetColor(259, 298) = 0) then Exit;
    Wait(100);
    end;
    if (FindColor(ax, ay, MMTree, 656, 90, 700, 122)) and (InChat('reach that')) then
    begin
    WriteLN('Door Closed');
    MarkTime(p);
    repeat
    if (FindDoorArea(x, y, 'oor', 179, 3, 345, 167, 4216160, 20, True)) then Mouse(x, y, 1, 1, false);
    until (ClickOption('pen', 1)) or (not (LoggedIn)) or (TimeFromMark(p) > 10000);
    Flag;
    Wait(1000 + Random(1000));
    DoRandoms;
    MMouseItem(1 + Random(27));
    if (FindObjEd(x, y, ['cli', 'imb', 'up', 'dd'], MSLadder, 5)) then
    begin
    Mouse(x, y, 1, 1, false);
    ClickOption('Climb', 1);
    DoRandoms;
    Flag;
    Wait(200 + Random(1000));
    end;
    end;
    For i := 0 to 30 do
    Begin
    if (GetColor(465, 311) = 0) then Exit;
    Wait(100);
    end;
    SymbolAccuracy := 0.4;
    until (not (FindSymbolIn(ax, ay, 'rare trees', 656, 90, 700, 122))) or (not (LoggedIn));
    end;

    procedure SpinFlax;
    var
    z, Stopped, f, c, a, p: Integer;
    begin
    UpLadder;
    if (not (LoggedIn)) then Exit;
    FindSpinningWheel;
    Flag;
    DoRandoms;
    SureSpin;
    Wait(100 + Random(1000));
    Mouse(262, 111, 8, 8, false);
    Wait(1000 + Random(1000));
    ClickOption('X', 1);
    Wait(1000 + Random(1000));
    TypeSend('' + IntToStr(30 + Random(60)));
    For a := 0 to 20 do
    begin
    Wait(100);
    if (DoRandoms) then
    begin
    if (not (LoggedIn)) then Exit;
    FindSpinningWheel;
    Flag;
    SureSpin;
    Wait(100 + Random(1000));
    Mouse(262, 111, 4, 4, false);
    Wait(1000+Random(1000));
    ClickOption('X', 1);
    Wait(1000 + Random(1500));
    TypeSend('' + IntToStr(30 + Random(60)));
    Wait(100 + Random(200));
    end;
    end;
    z := DTMFromString('78DA6314606060106240018DA5610CBA409A1' +
    '188FF0301A30890C1CA800618914820CD0624E408A8910112B204' +
    'D480ECE1C1AF06007C91062D');
    MarkTime(a);
    while not LastItemDTM(z) do
    begin
    if (TimeFromMark(a) > 80000) then Exit;
    Wait(100);
    if (DoRandoms) then
    begin
    if (not (LoggedIn)) then Exit;
    FindSpinningWheel;
    Flag;
    SureSpin;
    Wait(100 + Random(1000));
    Mouse(262, 111, 4, 4, false);
    Wait(1000+Random(1000));
    ClickOption('X', 1);
    Wait(1000 + Random(1500));
    TypeSend('' + IntToStr(30 + Random(60)));
    Wait(100 + Random(200));
    end;
    if (Random(10) = 5) then MMouse(321, 205, 200, 200);
    if (ClickToContinue) then j:= j+1;
    c := CountItemDTM(z);
    For p := 0 to 40 do
    begin
    Wait(100);
    if (LastItemDTM(z)) then Break;
    if (p > 28) and (CountItemDTM(z) = c) or (DoRandoms) then
    begin
    if (LastItemDTM(z)) then Break;
    if (not (LoggedIn)) then Exit;
    Stopped := Stopped + 1;
    if (Stopped > 2) then Exit;
    FindSpinningWheel;
    Flag;
    SureSpin;
    Wait(100 + Random(1000));
    Mouse(262, 111, 4, 4, false);
    Wait(1000+Random(1000));
    ClickOption('X', 1);
    Wait(1000 + Random(1500));
    TypeSend('' + IntToStr(30 + Random(60)));
    Wait(100 + Random(200));
    Break;
    end else if (CountItemDTM(z) <> c) then Break;
    end;
    end;
    FreeDTM(z);
    if (Players[0].Booleans[0]) then WriteLN('Spun 28 Flax In ' + IntToStr(TimeFromMark(f) / 1000) +
    ' Seconds');
    end;

    //-----------------------------------------------//

    function FindLadderArea(var x, y: Integer; ObjectText: TStringArray; x1, y1, x2, y2,
    ObjectColor, ObjectTolerance: Integer; Center: Boolean): Boolean;
    var
    Pointss: TPointArray;
    p, i, Numss, CenX, CenY, n: Integer;
    begin
    Numss := 0;
    if (Center) then
    begin
    CenX := x2 / 2;
    CenY := y2 / 2;
    FindColorsSpiralTolerance(CenX, CenY, Pointss, ObjectColor, x1, y1, x2, y2,
    ObjectTolerance);
    end else
    begin
    FindColorsTolerance(Pointss, ObjectColor, x1, y1, x2, y2, ObjectTolerance);
    end;
    n := GetArrayLength(Pointss);
    if (n <> 0) then
    begin
    repeat
    repeat
    try
    if (not (FindColor(x, y, 0, Pointss[Numss].x - 20, Pointss[Numss].y - 20, Pointss[Numss].x, Pointss[Numss].y))) then Numss := Numss + 1
    except
    Exit;
    end;
    i := i + 1;
    until (i > Numss);
    MMouse(Pointss[Numss].x, Pointss[Numss].y, 0, 0);
    Wait(450 + Random(50));
    for p := 0 to GetArrayLength(ObjectText) - 1 do
    begin
    if (IsUpText(ObjectText[p])) then
    begin
    Result := True;
    x := Pointss[Numss].x;
    y := Pointss[Numss].y;
    Exit;
    end;
    end;
    Numss := Numss + 1;
    until (Numss = n) or (Result)
    end;
    end;

    procedure FlaxToBank;
    var
    ax, ay, i, f, p: Integer;
    begin
    if (not (LoggedIn)) then Exit;
    MarkTime(f);
    if (FindLadderArea(x, y, ['down', '-d', 'own', 'ow'], 258, 135, 515, 337, MSLadder, 5, True)) then
    begin
    Mouse(x, y, 1, 1, false);
    ClickOption('down', 1);
    Flag;
    DoRandoms;
    end else
    begin
    if (FindColorTolerance(x, y, MSLadder, 340, 150, 475, 270, 5)) then
    begin
    Mouse(x, y, 1, 1, true);
    repeat
    DoRandoms;
    until (not (FlagPresent)) or (not (LoggedIn));
    For i := 0 to 10 do
    Begin
    if (not (GetColor(478, 320) = 0)) then Break;
    Wait(200);
    end;
    if (not (FindSymbol(x, y, 'rare trees'))) then
    begin
    if (FindLadderArea(x, y, ['down', '-d', 'own', 'ow'], 258, 135, 515, 337, MSLadder, 5, True)) then
    begin
    Mouse(x, y, 1, 1, false);
    ClickOption('down', 1);
    Flag;
    DoRandoms;
    end;
    end;
    end;
    end;
    For i := 0 to 20 do
    Begin
    if (not (GetColor(478, 320) = 0)) then Break;
    Wait(200);
    end;
    if (not (FindSymbolIn(x, y, 'rare trees', 656, 90, 700, 122))) then
    begin
    Wait(2000 + Random(2000));
    if (FindSymbolIn(x, y, 'rare trees', 656, 90, 700, 122)) or (FindSymbol(x, y, 'rare trees')) then Players[CurrentPlayer].Loc := 'Other';
    if (not (Players[CurrentPlayer].Loc = 'Other')) then
    begin
    if (FindObj(x, y, 'down', MSLadder, 15)) then
    begin
    Mouse(x, y, 1, 1, false);
    ClickOption('down', 1);
    Flag;
    end;
    end;
    For i := 0 to 20 do
    Begin
    if (not (GetColor(478, 320) = 0)) then Break;
    Wait(200);
    end;
    if (not (FindSymbol(x, y, 'rare trees'))) then
    begin
    if (FindObj(x, y, 'down', MSLadder, 25)) then
    begin
    Mouse(x, y, 1, 1, false);
    ClickOption('down', 1);
    Flag;
    end;
    end;
    end;
    Players[CurrentPlayer].Loc := 'Other';
    Wait(500 + Random(1500));
    MMTree := GetSymbolColor(x, y, 'rare trees');
    if (not (FindColor(x, y, MMTree, 665, 12, 733, 80))) then
    begin
    if (FindColor(x, y, MMTree, 656, 90, 700, 122)) then
    begin
    Mouse(x, y - 15, 1, 1, true);
    Wait(200 + Random(600));
    if (not (FlagPresent)) then
    begin
    WriteLN('Door Closed');
    MarkTime(p);
    repeat
    if (FindDoorArea(x, y, 'oor', 213, 13, 380, 153, 4216160, 20, True)) then Mouse(x, y, 1, 1, false);
    until (ClickOption('pen', 1)) or (not (LoggedIn)) or (TimeFromMark(p) > 10000);
    if (FindColor(x, y, MMTree, 656, 90, 700, 122)) then
    begin
    Mouse(x, y - 15, 1, 1, true);
    Wait(500 + Random(1500));
    FFlag(5);
    end;
    end;
    Wait(500+Random(2000));
    DoRandoms;
    FFlag(5);
    end;
    end;
    if (FindColor(x, y, MMTree, 649, 7, 730, 82)) then
    begin
    Mouse(x, y, 1, 1, true);
    DoRandoms;
    Wait(1500 + Random(1000));
    if (not (FlagPresent)) then
    begin
    WriteLN('Door Closed');
    MarkTime(p);
    repeat
    if (FindDoorArea(x, y, 'oor', 213, 13, 380, 153, 4216160, 20, True)) then Mouse(x, y, 1, 1, false);
    until (ClickOption('pen', 1)) or (not (LoggedIn)) or (TimeFromMark(p) > 10000);
    Wait(1000 + Random(1000));
    DoRandoms;
    if (FindColor(ax, ay, MMTree, 649, 7, 730, 82)) then Mouse(ax, ay, 1, 1, true);
    end;
    Wait(2000 + Random(2000));
    FFlag(5);
    if (FindColorSpiral(x, y, MMTree, 615, 42, 685, 117)) then
    begin
    Wait(500 + Random(1000));
    Mouse(x - 18, y - 48, 1, 1, true);
    Wait(1500 + Random(1000));
    FFlag(5);
    if (Players[0].Booleans[0]) then WriteLN('Spinner To Bank In ' + IntToStr(TimeFromMark(f) / 1000) +
    ' Seconds');
    end;
    end;
    end;

    //-----------------------------------------------//

    procedure SpinFromFlax;
    var
    f, c: Integer;
    begin
    if (not (LoggedIn)) then Exit;
    MarkTime(f);
    if (FindColorTolerance(x, y, MMFlax, 601, 20, 655, 95, 20)) then
    begin
    Mouse(x, y, 4, 4, true);
    FFlag(5);
    end;
    repeat
    Mouse(50, 45, 12, 12, true);
    DoRandoms;
    Flag;
    c := c + 1
    until (FindColor(x, y, MMTree, 570, 15, 648, 83)) or (c > 4);
    Mouse(50, 45, 12, 12, true);
    Wait(500 + Random(1000));
    FFlag(5);
    if (FindColor(x, y, MMTree, 570, 15, 648, 83)) then
    begin
    Mouse(x, y, 4, 4, true);
    Wait(5000 + Random(5000));
    FFlag(5);
    if (not (FindColor(x, y, MMTree, 632, 74, 672, 108))) then
    begin
    repeat
    Wait(500);
    if (not (LoggedIn)) then Exit;
    if (FindSymbol(x, y, 'rare trees')) and (not (FindColor(x, y, MMTree, 632, 60, 690, 108))) then MMTree := GetSymbolColor(x, y, 'rare trees');
    until (FindColor(x, y, MMTree, 632, 60, 690, 108));
    end;
    FFlag(5);
    SymbolAccuracy := 0.5;
    if (FindSymbolIn(x, y, 'rare trees', 650, 36, 679, 66)) then
    begin
    Mouse(x, y, 2, 2, true);
    Flag;
    Wait(100 + Random(100));
    end;
    if (FindColorSpiral(x, y, MMTree, 632, 60, 690, 108)) then
    begin
    Mouse(x - 27, y - 18, 1, 1, true);
    Flag;
    if (Players[0].Booleans[0]) then WriteLN('Flax To Ladder In ' + IntToStr(TimeFromMark(f) / 1000) +
    ' Seconds');
    Wait(500 + Random(1000));
    end;
    end;
    end;

    //-----------------------------------------------//

    procedure DoFlax;
    var
    f: Integer;
    begin
    ProgressReport;
    WalkFlax;
    MarkTime(f);
    repeat
    PickFlax2;
    DoRandoms;
    if (TimeFromMark(f) > 300000) then Logout;
    until (InvFull) or (not (LoggedIn));
    if (InvFull) then
    begin
    if (Players[0].Booleans[0]) then WriteLN('Picked 28 Flax In ' + IntToStr(TimeFromMark(f) / 1000) +
    ' Seconds');
    WalkBank;
    DoBank;
    end;
    end;

    //-----------------------------------------------//

    procedure DoSpin;
    begin
    ProgressReport;
    if (NewLoads = 0) then
    begin
    OpenBank4;
    InPin(Players[CurrentPlayer].Strings[3]);
    if (Players[CurrentPlayer].Strings[2] = 'Spin') then Withdraw(1, 1, 0);
    CloseBank;
    end;
    RunToWheel;
    SpinFlax;
    FlaxToBank;
    DoBank;
    end;

    //-----------------------------------------------//

    procedure DoBoth;
    var
    f: Integer;
    begin
    ProgressReport;
    WalkFlax;
    MarkTime(f);
    repeat
    PickFlax2;
    DoRandoms;
    if (TimeFromMark(f) > 300000) then Logout;
    until (InvFull) or (not (LoggedIn));
    if (InvFull) then
    begin
    if (Players[0].Booleans[0]) then WriteLN('Picked 28 Flax In ' + IntToStr(TimeFromMark(f) / 1000) +
    ' Seconds');
    SpinFromFlax;
    SpinFlax;
    FlaxToBank;
    DoBank;
    end;
    end;

    //-----------------------------------------------//

    var
    l: Integer;
    begin
    Setup;
    repeat
    repeat
    if (LowerCase(Players[CurrentPlayer].Strings[2]) = 'flax') then DoFlax;
    if (LowerCase(Players[CurrentPlayer].Strings[2]) = 'both') then DoBoth;
    if (LowerCase(Players[CurrentPlayer].Strings[2]) = 'spin') then DoSpin;
    until (NewLoads = StrToInt(Players[CurrentPlayer].Strings[1])) or (not (LoggedIn));
    repeat
    Wait(1000);
    l := l + 1;
    until(l > 5 + Random(6));
    Nextplayer(LoggedIn);
    h := 0;
    NewLoads := 0;
    until (false);
    end.[/i][/i][/i][/i][/i]
     
  3. Unread #2 - Nov 10, 2008 at 8:25 PM
  4. Jethr0x
    Joined:
    Jan 24, 2007
    Posts:
    3,070
    Referrals:
    13
    Sythe Gold:
    0

    Jethr0x Grand Master
    Banned

    Need help with this Script

    click the "move to plugins" button when u download srl.

    also in the future use
    Code:
     Tags
     
< rondom error | SMART/SCAR Problem =\ >

Users viewing this thread
1 guest


 
 
Adblock breaks this site