Results 1 to 17 of 17

Thread: Out Of Range error in my form

  1. #1
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Out Of Range error in my form

    So, i keep getting this out of range error in my form, and i know it has something to do with the declaration of players etc, like with the arrow buttons and stuff... I followed jhildy's tutorial, but i still get this error. Here's my (really long) form..

    SCAR Code:
    program New;
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Core\Users.scar}
    var
      frmDesign : TForm;
      CDNBLabel : TLabel;
      ChrisDraynorNetterBankerLabel : TLabel;
      NameLabel : TLabel;
      PassLabel : TLabel;
      LoadsLabel : TLabel;
      NameNumber : TLabel;
      PassNumber : TLabel;
      LoadsNumber : TLabel;
      DirNumber : TLabel;
      RunAwayLabel : TLabel;
      Tabs : TTabControl;
      NewsBox : TRichEdit;
      ScriptStart : TButton;
      NewsButton : TButton;
      CreateBtn : TButton;
      DeleteBtn : TButton;
      BackBtn : TButton;
      NextBtn : TButton;
      EdUser : TEdit;
      EdPass : TEdit;
      ActiveCheckBox : TCheckBox;
      BankPinCheckBox : TCheckBox;
      BankPinEdit : TEdit;
      RunAwayDir : TComboBox;
      LoadsEdit : TEdit;
      NetOrPowerCombo : TComboBox;
      SecondsEdit : TEdit;
      Seconds : TLabel;
      OkBtn : TButton;
      TotalScriptRunsLabel1 : TLabel;
      TotalScriptRunsLabel : TLabel;
      TotalScriptRuns, TotalFish, TotalLoads, TotalAnchovies  : Extended;
      TotalShrimp, TotalEXP : Extended;
      TotalScriptRunsInForm, TotalFishInForm, TotalLoadsInForm, TotalAnchoviesInForm  : Extended;
      TotalShrimpInForm : Extended;
      TotalFishies : TLabel;
      TotalFishiesCaught, TotalShrimps, TotalShrimpCaught : TLabel;
      dFile : String;
      aFile : Integer;
      ResetBtn : TButton;
      UpdateScriptBtn : TButton;
      StatusBar : TStatusBar;
      SPanel1 : TStatusPanel;
      cUser: Integer;

    Const  VerNumber = '.85b';

    Procedure LoadGlobalReport;Forward;






    {*******************************************************************************
    procedure AddUser;
    By: RsN
    Description:
    *******************************************************************************}


    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].Integers[0] := 0;
      Players[GetArrayLength(Players) - 1].Booleans[0] := True;
      Players[GetArrayLength(Players) - 1].Extendeds[0] := 0;
      Players[GetArrayLength(Players) - 1].Extendeds[1] := 0;
      Players[GetArrayLength(Players) - 1].Extendeds[2] := 0;
      Players[GetArrayLength(Players) - 1].Strings[0] := '';
      Players[GetArrayLength(Players) - 1].Strings[1] := 'E';
      Players[GetArrayLength(Players) - 1].Active := True;
    end;

    {*******************************************************************************
    procedure Inititate(Sender : TObject);
    By: RsN
    Description:
    *******************************************************************************}


    procedure Inititate(Sender: TObject);
    begin
      NameNumber.Caption := IntToStr(cUser);
      PassNumber.Caption := IntToStr(cUser);
      LoadsNumber.Caption := IntToStr(cUser);
      DirNumber.Caption := IntToStr(cUser);
      Players[cUser].Name := edUser.Text;
      Players[cUser].Pass := edPass.Text;
      Players[cUser].Integers[0] := (StrToInt(LoadsEdit.Text));
      If (ActiveCheckBox.Checked = True) Then
        Players[cUser].Active := True
      else
        Players[cUser].Active := False;
      If (BankPinCheckBox.Checked = True) Then
        Players[cUser].Strings[0] := BankPinEdit.Text
      else
        Players[cUser].Strings[0] := '';
      Players[cUser].Strings[1] := RunAwayDir.Text;
      If (NetOrPowerCombo.Text = 'Bank') Then
        Players[cUser].Booleans[0] := True
      else
        Players[cUser].Booleans[0] := False;
        Players[cUser].Extendeds[0] := 0;
        Players[cUser].Extendeds[1] := 0;
        Players[cUser].Extendeds[2] := 0;
      cUser := GetArrayLength(Players) - 1;
    end;

    {*******************************************************************************
    procedure CreateUser(Sender : TObject);
    By: RsN
    Description:
    *******************************************************************************}


    procedure CreateUser(Sender: TObject);
    begin
      NameNumber.Caption := IntToStr(cUser);
      PassNumber.Caption := IntToStr(cUser);
      LoadsNumber.Caption := IntToStr(cUser);
      DirNumber.Caption := IntToStr(cUser);
      Players[cUser].Name := edUser.Text;
      Players[cUser].Pass := edPass.Text;
      Players[cUser].Integers[0] := (StrToInt(LoadsEdit.Text));
      If (ActiveCheckBox.Checked = True) Then
        Players[cUser].Active := True
      else
        Players[cUser].Active := False;
      If (BankPinCheckBox.Checked = True) Then
        Players[cUser].Strings[0] := BankPinEdit.Text
      else
        Players[cUser].Strings[0] := '';
      Players[cUser].Strings[1] := RunAwayDir.Text;
      If (NetOrPowerCombo.Text = 'Bank') Then
        Players[cUser].Booleans[0] := True
      else
        Players[cUser].Booleans[0] := False;
        Players[cUser].Extendeds[0] := 0;
        Players[cUser].Extendeds[1] := 0;
        Players[cUser].Extendeds[2] := 0;
      edUser.Text := Players[cUser].Name;
      edPass.Text := Players[cUser].Pass;
      LoadsEdit.Text := (IntToStr(Players[cUser].Integers[0]));
      BankPinEdit.Text := Players[cUser].Strings[0];
      RunAwayDir.Text := Players[cUser].Strings[1];
      if (Players[cUser].Booleans[0] = True) Then
        NetOrPowerCombo.Text := 'True'
      else
        NetOrPowerCombo.Text := 'False';
      if (Players[cUser].Active) then
        ActiveCheckBox.Checked := True
      else
        ActiveCheckBox.Checked := False;
    end;

    {*******************************************************************************
    procedure ForwardUser(Sender : TObject);
    By: RsN
    Description:
    *******************************************************************************}


    procedure ForwardUser(Sender: TObject);
    begin
      Players[cUser].Name := edUser.Text;
      Players[cUser].Pass := edPass.Text;
      Players[cUser].Integers[0] := (StrToInt(LoadsEdit.Text));
      If (ActiveCheckBox.Checked = True) Then
        Players[cUser].Active := True
      else
        Players[cUser].Active := False;
      If (BankPinCheckBox.Checked = True) Then
        Players[cUser].Strings[0] := BankPinEdit.Text
      else
        Players[cUser].Strings[0] := '';
      Players[cUser].Strings[1] := RunAwayDir.Text;
      If (NetOrPowerCombo.Text = 'Bank') Then
        Players[cUser].Booleans[0] := True
      else
        Players[cUser].Booleans[0] := False;
        Players[cUser].Extendeds[0] := 0;
        Players[cUser].Extendeds[1] := 0;
        Players[cUser].Extendeds[2] := 0;
      if (cUser + 1 > GetArrayLength(Players) - 1) then
        cUser := 0
      else
        cUser := cUser + 1;
      NameNumber.Caption := IntToStr(cUser);
      PassNumber.Caption := IntToStr(cUser);
      LoadsNumber.Caption := IntToStr(cUser);
      DirNumber.Caption := IntToStr(cUser);
      edUser.Text := Players[cUser].Name;
      edPass.Text := Players[cUser].Pass;
      LoadsEdit.Text := (IntToStr(Players[cUser].Integers[0]));
      BankPinEdit.Text := Players[cUser].Strings[0];
      RunAwayDir.Text := Players[cUser].Strings[1];
      if (Players[cUser].Booleans[0] = True) Then
        NetOrPowerCombo.Text := 'True'
      else
        NetOrPowerCombo.Text := 'False';
      if (Players[cUser].Active) then
        ActiveCheckBox.Checked := True
      else
        ActiveCheckBox.Checked := False;
    end;

    {*******************************************************************************
    procedure BackUser(Sender : TObject);
    By: RsN
    Description:
    *******************************************************************************}


    procedure BackUser(Sender: TObject);
    begin
      Players[cUser].Name := edUser.Text;
      Players[cUser].Pass := edPass.Text;
      Players[cUser].Integers[0] := (StrToInt(LoadsEdit.Text));
      If (ActiveCheckBox.Checked = True) Then
        Players[cUser].Active := True
      else
        Players[cUser].Active := False;
      If (BankPinCheckBox.Checked = True) Then
        Players[cUser].Strings[0] := BankPinEdit.Text
      else
        Players[cUser].Strings[0] := '';
      Players[cUser].Strings[1] := RunAwayDir.Text;
      If (NetOrPowerCombo.Text = 'Bank') Then
        Players[cUser].Booleans[0] := True
      else
        Players[cUser].Booleans[0] := False;
        Players[cUser].Extendeds[0] := 0;
        Players[cUser].Extendeds[1] := 0;
        Players[cUser].Extendeds[2] := 0;
      if (cUser + 1 > GetArrayLength(Players) - 1) then
        cUser := 0
      else
        cUser := cUser + 1;
      NameNumber.Caption := IntToStr(cUser);
      PassNumber.Caption := IntToStr(cUser);
      LoadsNumber.Caption := IntToStr(cUser);
      DirNumber.Caption := IntToStr(cUser);
      edUser.Text := Players[cUser].Name;
      edPass.Text := Players[cUser].Pass;
      LoadsEdit.Text := (IntToStr(Players[cUser].Integers[0]));
      BankPinEdit.Text := Players[cUser].Strings[0];
      RunAwayDir.Text := Players[cUser].Strings[1];
      if (Players[cUser].Booleans[0] = True) Then
        NetOrPowerCombo.Text := 'True'
      else
        NetOrPowerCombo.Text := 'False';
      if (Players[cUser].Active) then
        ActiveCheckBox.Checked := True
      else
        ActiveCheckBox.Checked := False;
    end;

    {*******************************************************************************
    procedure DeleteUser(Sender : TObject);
    By: RsN
    Description:
    *******************************************************************************}


    procedure DeleteUser(Sender: TObject);
    var
      na: string;
      lo : Integer;
      ac : Boolean;
    begin
      na := Players[GetArrayLength(Players) - 1].Name;
      ac := Players[GetArrayLength(Players) - 1].Active;
      lo := Players[GetArrayLength(Players) - 1].Integers[0];

      Players[cUser].Name := na;
      Players[cUser].Integers[0] := lo;
      If (NetOrPowerCombo.Text = 'Bank') Then
        Players[GetArrayLength(Players) - 1].Booleans[0] := True
      else
        Players[GetArrayLength(Players) - 1].Booleans[0] := False;
      Players[cUser].Active := ac;
      SetArrayLength(Players, GetArrayLength(Players) - 1);
      if (cUser + 1 > GetArrayLength(Players) - 1) then
        cUser := 0
      else
        cUser := cUser + 1;
      NameNumber.Caption := IntToStr(cUser);
      PassNumber.Caption := IntToStr(cUser);
      LoadsNumber.Caption := IntToStr(cUser);
      DirNumber.Caption := IntToStr(cUser);
      edUser.Text := Players[cUser].Name;
      edPass.Text := Players[cUser].Pass;
      LoadsEdit.Text := (IntToStr(Players[cUser].Integers[0]));
      BankPinEdit.Text := Players[cUser].Strings[0];
      RunAwayDir.Text := Players[cUser].Strings[1];
      if (Players[cUser].Booleans[0] = True) Then
        NetOrPowerCombo.Text := 'True'
      else
        NetOrPowerCombo.Text := 'False';
      if (Players[cUser].Booleans[0] = True) Then
        NetOrPowerCombo.Text := 'True'
      else
        NetOrPowerCombo.Text := 'False';
      if (Players[cUser].Active) then
        ActiveCheckBox.Checked := True
      else
        ActiveCheckBox.Checked := False;
    end;

    {*******************************************************************************
    procedure Start(Sender : TObject);
    By: RsN
    Description:
    *******************************************************************************}


    procedure Start(Sender: TObject);
    begin
      NameNumber.Caption := IntToStr(cUser);
      PassNumber.Caption := IntToStr(cUser);
      LoadsNumber.Caption := IntToStr(cUser);
      DirNumber.Caption := IntToStr(cUser);
      edUser.Text := Players[cUser].Name;
      edPass.Text := Players[cUser].Pass;
      LoadsEdit.Text := (IntToStr(Players[cUser].Integers[0]));
      BankPinEdit.Text := Players[cUser].Strings[0];
      RunAwayDir.Text := Players[cUser].Strings[1];
      if (Players[cUser].Booleans[0] = True) Then
        NetOrPowerCombo.Text := 'True'
      else
        NetOrPowerCombo.Text := 'False';
      if (Players[cUser].Booleans[0] = True) Then
        NetOrPowerCombo.Text := 'True'
      else
        NetOrPowerCombo.Text := 'False';
      if (Players[cUser].Active) then
        ActiveCheckBox.Checked := True
      else
        ActiveCheckBox.Checked := False;
    end;





    Procedure CheckVersion;
    Var
      Version : String;
    Begin
      ClearDebug;
      SPanel1.Text := ('Checking SCAR Version..');
      If not(GetSCARVersion >= 311) then
      begin
        SPanel1.Text := (' >> You Need SCAR Divi 3.11 or above to Run this Script!');
        SPanel1.Text := (' >> Please Download it from http://www.freddy1990.com/scar.php');
        TerminateScript;
      end;
      SPanel1.Text := ('SCAR Version.. OK!  You have SCAR '+IntToStr(GetSCARVersion));
      SPanel1.Text := ('Checking Script Version..');
      Version := (Getpage('http://itschris917.freehostia.com/DraynorNetter/DNCurrentVersion.txt'));
      If not(VerNumber = Version) and not(Version = '')then
      Begin
        Writeln('');
        Writeln(' ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~             ');
        Writeln('          Draynor Netter Ver ' +Version+ ' Released!');
        Writeln('               Your Version : '+VerNumber                        );
        Writeln('     It is Recommended that you Update your Script!             ');
        Writeln(' ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~             ');
        Writeln('');
        If(GetApplication.MessageBox('Draynor Netter Ver ' +Version+ ' Released!' +Chr(13)+ 'Your Version : '+VerNumber + Chr(13)+ 'Press "OK" to Cancel the Script Run and Download the new Version!', 'New Version Released', 1) = 1) then
        Begin
          OpenWebPage('http://itschris917.freehostia.com/DraynorNetter/DNCurrentVersion.scar');
          TerminateScript;
        End;
      end else
        SPanel1.Text := ('Latest Script Version... OK!');
    end;

    Procedure UponLoading;
    Begin
      CDNBLabel.Visible := True;
      ChrisDraynorNetterBankerLabel.Visible := True;
      NewsBox.Visible := True;
      ScriptStart.Visible := True;
      NewsButton.Visible := True;
      TotalScriptRunsLabel.Visible := True;
      TotalScriptRunsLabel1.Visible := True;
      TotalFishies.Visible := True;
      TotalFishiesCaught.Visible := True;
      ResetBtn.Visible := True;
      TotalShrimps.Visible := True;
      UpdateScriptBtn.Visible := True;
      StatusBar.SimpleText := 'Draynor Netter by ITSCHRIS917';

      NameLabel.Visible := False;
      PassLabel.Visible := False;
      LoadsLabel.Visible := False;
      NameNumber.Visible := False;
      PassNumber.Visible := False;
      LoadsNumber.Visible := False;
      DirNumber.Visible := False;
      RunAwayLabel.Visible := False;
      CreateBtn.Visible := False;
      DeleteBtn.Visible := False;
      BackBtn.Visible := False;
      NextBtn.Visible := False;
      EdUser.Visible := False;
      EdPass.Visible := False;
      ActiveCheckBox.Visible := False;
      BankPinCheckBox.Visible := False;
      BankPinEdit.Visible := False;
      RunAwayDir.Visible := False;
      LoadsEdit.Visible := False;
      NetOrPowerCombo.Visible := False;
      SecondsEdit.Visible := False;
      Seconds.Visible := False;
      OkBtn.Visible := False;
      ResetBtn.Visible := False;
      TotalScriptRunsLabel.Visible := False;
    End;



    Procedure PlayerSetupVisible;
    Begin
      NameLabel.Visible := True;
      PassLabel.Visible := True;
      LoadsLabel.Visible := True;
      NameNumber.Visible := True;
      PassNumber.Visible := True;
      LoadsNumber.Visible := True;
      DirNumber.Visible := True;
      RunAwayLabel.Visible := True;
      CreateBtn.Visible := True;
      DeleteBtn.Visible := True;
      BackBtn.Visible := True;
      NextBtn.Visible := True;
      EdUser.Visible := True;
      EdPass.Visible := True;
      ActiveCheckBox.Visible := True;
      BankPinCheckBox.Visible := True;
      BankPinEdit.Visible := False;
      RunAwayDir.Visible := True;
      LoadsEdit.Visible := True;
      NetOrPowerCombo.Visible := True;
      SecondsEdit.Visible := True;
      Seconds.Visible := True;
      OkBtn.Visible := True;
      OkBtn.Left := 156;

      CDNBLabel.Visible := False;
      ChrisDraynorNetterBankerLabel.Visible := False;
      NewsBox.Visible := False;
      ScriptStart.Visible := False;
      NewsButton.Visible := False;
      TotalScriptRunsLabel.Visible := False;
      TotalScriptRunsLabel1.Visible := False;
      TotalFishies.Visible := False;
      TotalFishiesCaught.Visible := False;
      ResetBtn.Visible := False;
      TotalShrimps.Visible := False;
      UpdateScriptBtn.Visible := False;
    End;

    Procedure ScriptStatsVisible;
    Begin
      NameLabel.Visible := False;
      PassLabel.Visible := False;
      LoadsLabel.Visible := False;
      NameNumber.Visible := False;
      PassNumber.Visible := False;
      LoadsNumber.Visible := False;
      DirNumber.Visible := False;
      RunAwayLabel.Visible := False;
      CreateBtn.Visible := False;
      DeleteBtn.Visible := False;
      BackBtn.Visible := False;
      NextBtn.Visible := False;
      EdUser.Visible := False;
      EdPass.Visible := False;
      ActiveCheckBox.Visible := False;
      BankPinCheckBox.Visible := False;
      BankPinEdit.Visible := False;
      RunAwayDir.Visible := False;
      LoadsEdit.Visible := False;
      NetOrPowerCombo.Visible := False;
      SecondsEdit.Visible := False;
      Seconds.Visible := False;
      CDNBLabel.Visible := False;
      ChrisDraynorNetterBankerLabel.Visible := False;
      ScriptStart.Visible := False;
      NewsBox.Visible := False;
      NewsButton.Visible := False;
      UpdateScriptBtn.Visible := False;

      TotalScriptRunsLabel.Visible := True;
      TotalScriptRunsLabel1.Visible := True;
      OkBtn.Visible := True;
      TotalFishies.Visible := True;
      TotalFishiesCaught.Visible := True;
      ResetBtn.Visible := True;
      TotalShrimps.Visible := True;
      OkBtn.Left := 200;
    End;



    function getCFGData(dName : String): String;
    var
      tString: String;
    begin
      Result := '';
      tString := dName + '=';
      if(Pos(tString, dFile) = 0)then
        Exit;
      Result := dFile;
      Delete(Result, 1, Pos(tString, dFile));
      Result := Copy(Result, Length(tString), Pos(Chr(13), Result) - Length(tString));
    end;

    /////////////////////////////////////////////////////
    //          Loads global report                    //
    /////////////////////////////////////////////////////

    procedure LoadGlobalReport;
    begin
      Status ( 'Loading Global Report from Data File');
      aFile := OpenFile ( AppPath + 'CDNBGlobalReport.DAT', False);
      if(aFile < 0)then
        Exit;

      ReadFileString(aFile, dFile, FileSize(aFile));

      TotalScriptRunsInForm := StrToFloat ( getCFGData ( 'Total Script Runs'  ));
      TotalFishInForm       := StrToFloat ( getCFGData ( 'Total Fish'  ));
      TotalLoadsInForm      := StrToFloat ( getCFGData ( 'Total Loads' ));
      TotalAnchoviesInForm  := StrToFloat ( getCFGData ( 'Total Anchovies' ));
      TotalShrimpInForm     := StrToFloat ( getCFGData ( 'Total Shrimp' ));
      //TotalEXP        := StrToFloat ( getCFGData ( 'Total EXP ' ));

      CloseFile(aFile);
    end;

    /////////////////////////////////////////////////////////////
    //                Saves global report                      //
    /////////////////////////////////////////////////////////////

    procedure SaveGlobalReport;
    begin
      Status ('Saving Progress Report to Data File');
      aFile := ReWriteFile(AppPath + 'CDNBGlobalReport.DAT', False);
      WriteFileString(aFile, 'Total Script Runs='  + FloatToStr( TotalScriptRuns ) + Chr(13));
      WriteFileString(aFile, 'Total Fish='  + FloatToStr( TotalFish ) + Chr(13));
      WriteFileString(aFile, 'Total Loads='  + FloatToStr( TotalLoads ) + Chr(13));
      WriteFileString(aFile, 'Total Anchovies=' + FloatToStr( TotalAnchovies ) + Chr(13));
      WriteFileString(aFile, 'Total Shrimp=' + FloatToStr( TotalShrimp ) + Chr(13));
      WriteFileString(aFile, 'Total EXP=' + FloatToStr( TotalEXP ) + Chr(13));
      CloseFile(aFile);

    end;

    function StrToBol(str : string) : boolean;
    begin
      result := lowercase(str) = 'true';
    end;

    procedure Reset(Sender:TObject);
    begin
      TotalScriptRuns := 0;
      TotalFish := 0;
      TotalShrimp := 0;
      SaveGlobalReport;
    end;

    Procedure ChangeTabs(Sender : TObject);
    var
      v: TVariantArray;
    begin
      SetArrayLength(V, 0);
      If(Sender IS TTabControl) Then
        Case (TTabControl(Sender).TabIndex) Of
          0 : Begin
                UponLoading;
              End;
          1 : Begin
                PlayerSetupVisible;
              End;
          2 : Begin
                ScriptStatsVisible;
              End;
        End;
    End;

    Procedure ClickBtn(Sender : TObject);
    Var
      v: TVariantArray;
      Timer, i, x, y, Temp, HowMany: integer;
      News : Array of String;
      New, TheNews : String;
    Begin
      SetArrayLength(V, 0);
      If(Sender IS TButton) Then
        Case (TButton(Sender).Tag) Of
          1 : Begin
                SaveGlobalReport;
                frmDesign.ModalResult := mrOK;
              End;
          2 : Begin
                NewsBox.Lines.Clear;
                TheNews := Getpage('http://itschris917.freehostia.com/DraynorNetter/DraynorNetterNews.txt');
                NewsBox.Lines.Add(' >> Latest CDNB News:');
                NewsBox.Lines.Add('    =================');
                For Temp := 1 to Length(TheNews) do
                  If(Copy(TheNews, Temp, 1) = ',') then
                    HowMany := HowMany + 1;
                  x := 0;
                  y := 1;
                  SetArrayLength(News, HowMany+1);
                  For i := 1 to HowMany do
                  Begin
                    MarkTime(Timer);
                    repeat
                      x := x + 1;
                      new := copy(TheNews, x, x+1);
                    until(copy(new, 1, 1) = ',')or(TimeFromMark(Timer) >= 2000);
                  news[i]:= copy(TheNews, y, (x-y));
                  y := x + 1;
                  Wait(1);
                End;
                For i := 1 to HowMany do
                  NewsBox.Lines.Add(' o  '+news[i]);
                End;
          3 : Begin
                Tabs.TabIndex := 0;
                Tabs.OnChange := @ChangeTabs;
                SaveGlobalReport;
                UponLoading;
              End;
          4 : Begin
                CheckVersion;
              End;
          End;
    End;



    Procedure ShowPinEdit(Sender : TObject);
    Var
      V: TVariantArray;
    Begin
      SetArrayLength(V, 0);
      Case (BankPinCheckBox.Checked) Of
        True : Begin
                 BankPinEdit.Visible := True;
               End;

        False: Begin
                 BankPinEdit.Visible := False;
               End;
      End;
    End;


    Procedure InitForm;
    Var
     Timer, i, x, y, Temp, HowMany: integer;
      News : Array of String;
      New, TheNews : String;
    Begin

    frmDesign := CreateForm;
    frmDesign.Left := 563;
    frmDesign.Top := 125;
    frmDesign.Width := 388;
    frmDesign.Height := 350;
    frmDesign.Caption := 'CDNB (Chris Draynor Netter Banker)';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -11;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := False;
    frmDesign.PixelsPerInch := 96;
    frmDesign.OnShow := @Start;

    CDNBLabel := TLabel.Create(frmDesign);
    CDNBLabel.Parent := frmDesign;
    CDNBLabel.Left := 115;
    CDNBLabel.Top := 34;
    CDNBLabel.Width := 110;
    CDNBLabel.Height := 38;
    CDNBLabel.Caption := 'CDNB';
    CDNBLabel.Font.Color := clWindowText;
    CDNBLabel.Font.Height := -31;
    CDNBLabel.Font.Name := 'Calligraph421 BT';
    CDNBLabel.Font.Style := [];
    CDNBLabel.ParentFont := False;

    ChrisDraynorNetterBankerLabel := TLabel.Create(frmDesign);
    ChrisDraynorNetterBankerLabel.Parent := frmDesign;
    ChrisDraynorNetterBankerLabel.Left := 88;
    ChrisDraynorNetterBankerLabel.Top := 75;
    ChrisDraynorNetterBankerLabel.Width := 203;
    ChrisDraynorNetterBankerLabel.Height := 20;
    ChrisDraynorNetterBankerLabel.Caption := 'Chris Draynor Netter Banker';
    ChrisDraynorNetterBankerLabel.Font.Color := clWindowText;
    ChrisDraynorNetterBankerLabel.Font.Height := -16;
    ChrisDraynorNetterBankerLabel.Font.Name := 'Calligraph421 BT';
    ChrisDraynorNetterBankerLabel.Font.Style := [];
    ChrisDraynorNetterBankerLabel.ParentFont := False;

    NameLabel := TLabel.Create(frmDesign);
    NameLabel.Parent := frmDesign;
    NameLabel.Left := 74;
    NameLabel.Top := 88;
    NameLabel.Width := 31;
    NameLabel.Height := 13;
    NameLabel.Caption := 'Name:';

    PassLabel := TLabel.Create(frmDesign);
    PassLabel.Parent := frmDesign;
    PassLabel.Left := 74;
    PassLabel.Top := 110;
    PassLabel.Width := 26;
    PassLabel.Height := 13;
    PassLabel.Caption := 'Pass:';

    LoadsLabel := TLabel.Create(frmDesign);
    LoadsLabel.Parent := frmDesign;
    LoadsLabel.Left := 74;
    LoadsLabel.Top := 135;
    LoadsLabel.Width := 32;
    LoadsLabel.Height := 13;
    LoadsLabel.Caption := 'Loads:';

    NameNumber := TLabel.Create(frmDesign);
    NameNumber.Parent := frmDesign;
    NameNumber.Left := 57;
    NameNumber.Top := 89;
    NameNumber.Width := 9;
    NameNumber.Height := 13;
    NameNumber.Caption := '0.';

    PassNumber := TLabel.Create(frmDesign);
    PassNumber.Parent := frmDesign;
    PassNumber.Left := 57;
    PassNumber.Top := 110;
    PassNumber.Width := 9;
    PassNumber.Height := 13;
    PassNumber.Caption := '0.';

    LoadsNumber := TLabel.Create(frmDesign);
    LoadsNumber.Parent := frmDesign;
    LoadsNumber.Left := 57;
    LoadsNumber.Top := 136;
    LoadsNumber.Width := 9;
    LoadsNumber.Height := 13;
    LoadsNumber.Caption := '0.';

    DirNumber := TLabel.Create(frmDesign);
    DirNumber.Parent := frmDesign;
    DirNumber.Left := 57;
    DirNumber.Top := 162;
    DirNumber.Width := 9;
    DirNumber.Height := 13;
    DirNumber.Caption := '0.';

    RunAwayLabel := TLabel.Create(frmDesign);
    RunAwayLabel.Parent := frmDesign;
    RunAwayLabel.Left := 74;
    RunAwayLabel.Top := 161;
    RunAwayLabel.Width := 52;
    RunAwayLabel.Height := 13;
    RunAwayLabel.Caption := 'Run Away:';

    Tabs := TTabControl.Create(frmDesign);
    Tabs.Parent := frmDesign;
    Tabs.Left := 0;
    Tabs.Top := 0;
    Tabs.Width := 380;
    Tabs.Height := 33;
    Tabs.TabOrder := 8;
    Tabs.Tabs.Add('Latest News');
    Tabs.Tabs.Add('Player Setup');
    Tabs.Tabs.Add('Script Stats');
    Tabs.Tabs.Add('Script Settings');
    Tabs.Tabs.Add('Version History');
    Tabs.TabIndex := 0;
    Tabs.OnChange := @ChangeTabs;

    NewsBox := TRichEdit.Create(frmDesign);
    NewsBox.Parent := frmDesign;
    NewsBox.Left := 71;
    NewsBox.Top := 95;
    NewsBox.Width := 270;
    NewsBox.Height := 125;
    NewsBox.TabOrder := 9;
    NewsBox.Lines.Add('');
    TheNews := Getpage('http://itschris917.freehostia.com/DraynorNetter/DraynorNetterNews.txt');
    NewsBox.Lines.Add(' >> Latest CDNB News:');
    NewsBox.Lines.Add('    =================');
     For Temp := 1 to Length(TheNews) do
        If(Copy(TheNews, Temp, 1) = ',') then
          HowMany := HowMany + 1;
      x := 0;
      y := 1;
      SetArrayLength(News, HowMany+1);
      For i := 1 to HowMany do
      Begin
        MarkTime(Timer);
        repeat
          x := x + 1;
          new := copy(TheNews, x, x+1);
        until(copy(new, 1, 1) = ',')or(TimeFromMark(Timer) >= 2000);
        news[i]:= copy(TheNews, y, (x-y));
        y := x + 1;
        Wait(1);
      end;
      For i := 1 to HowMany do
      NewsBox.Lines.Add(' o  '+news[i]);

    ScriptStart := TButton.Create(frmDesign);
    ScriptStart.Parent := frmDesign;
    ScriptStart.Left := 90;
    ScriptStart.Top := 226;
    ScriptStart.Width := 89;
    ScriptStart.Height := 25;
    ScriptStart.Caption := 'Start Script!';
    ScriptStart.TabOrder := 10;
    ScriptStart.Tag := 1;
    ScriptStart.OnClick := @ClickBtn;

    NewsButton := TButton.Create(frmDesign);
    NewsButton.Parent := frmDesign;
    NewsButton.Left := 187 + 30;
    NewsButton.Top := 226;
    NewsButton.Width := 103;
    NewsButton.Height := 25;
    NewsButton.Caption := 'Re-download News';
    NewsButton.TabOrder := 11;
    NewsButton.Tag := 2;
    NewsButton.OnClick := @ClickBtn;

    CreateBtn := TButton.Create(frmDesign);
    CreateBtn.Parent := frmDesign;
    CreateBtn.Left := 115;
    CreateBtn.Top := 45;
    CreateBtn.Width := 75;
    CreateBtn.Height := 25;
    CreateBtn.Caption := 'Create Player';
    CreateBtn.TabOrder := 12;
    CreateBtn.Tag := 5;
    CreateBtn.OnClick := @CreateUser;

    DeleteBtn := TButton.Create(frmDesign);
    DeleteBtn.Parent := frmDesign;
    DeleteBtn.Left := 196;
    DeleteBtn.Top := 45;
    DeleteBtn.Width := 75;
    DeleteBtn.Height := 25;
    DeleteBtn.Caption := 'Delete Player';
    DeleteBtn.TabOrder := 13;
    DeleteBtn.Tag := 6;
    DeleteBtn.OnClick := @DeleteUser;

    BackBtn := TButton.Create(frmDesign);
    BackBtn.Parent := frmDesign;
    BackBtn.Left := 68;
    BackBtn.Top := 45;
    BackBtn.Width := 43;
    BackBtn.Height := 25;
    BackBtn.Caption := '<--';
    BackBtn.TabOrder := 14;
    BackBtn.Tag := 7;
    BackBtn.OnClick := @BackUser

    NextBtn := TButton.Create(frmDesign);
    NextBtn.Parent := frmDesign;
    NextBtn.Left := 277;
    NextBtn.Top := 45;
    NextBtn.Width := 43;
    NextBtn.Height := 25;
    NextBtn.Caption := '-->';
    NextBtn.TabOrder := 15;
    NextBtn.Tag := 8;
    NextBtn.OnClick := @ForwardUser;

    EdUser := TEdit.Create(frmDesign);
    EdUser.Parent := frmDesign;
    EdUser.Left := 127;
    EdUser.Top := 83;
    EdUser.Width := 121;
    EdUser.Height := 21;
    EdUser.Hint := 'Enter your username here..';
    EdUser.ParentShowHint := False;
    EdUser.ShowHint := True;
    EdUser.TabOrder := 16;

    EdPass := TEdit.Create(frmDesign);
    EdPass.Parent := frmDesign;
    EdPass.Left := 127;
    EdPass.Top := 107;
    EdPass.Width := 121;
    EdPass.Height := 21;
    EdPass.Hint := 'Enter your password here..';
    EdPass.ParentShowHint := False;
    EdPass.PasswordChar := 'X';
    EdPass.ShowHint := True;
    EdPass.TabOrder := 17;

    LoadsEdit := TEdit.Create(frmDesign);
    LoadsEdit.Parent := frmDesign;
    LoadsEdit.Left := 127;
    LoadsEdit.Top := 133;
    LoadsEdit.Width := 121;
    LoadsEdit.Height := 21;
    LoadsEdit.ParentShowHint := False;
    LoadsEdit.ShowHint := True;
    LoadsEdit.TabOrder := 18;

    RunAwayDir := TComboBox.Create(frmDesign);
    RunAwayDir.Parent := frmDesign;
    RunAwayDir.Left := 127;
    RunAwayDir.Top := 158;
    RunAwayDir.Width := 124;
    RunAwayDir.Height := 21;
    RunAwayDir.Hint := 'Which direction to run to if we encounter a fight.';
    RunAwayDir.ItemHeight := 13;
    RunAwayDir.ParentShowHint := False;
    RunAwayDir.ShowHint := True;
    RunAwayDir.TabOrder := 19;
    RunAwayDir.Items.Add('N');
    RunAwayDir.Items.Add('E');
    RunAwayDir.Items.Add('S');
    RunAwayDir.Items.Add('W');

    NetOrPowerCombo := TComboBox.Create(frmDesign);
    NetOrPowerCombo.Parent := frmDesign;
    NetOrPowerCombo.Left := 22;
    NetOrPowerCombo.Top := 188;
    NetOrPowerCombo.Width := 107;
    NetOrPowerCombo.Height := 21;
    NetOrPowerCombo.Hint := 'Bank or Power-fish';
    NetOrPowerCombo.ItemHeight := 13;
    NetOrPowerCombo.ParentShowHint := False;
    NetOrPowerCombo.ShowHint := True;
    NetOrPowerCombo.TabOrder := 24;
    NetOrPowerCombo.Items.Add('Bank');
    NetOrPowerCombo.Items.Add('Power');

    SecondsEdit := TEdit.Create(frmDesign);
    SecondsEdit.Parent := frmDesign;
    SecondsEdit.Left := 225;
    SecondsEdit.Top := 189;
    SecondsEdit.Width := 121;
    SecondsEdit.Height := 21;
    SecondsEdit.Hint := 'Seconds to wait before clicking on fishing spot again(Failsafe)';
    SecondsEdit.ParentShowHint := False;
    SecondsEdit.ShowHint := True;
    SecondsEdit.TabOrder := 25;

    Seconds := TLabel.Create(frmDesign);
    Seconds.Parent := frmDesign;
    Seconds.Left := 165;
    Seconds.Top := 192;
    Seconds.Width := 48;
    Seconds.Height := 13;
    Seconds.Caption := 'Seconds: ';

    ActiveCheckBox := TCheckBox.Create(frmDesign);
    ActiveCheckBox.Parent := frmDesign;
    ActiveCheckBox.Left := 256;
    ActiveCheckBox.Top := 104;
    ActiveCheckBox.Width := 97;
    ActiveCheckBox.Height := 17;
    ActiveCheckBox.Hint := 'Is the current player active?';
    ActiveCheckBox.Caption := 'Active?';
    ActiveCheckBox.ParentShowHint := False;
    ActiveCheckBox.ShowHint := True;
    ActiveCheckBox.TabOrder := 20;

    BankPinCheckBox := TCheckBox.Create(frmDesign);
    BankPinCheckBox.Parent := frmDesign;
    BankPinCheckBox.Left := 256;
    BankPinCheckBox.Top := 131;
    BankPinCheckBox.Width := 97;
    BankPinCheckBox.Height := 17;
    BankPinCheckBox.Hint := 'Does the current player have a bank pin?';
    BankPinCheckBox.Caption := 'Bank Pin?';
    BankPinCheckBox.ParentShowHint := False;
    BankPinCheckBox.ShowHint := True;
    BankPinCheckBox.TabOrder := 21;
    BankPinCheckBox.OnClick := @ShowPinEdit;

    BankPinEdit := TEdit.Create(frmDesign);
    BankPinEdit.Parent := frmDesign;
    BankPinEdit.Left := 257;
    BankPinEdit.Top := 160;
    BankPinEdit.Width := 121;
    BankPinEdit.Height := 21;
    BankPinEdit.TabOrder := 22;
    BankPinEdit.Visible := False;

    OkBtn := TButton.Create(frmDesign);
    OkBtn.Parent := frmDesign;
    OkBtn.Left := 156;
    OkBtn.Top := 226;
    OkBtn.Width := 75;
    OkBtn.Height := 25;
    OkBtn.Caption := 'OK!';
    OkBtn.TabOrder := 26;
    OkBtn.Tag := 3;
    OkBtn.OnClick := @ClickBtn;

    ResetBtn := TButton.Create(frmDesign);
    ResetBtn.Parent := frmDesign;
    ResetBtn.Left := 75;
    ResetBtn.Top := 226;
    ResetBtn.Width := 75;
    ResetBtn.Height := 25;
    ResetBtn.Caption := 'Reset';
    ResetBtn.TabOrder := 26;
    ResetBtn.OnClick := @Reset;

    TotalScriptRunsLabel := TLabel.Create(frmDesign);
    TotalScriptRunsLabel.Parent := frmDesign;
    TotalScriptRunsLabel.Left := 95;
    TotalScriptRunsLabel.Top := 80;
    TotalScriptRunsLabel.Width := 35;
    TotalScriptRunsLabel.Height := 25;
    TotalScriptRunsLabel.Caption := 'Total Script Runs:';

    TotalScriptRunsLabel1 := TLabel.Create(frmDesign);
    TotalScriptRunsLabel1.Parent := frmDesign;
    TotalScriptRunsLabel1.Left := 210;
    TotalScriptRunsLabel1.Top := 80;
    TotalScriptRunsLabel1.Width := 35;
    TotalScriptRunsLabel1.Height := 25;
    TotalScriptRunsLabel1.Caption := FloatToStr(TotalScriptRuns);

    TotalFishies := TLabel.Create(frmDesign);
    TotalFishies.Parent := frmDesign;
    TotalFishies.Left := 95;
    TotalFishies.Top := 110;
    TotalFishies.Width := 35;
    TotalFishies.Height := 25;
    TotalFishies.Caption := 'Total fish caught:';

    TotalFishiesCaught := TLabel.Create(frmDesign);
    TotalFishiesCaught.Parent := frmDesign;
    TotalFishiesCaught.Left := 210;
    TotalFishiesCaught.Top := 110;
    TotalFishiesCaught.Width := 35;
    TotalFishiesCaught.Height := 25;
    TotalFishiesCaught.Caption := FloatToStr(TotalFish);

    TotalShrimps := TLabel.Create(frmDesign);
    TotalShrimps.Parent := frmDesign;
    TotalShrimps.Left := 95;
    TotalShrimps.Top := 140;
    TotalShrimps.Width := 35;
    TotalShrimps.Height := 25;
    TotalShrimps.Caption := 'Total shrimp caught:';

    TotalShrimpCaught := TLabel.Create(frmDesign);
    TotalShrimpCaught.Parent := frmDesign;
    TotalShrimpCaught.Left := 210;
    TotalShrimpCaught.Top := 140;
    TotalShrimpCaught.Width := 35;
    TotalShrimpCaught.Height := 25;
    TotalShrimpCaught.Caption := FloatToStr(TotalShrimp);

    UpdateScriptBtn := TButton.Create(frmDesign);
    UpdateScriptBtn.Parent := frmDesign;
    UpdateScriptBtn.Left := 160;
    UpdateScriptBtn.Top := 270;
    UpdateScriptBtn.Width := 115;
    UpdateScriptBtn.Height := 25;
    UpdateScriptBtn.Caption := 'Check Script Version!';
    UpdateScriptBtn.Tag := 4;
    UpdateScriptBtn.OnClick := @ClickBtn;

    StatusBar := TStatusBar.Create(frmDesign);
    StatusBar.Parent := frmDesign;
    StatusBar.Left := 0;
    StatusBar.Top := 299;
    StatusBar.Width := 380;

    SPanel1 := StatusBar.Panels.Add;
    SPanel1.Text := 'Draynor Netter by ITSCHRIS917';


    End;

    procedure SafeShowWF;
    var
      tva: TVariantArray;
    begin
      setarraylength(tva, 0);
      ThreadSafeCall('InitForm', tva);
    end;

    procedure ShowFormModal;
    begin
      frmDesign.ShowModal
    end;

    procedure SafeShowFormModal;
    var
      tva: TVariantArray;
    begin
      setarraylength(tva, 0);
      ThreadSafeCall('ShowFormModal', tva);
    end;

    procedure Form;
    begin
      LoadPlayers(True);
      cUser := 0;
      if (GetArrayLength(Players) = 0) then
        AddUser;
      SafeShowWF;
      UponLoading;
      SafeShowFormModal;
      SavePlayers;
    end;

    begin
      LoadGlobalReport
      {TotalShrimp := TotalShrimpInForm + 432;
      TotalScriptRuns := TotalScriptRunsInForm + 1;
      TotalFish := TotalFishInForm + 567;}

      SaveGlobalReport;
      Form;
      FreeForm(frmDesign);
    end.
    help is greatly appreciated!

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    2,984
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    SetupSRL; might be a start
    Administrator's Warning:


  3. #3
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I swear to god, if that's it, im going to fucking kill myself....

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    2,984
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Prepare the gun.
    Administrator's Warning:


  5. #5
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, so i've made a few changes to my form.. And now i get a runtime error.. Here it is:

    SCAR Code:
    [Runtime Error] : Exception: Invalid float in line 1047 in script C:\Program Files\SCAR 3.11\Scripts\CDNB Form multi-player.scar

    here's the new form if you need it, it only occurs when the script tries to load players first..

    SCAR Code:
    program New;
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Core\Users.scar}
    var
      frmDesign : TForm;
      CDNBLabel : TLabel;
      ChrisDraynorNetterBankerLabel : TLabel;
      NameLabel : TLabel;
      PassLabel : TLabel;
      LoadsLabel : TLabel;
      NameNumber : TLabel;
      PassNumber : TLabel;
      LoadsNumber : TLabel;
      DirNumber : TLabel;
      RunAwayLabel : TLabel;
      Tabs : TTabControl;
      NewsBox : TRichEdit;
      ScriptStart : TButton;
      NewsButton : TButton;
      CreateBtn : TButton;
      DeleteBtn : TButton;
      BackBtn : TButton;
      NextBtn : TButton;
      EdUser : TEdit;
      EdPass : TEdit;
      ActiveCheckBox : TCheckBox;
      BankPinCheckBox : TCheckBox;
      BankPinEdit : TEdit;
      RunAwayDir : TComboBox;
      LoadsEdit : TEdit;
      NetOrPowerCombo : TComboBox;
      SecondsEdit : TEdit;
      Seconds : TLabel;
      OkBtn : TButton;
      TotalScriptRunsLabel1 : TLabel;
      TotalScriptRunsLabel : TLabel;
      TotalScriptRuns, TotalFish, TotalLoads, TotalAnchovies  : Extended;
      TotalShrimp, TotalEXP : Extended;
      TotalScriptRunsInForm, TotalFishInForm, TotalLoadsInForm, TotalAnchoviesInForm  : Extended;
      TotalShrimpInForm : Extended;
      TotalFishies : TLabel;
      TotalFishiesCaught, TotalShrimps, TotalShrimpCaught : TLabel;
      dFile : String;
      aFile : Integer;
      ResetBtn : TButton;
      UpdateScriptBtn : TButton;
      StatusBar : TStatusBar;
      SPanel1 : TStatusPanel;

    Const  VerNumber = '.85b';

    Procedure LoadGlobalReport;Forward;






    { ---------------------------------------------------------------------------- ]
    [  >>  Saves Current Options Selected for Switching Players                    ]
    [ ---------------------------------------------------------------------------- }


    Procedure SavePlayersInForm;
    Begin
      Players[CurrentPlayer].Name := EdUser.Text;
      Players[CurrentPlayer].Pass := EdPass.Text;
      Players[CurrentPlayer].Strings[0] := BankPinEdit.Text;
      Players[CurrentPlayer].Strings[1] := RunAwayDir.Text;
      Players[CurrentPlayer].Active := ActiveCheckBox.Checked;
      If (Players[CurrentPlayer].Booleans[0] = True) Then
        NetOrPowerCombo.Text := 'Bank'
      Else
        NetOrPowerCombo.Text := 'Power';
      Players[CurrentPlayer].Integers[0] := StrToIntDef(LoadsEdit.Text, 0);
      Players[CurrentPlayer].Integers[1] := StrToIntDef(SecondsEdit.Text, 0);
      Players[CurrentPlayer].Extendeds[0] := 0;
      Players[CurrentPlayer].Extendeds[1] := 0;
      Players[CurrentPlayer].Extendeds[2] := 0;
    end;

    { ---------------------------------------------------------------------------- ]
    [  >>  Loads Current Options Selected for Switching Players                    ]
    [ ---------------------------------------------------------------------------- }


    Procedure LoadPlayersInForm;
    Begin
      try
        EdUser.text := Players[CurrentPlayer].Name;
        EdPass.Text := Players[CurrentPlayer].Pass;
        BankPinEdit.Text := Players[CurrentPlayer].Strings[0];
        RunAwayDir.Text := Players[CurrentPlayer].Strings[1];
        ActiveCheckBox.Checked := Players[CurrentPlayer].Active;
        If (NetOrPowerCombo.Text = 'Bank') Then
          Players[CurrentPlayer].Booleans[0] := True
        Else
          Players[CurrentPlayer].Booleans[0] := False;
        If (Players[CurrentPlayer].Integers[0] < 0) Then
          SecondsEdit.Text := (IntToStr(0))
        Else
          SecondsEdit.Text := IntToStr(Players[CurrentPlayer].Integers[0]);
        If (Players[CurrentPlayer].Integers[1] < 0) Then
          LoadsEdit.Text := (IntToStr(0))
        Else
          LoadsEdit.Text := IntToStr(Players[CurrentPlayer].Integers[1]);
        Players[CurrentPlayer].Extendeds[0] := 0;
        Players[CurrentPlayer].Extendeds[1] := 0;
        Players[CurrentPlayer].Extendeds[2] := 0;
      except
      end;
    end;

    { ---------------------------------------------------------------------------- ]
    [  >>  Saves Current Options To File                                           ]
    [ ---------------------------------------------------------------------------- }


    procedure SaveUs2;
    var
      f, CharsFile: Integer;
    begin
      If (FileName = '') then FileName := 'CDNB'
        CharsFile := RewriteFile(ScriptPath + 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, 'strings[0]' +IntToStr(f)+ '=' +players[f].strings[0]+ Chr(13))
        WriteFileString(CharsFile, 'strings[1]' +IntToStr(f)+ '=' +players[f].strings[1] + Chr(13))
        WriteFileString(CharsFile, 'integers[0]' +IntToStr(f)+ '=' +IntToStr(players[f].Integers[0]) + Chr(13))
        WriteFileString(CharsFile, 'active' +IntToStr(f)+ '=' +BoolToStr(players[f].Active) + Chr(13))
        WriteFileString(CharsFile, 'booleans[0]' +IntToStr(f)+ '=' +BoolToStr(players[f].Booleans[0]) + Chr(13))
        WriteFileString(CharsFile, 'extendeds[0]' +IntToStr(f)+ '=' +FloatToStr(players[f].Extendeds[0])+ Chr(13))
        WriteFileString(CharsFile, 'extendeds[1]' +IntToStr(f)+ '=' +FloatToStr(players[f].Extendeds[1])+ Chr(13))
        WriteFileString(CharsFile, 'extendeds[2]' +IntToStr(f)+ '=' +FloatToStr(players[f].Extendeds[2])+ Chr(13))
        //Writeln('Saved Player: '+IntToStr(f));
      end;
      CloseFile(charsfile)
    end;

    {*******************************************************************************
    function CountPlayers: Integer;
    By: Yakman
    Description: Only Used In SRL UserManager. Counts the number of players in the chars file.
    *******************************************************************************}


    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;

    { ---------------------------------------------------------------------------- ]
    [  >>  Loads Current Options from File                                         ]
    [ ---------------------------------------------------------------------------- }


    procedure LoadUs2;
    var
      f, CharsFile, Temp: Integer;
      CharsFileString: String;
    begin
      if (FileName = '') then FileName := 'CDNB';
      CharsFile := OpenFile(ScriptPath + FileName + '.dat', False)
      if (CharsFile < 0) then
      begin
        SaveUs2;
        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)
      for f := 0 to HowManyPlayers - 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].Strings[0] := Between('strings[0]' + IntToStr(f) + '=', chr(13), CharsFileString);
        players[f].Strings[1] := Between('strings[1]' + IntToStr(f) + '=', chr(13), CharsFileString);
        try
          players[f].Integers[0] := StrToInt(Between('integers[0]' + IntToStr(f) + '=', chr(13), CharsFileString));
        except
        end;
        players[f].Active := StrToBool(Between('active' + IntToStr(f) + '=', chr(13), CharsFileString));
        players[f].Booleans[0] := StrToBool(Between('booleans[0]' + IntToStr(f) + '=', chr(13), CharsFileString));
        players[f].Extendeds[0] := StrToFloat(Between('exteneds[0]' + IntToStr(f) + '=', chr(13), CharsFileString));
        players[f].Extendeds[1] := StrToFloat(Between('exteneds[1]' + IntToStr(f) + '=', chr(13), CharsFileString));
        players[f].Extendeds[2] := StrToFloat(Between('exteneds[2]' + IntToStr(f) + '=', chr(13), CharsFileString));
        //Writeln('Loading Player: '+IntToStr(f));
      end;
      CloseFile(CharsFile);
    end;


    { ---------------------------------------------------------------------------- ]
    [  >>  Adds a New User to The Player Array                                     ]
    [ ---------------------------------------------------------------------------- }


    Procedure CreateNewUser(sender: Tobject);
    var
      n : integer;
    begin
      SavePlayersInForm;
      n := GetArrayLength(Players);
      SetArrayLength(Players, n + 1)
      CurrentPlayer := n;
      //WriteLn('Players: ' + IntToStr(GetArrayLength(Players)) + ' | Current: ' + IntToStr(CurrentPlayer));
      NameNumber.Caption := IntToStr(CurrentPlayer);
      PassNumber.Caption := IntToStr(CurrentPlayer);
      LoadsNumber.Caption := IntToStr(CurrentPlayer);
      DirNumber.Caption := IntToStr(CurrentPlayer);
      LoadPlayersInForm;
    end;

    { ---------------------------------------------------------------------------- ]
    [  >>  Deletes a Player from the Player Array                                  ]
    [ ---------------------------------------------------------------------------- }


    Procedure DeleteAPlayer(sender: tobject);
    var
      n : integer;
    Begin
        n := GetArrayLength(Players);
        if (n < 2) then Exit;
        SetArrayLength(players, n - 1);
        CurrentPlayer := n - 2;
        //WriteLn('Players: ' + IntToStr(GetArrayLength(Players)) + ' | Current: ' + IntToStr(CurrentPlayer));
        NameNumber.Caption := IntToStr(CurrentPlayer);
        PassNumber.Caption := IntToStr(CurrentPlayer);
        LoadsNumber.Caption := IntToStr(CurrentPlayer);
        DirNumber.Caption := IntToStr(CurrentPlayer);
        LoadPlayersInForm;
    end;

    { ---------------------------------------------------------------------------- ]
    [  >>  Goes to Next Player in the Player Array                                 ]
    [ ---------------------------------------------------------------------------- }


    Procedure PressNextButton(sender: TObject);
    begin
      try
        players[currentplayer + 1].name := players[currentplayer + 1].name
      except
        Exit;
      end
      SavePlayersInForm;
      CurrentPlayer := CurrentPlayer + 1;
      NameNumber.Caption := IntToStr(CurrentPlayer);
      PassNumber.Caption := IntToStr(CurrentPlayer);
      LoadsNumber.Caption := IntToStr(CurrentPlayer);
      DirNumber.Caption := IntToStr(CurrentPlayer);
      LoadPlayersInForm;
    end;

    { ---------------------------------------------------------------------------- ]
    [  >>  Goes to Previous Player in the Player Array                             ]
    [ ---------------------------------------------------------------------------- }


    Procedure PressBackButton(sender: tobject);
    begin
      if (CurrentPlayer <> 0) then
      begin
        SavePlayersInForm;
        CurrentPlayer := CurrentPlayer - 1;
        NameNumber.Caption := IntToStr(CurrentPlayer);
        PassNumber.Caption := IntToStr(CurrentPlayer);
        LoadsNumber.Caption := IntToStr(CurrentPlayer);
        DirNumber.Caption := IntToStr(CurrentPlayer);
        LoadPlayersInForm;
      end
    end;




    Procedure CheckVersion;
    Var
      Version : String;
    Begin
      ClearDebug;
      SPanel1.Text := ('Checking SCAR Version..');
      If not(GetSCARVersion >= 311) then
      begin
        SPanel1.Text := (' >> You Need SCAR Divi 3.11 or above to Run this Script!');
        SPanel1.Text := (' >> Please Download it from http://www.freddy1990.com/scar.php');
        TerminateScript;
      end;
      SPanel1.Text := ('SCAR Version.. OK!  You have SCAR '+IntToStr(GetSCARVersion));
      SPanel1.Text := ('Checking Script Version..');
      Version := (Getpage('http://itschris917.freehostia.com/DraynorNetter/DNCurrentVersion.txt'));
      If not(VerNumber = Version) and not(Version = '')then
      Begin
        Writeln('');
        Writeln(' ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~             ');
        Writeln('          Draynor Netter Ver ' +Version+ ' Released!');
        Writeln('               Your Version : '+VerNumber                        );
        Writeln('     It is Recommended that you Update your Script!             ');
        Writeln(' ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~             ');
        Writeln('');
        If(GetApplication.MessageBox('Draynor Netter Ver ' +Version+ ' Released!' +Chr(13)+ 'Your Version : '+VerNumber + Chr(13)+ 'Press "OK" to Cancel the Script Run and Download the new Version!', 'New Version Released', 1) = 1) then
        Begin
          OpenWebPage('http://itschris917.freehostia.com/DraynorNetter/DNCurrentVersion.scar');
          TerminateScript;
        End;
      end else
        SPanel1.Text := ('Latest Script Version... OK!');
    end;

    Procedure UponLoading;
    Begin
      CDNBLabel.Visible := True;
      ChrisDraynorNetterBankerLabel.Visible := True;
      NewsBox.Visible := True;
      ScriptStart.Visible := True;
      NewsButton.Visible := True;
      TotalScriptRunsLabel.Visible := True;
      TotalScriptRunsLabel1.Visible := True;
      TotalFishies.Visible := True;
      TotalFishiesCaught.Visible := True;
      ResetBtn.Visible := True;
      TotalShrimps.Visible := True;
      UpdateScriptBtn.Visible := True;
      StatusBar.SimpleText := 'Draynor Netter by ITSCHRIS917';

      NameLabel.Visible := False;
      PassLabel.Visible := False;
      LoadsLabel.Visible := False;
      NameNumber.Visible := False;
      PassNumber.Visible := False;
      LoadsNumber.Visible := False;
      DirNumber.Visible := False;
      RunAwayLabel.Visible := False;
      CreateBtn.Visible := False;
      DeleteBtn.Visible := False;
      BackBtn.Visible := False;
      NextBtn.Visible := False;
      EdUser.Visible := False;
      EdPass.Visible := False;
      ActiveCheckBox.Visible := False;
      BankPinCheckBox.Visible := False;
      BankPinEdit.Visible := False;
      RunAwayDir.Visible := False;
      LoadsEdit.Visible := False;
      NetOrPowerCombo.Visible := False;
      SecondsEdit.Visible := False;
      Seconds.Visible := False;
      OkBtn.Visible := False;
      ResetBtn.Visible := False;
      TotalScriptRunsLabel.Visible := False;
    End;



    Procedure PlayerSetupVisible;
    Begin
      NameLabel.Visible := True;
      PassLabel.Visible := True;
      LoadsLabel.Visible := True;
      NameNumber.Visible := True;
      PassNumber.Visible := True;
      LoadsNumber.Visible := True;
      DirNumber.Visible := True;
      RunAwayLabel.Visible := True;
      CreateBtn.Visible := True;
      DeleteBtn.Visible := True;
      BackBtn.Visible := True;
      NextBtn.Visible := True;
      EdUser.Visible := True;
      EdPass.Visible := True;
      ActiveCheckBox.Visible := True;
      BankPinCheckBox.Visible := True;
      BankPinEdit.Visible := False;
      RunAwayDir.Visible := True;
      LoadsEdit.Visible := True;
      NetOrPowerCombo.Visible := True;
      SecondsEdit.Visible := True;
      Seconds.Visible := True;
      OkBtn.Visible := True;
      OkBtn.Left := 156;

      CDNBLabel.Visible := False;
      ChrisDraynorNetterBankerLabel.Visible := False;
      NewsBox.Visible := False;
      ScriptStart.Visible := False;
      NewsButton.Visible := False;
      TotalScriptRunsLabel.Visible := False;
      TotalScriptRunsLabel1.Visible := False;
      TotalFishies.Visible := False;
      TotalFishiesCaught.Visible := False;
      ResetBtn.Visible := False;
      TotalShrimps.Visible := False;
      UpdateScriptBtn.Visible := False;
    End;

    Procedure ScriptStatsVisible;
    Begin
      NameLabel.Visible := False;
      PassLabel.Visible := False;
      LoadsLabel.Visible := False;
      NameNumber.Visible := False;
      PassNumber.Visible := False;
      LoadsNumber.Visible := False;
      DirNumber.Visible := False;
      RunAwayLabel.Visible := False;
      CreateBtn.Visible := False;
      DeleteBtn.Visible := False;
      BackBtn.Visible := False;
      NextBtn.Visible := False;
      EdUser.Visible := False;
      EdPass.Visible := False;
      ActiveCheckBox.Visible := False;
      BankPinCheckBox.Visible := False;
      BankPinEdit.Visible := False;
      RunAwayDir.Visible := False;
      LoadsEdit.Visible := False;
      NetOrPowerCombo.Visible := False;
      SecondsEdit.Visible := False;
      Seconds.Visible := False;
      CDNBLabel.Visible := False;
      ChrisDraynorNetterBankerLabel.Visible := False;
      ScriptStart.Visible := False;
      NewsBox.Visible := False;
      NewsButton.Visible := False;
      UpdateScriptBtn.Visible := False;

      TotalScriptRunsLabel.Visible := True;
      TotalScriptRunsLabel1.Visible := True;
      OkBtn.Visible := True;
      TotalFishies.Visible := True;
      TotalFishiesCaught.Visible := True;
      ResetBtn.Visible := True;
      TotalShrimps.Visible := True;
      OkBtn.Left := 200;
    End;



    function getCFGData(dName : String): String;
    var
      tString: String;
    begin
      Result := '';
      tString := dName + '=';
      if(Pos(tString, dFile) = 0)then
        Exit;
      Result := dFile;
      Delete(Result, 1, Pos(tString, dFile));
      Result := Copy(Result, Length(tString), Pos(Chr(13), Result) - Length(tString));
    end;

    /////////////////////////////////////////////////////
    //          Loads global report                    //
    /////////////////////////////////////////////////////

    procedure LoadGlobalReport;
    begin
      Status ( 'Loading Global Report from Data File');
      aFile := OpenFile ( AppPath + 'CDNBGlobalReport.DAT', False);
      if(aFile < 0)then
        Exit;

      ReadFileString(aFile, dFile, FileSize(aFile));

      TotalScriptRunsInForm := StrToFloat ( getCFGData ( 'Total Script Runs'  ));
      TotalFishInForm       := StrToFloat ( getCFGData ( 'Total Fish'  ));
      TotalLoadsInForm      := StrToFloat ( getCFGData ( 'Total Loads' ));
      TotalAnchoviesInForm  := StrToFloat ( getCFGData ( 'Total Anchovies' ));
      TotalShrimpInForm     := StrToFloat ( getCFGData ( 'Total Shrimp' ));
      //TotalEXP        := StrToFloat ( getCFGData ( 'Total EXP ' ));

      CloseFile(aFile);
    end;

    /////////////////////////////////////////////////////////////
    //                Saves global report                      //
    /////////////////////////////////////////////////////////////

    procedure SaveGlobalReport;
    begin
      Status ('Saving Progress Report to Data File');
      aFile := ReWriteFile(AppPath + 'CDNBGlobalReport.DAT', False);
      WriteFileString(aFile, 'Total Script Runs='  + FloatToStr( TotalScriptRuns ) + Chr(13));
      WriteFileString(aFile, 'Total Fish='  + FloatToStr( TotalFish ) + Chr(13));
      WriteFileString(aFile, 'Total Loads='  + FloatToStr( TotalLoads ) + Chr(13));
      WriteFileString(aFile, 'Total Anchovies=' + FloatToStr( TotalAnchovies ) + Chr(13));
      WriteFileString(aFile, 'Total Shrimp=' + FloatToStr( TotalShrimp ) + Chr(13));
      WriteFileString(aFile, 'Total EXP=' + FloatToStr( TotalEXP ) + Chr(13));
      CloseFile(aFile);

    end;

    function StrToBol(str : string) : boolean;
    begin
      result := lowercase(str) = 'true';
    end;

    procedure Reset(Sender:TObject);
    begin
      TotalScriptRuns := 0;
      TotalFish := 0;
      TotalShrimp := 0;
      SaveGlobalReport;
    end;

    Procedure ChangeTabs(Sender : TObject);
    var
      v: TVariantArray;
    begin
      SetArrayLength(V, 0);
      If(Sender IS TTabControl) Then
        Case (TTabControl(Sender).TabIndex) Of
          0 : Begin
                UponLoading;
              End;
          1 : Begin
                PlayerSetupVisible;
              End;
          2 : Begin
                ScriptStatsVisible;
              End;
        End;
    End;

    Procedure ClickBtn(Sender : TObject);
    Var
      v: TVariantArray;
      Timer, i, x, y, Temp, HowMany: integer;
      News : Array of String;
      New, TheNews : String;
    Begin
      SetArrayLength(V, 0);
      If(Sender IS TButton) Then
        Case (TButton(Sender).Tag) Of
          1 : Begin
                SaveGlobalReport;
                SavePlayersInForm;
                SaveUs2;
                HowManyPlayers := GetArrayLength(players);
                frmDesign.ModalResult := mrOK;
              End;
          2 : Begin
                NewsBox.Lines.Clear;
                TheNews := Getpage('http://itschris917.freehostia.com/DraynorNetter/DraynorNetterNews.txt');
                NewsBox.Lines.Add(' >> Latest CDNB News:');
                NewsBox.Lines.Add('    =================');
                For Temp := 1 to Length(TheNews) do
                  If(Copy(TheNews, Temp, 1) = ',') then
                    HowMany := HowMany + 1;
                  x := 0;
                  y := 1;
                  SetArrayLength(News, HowMany+1);
                  For i := 1 to HowMany do
                  Begin
                    MarkTime(Timer);
                    repeat
                      x := x + 1;
                      new := copy(TheNews, x, x+1);
                    until(copy(new, 1, 1) = ',')or(TimeFromMark(Timer) >= 2000);
                  news[i]:= copy(TheNews, y, (x-y));
                  y := x + 1;
                  Wait(1);
                End;
                For i := 1 to HowMany do
                  NewsBox.Lines.Add(' o  '+news[i]);
                End;
          3 : Begin
                Tabs.TabIndex := 0;
                Tabs.OnChange := @ChangeTabs;
                SaveGlobalReport;
                UponLoading;
              End;
          4 : Begin
                CheckVersion;
              End;
          End;
    End;



    Procedure ShowPinEdit(Sender : TObject);
    Var
      V: TVariantArray;
    Begin
      SetArrayLength(V, 0);
      Case (BankPinCheckBox.Checked) Of
        True : Begin
                 BankPinEdit.Visible := True;
               End;

        False: Begin
                 BankPinEdit.Visible := False;
               End;
      End;
    End;


    Procedure InitForm;
    Var
     Timer, i, x, y, Temp, HowMany: integer;
      News : Array of String;
      New, TheNews : String;
    Begin
    LoadUs2;

    frmDesign := CreateForm;
    frmDesign.Left := 563;
    frmDesign.Top := 125;
    frmDesign.Width := 388;
    frmDesign.Height := 350;
    frmDesign.Caption := 'CDNB (Chris Draynor Netter Banker)';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -11;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := False;
    frmDesign.PixelsPerInch := 96;

    CDNBLabel := TLabel.Create(frmDesign);
    CDNBLabel.Parent := frmDesign;
    CDNBLabel.Left := 115;
    CDNBLabel.Top := 34;
    CDNBLabel.Width := 110;
    CDNBLabel.Height := 38;
    CDNBLabel.Caption := 'CDNB';
    CDNBLabel.Font.Color := clWindowText;
    CDNBLabel.Font.Height := -31;
    CDNBLabel.Font.Name := 'Calligraph421 BT';
    CDNBLabel.Font.Style := [];
    CDNBLabel.ParentFont := False;

    ChrisDraynorNetterBankerLabel := TLabel.Create(frmDesign);
    ChrisDraynorNetterBankerLabel.Parent := frmDesign;
    ChrisDraynorNetterBankerLabel.Left := 88;
    ChrisDraynorNetterBankerLabel.Top := 75;
    ChrisDraynorNetterBankerLabel.Width := 203;
    ChrisDraynorNetterBankerLabel.Height := 20;
    ChrisDraynorNetterBankerLabel.Caption := 'Chris Draynor Netter Banker';
    ChrisDraynorNetterBankerLabel.Font.Color := clWindowText;
    ChrisDraynorNetterBankerLabel.Font.Height := -16;
    ChrisDraynorNetterBankerLabel.Font.Name := 'Calligraph421 BT';
    ChrisDraynorNetterBankerLabel.Font.Style := [];
    ChrisDraynorNetterBankerLabel.ParentFont := False;

    NameLabel := TLabel.Create(frmDesign);
    NameLabel.Parent := frmDesign;
    NameLabel.Left := 74;
    NameLabel.Top := 88;
    NameLabel.Width := 31;
    NameLabel.Height := 13;
    NameLabel.Caption := 'Name:';

    PassLabel := TLabel.Create(frmDesign);
    PassLabel.Parent := frmDesign;
    PassLabel.Left := 74;
    PassLabel.Top := 110;
    PassLabel.Width := 26;
    PassLabel.Height := 13;
    PassLabel.Caption := 'Pass:';

    LoadsLabel := TLabel.Create(frmDesign);
    LoadsLabel.Parent := frmDesign;
    LoadsLabel.Left := 74;
    LoadsLabel.Top := 135;
    LoadsLabel.Width := 32;
    LoadsLabel.Height := 13;
    LoadsLabel.Caption := 'Loads:';

    NameNumber := TLabel.Create(frmDesign);
    NameNumber.Parent := frmDesign;
    NameNumber.Left := 57;
    NameNumber.Top := 89;
    NameNumber.Width := 9;
    NameNumber.Height := 13;
    NameNumber.Caption := '0.';

    PassNumber := TLabel.Create(frmDesign);
    PassNumber.Parent := frmDesign;
    PassNumber.Left := 57;
    PassNumber.Top := 110;
    PassNumber.Width := 9;
    PassNumber.Height := 13;
    PassNumber.Caption := '0.';

    LoadsNumber := TLabel.Create(frmDesign);
    LoadsNumber.Parent := frmDesign;
    LoadsNumber.Left := 57;
    LoadsNumber.Top := 136;
    LoadsNumber.Width := 9;
    LoadsNumber.Height := 13;
    LoadsNumber.Caption := '0.';

    DirNumber := TLabel.Create(frmDesign);
    DirNumber.Parent := frmDesign;
    DirNumber.Left := 57;
    DirNumber.Top := 162;
    DirNumber.Width := 9;
    DirNumber.Height := 13;
    DirNumber.Caption := '0.';

    RunAwayLabel := TLabel.Create(frmDesign);
    RunAwayLabel.Parent := frmDesign;
    RunAwayLabel.Left := 74;
    RunAwayLabel.Top := 161;
    RunAwayLabel.Width := 52;
    RunAwayLabel.Height := 13;
    RunAwayLabel.Caption := 'Run Away:';

    Tabs := TTabControl.Create(frmDesign);
    Tabs.Parent := frmDesign;
    Tabs.Left := 0;
    Tabs.Top := 0;
    Tabs.Width := 380;
    Tabs.Height := 33;
    Tabs.TabOrder := 8;
    Tabs.Tabs.Add('Latest News');
    Tabs.Tabs.Add('Player Setup');
    Tabs.Tabs.Add('Script Stats');
    Tabs.Tabs.Add('Script Settings');
    Tabs.Tabs.Add('Version History');
    Tabs.TabIndex := 0;
    Tabs.OnChange := @ChangeTabs;

    NewsBox := TRichEdit.Create(frmDesign);
    NewsBox.Parent := frmDesign;
    NewsBox.Left := 71;
    NewsBox.Top := 95;
    NewsBox.Width := 270;
    NewsBox.Height := 125;
    NewsBox.TabOrder := 9;
    NewsBox.Lines.Add('');
    TheNews := Getpage('http://itschris917.freehostia.com/DraynorNetter/DraynorNetterNews.txt');
    NewsBox.Lines.Add(' >> Latest CDNB News:');
    NewsBox.Lines.Add('    =================');
     For Temp := 1 to Length(TheNews) do
        If(Copy(TheNews, Temp, 1) = ',') then
          HowMany := HowMany + 1;
      x := 0;
      y := 1;
      SetArrayLength(News, HowMany+1);
      For i := 1 to HowMany do
      Begin
        MarkTime(Timer);
        repeat
          x := x + 1;
          new := copy(TheNews, x, x+1);
        until(copy(new, 1, 1) = ',')or(TimeFromMark(Timer) >= 2000);
        news[i]:= copy(TheNews, y, (x-y));
        y := x + 1;
        Wait(1);
      end;
      For i := 1 to HowMany do
      NewsBox.Lines.Add(' o  '+news[i]);

    ScriptStart := TButton.Create(frmDesign);
    ScriptStart.Parent := frmDesign;
    ScriptStart.Left := 90;
    ScriptStart.Top := 226;
    ScriptStart.Width := 89;
    ScriptStart.Height := 25;
    ScriptStart.Caption := 'Start Script!';
    ScriptStart.TabOrder := 10;
    ScriptStart.Tag := 1;
    ScriptStart.OnClick := @ClickBtn;

    NewsButton := TButton.Create(frmDesign);
    NewsButton.Parent := frmDesign;
    NewsButton.Left := 187 + 30;
    NewsButton.Top := 226;
    NewsButton.Width := 103;
    NewsButton.Height := 25;
    NewsButton.Caption := 'Re-download News';
    NewsButton.TabOrder := 11;
    NewsButton.Tag := 2;
    NewsButton.OnClick := @ClickBtn;

    CreateBtn := TButton.Create(frmDesign);
    CreateBtn.Parent := frmDesign;
    CreateBtn.Left := 115;
    CreateBtn.Top := 45;
    CreateBtn.Width := 75;
    CreateBtn.Height := 25;
    CreateBtn.Caption := 'Create Player';
    CreateBtn.TabOrder := 12;
    CreateBtn.Tag := 5;
    CreateBtn.OnClick := @CreateNewUser;

    DeleteBtn := TButton.Create(frmDesign);
    DeleteBtn.Parent := frmDesign;
    DeleteBtn.Left := 196;
    DeleteBtn.Top := 45;
    DeleteBtn.Width := 75;
    DeleteBtn.Height := 25;
    DeleteBtn.Caption := 'Delete Player';
    DeleteBtn.TabOrder := 13;
    DeleteBtn.Tag := 6;
    DeleteBtn.OnClick := @DeleteAPlayer;

    BackBtn := TButton.Create(frmDesign);
    BackBtn.Parent := frmDesign;
    BackBtn.Left := 68;
    BackBtn.Top := 45;
    BackBtn.Width := 43;
    BackBtn.Height := 25;
    BackBtn.Caption := '<--';
    BackBtn.TabOrder := 14;
    BackBtn.Tag := 7;
    BackBtn.OnClick := @PressBackButton;

    NextBtn := TButton.Create(frmDesign);
    NextBtn.Parent := frmDesign;
    NextBtn.Left := 277;
    NextBtn.Top := 45;
    NextBtn.Width := 43;
    NextBtn.Height := 25;
    NextBtn.Caption := '-->';
    NextBtn.TabOrder := 15;
    NextBtn.Tag := 8;
    NextBtn.OnClick := @PressNextButton;

    EdUser := TEdit.Create(frmDesign);
    EdUser.Parent := frmDesign;
    EdUser.Left := 127;
    EdUser.Top := 83;
    EdUser.Width := 121;
    EdUser.Height := 21;
    EdUser.Hint := 'Enter your username here..';
    EdUser.ParentShowHint := False;
    EdUser.ShowHint := True;
    EdUser.TabOrder := 16;

    EdPass := TEdit.Create(frmDesign);
    EdPass.Parent := frmDesign;
    EdPass.Left := 127;
    EdPass.Top := 107;
    EdPass.Width := 121;
    EdPass.Height := 21;
    EdPass.Hint := 'Enter your password here..';
    EdPass.ParentShowHint := False;
    EdPass.PasswordChar := 'X';
    EdPass.ShowHint := True;
    EdPass.TabOrder := 17;

    LoadsEdit := TEdit.Create(frmDesign);
    LoadsEdit.Parent := frmDesign;
    LoadsEdit.Left := 127;
    LoadsEdit.Top := 133;
    LoadsEdit.Width := 121;
    LoadsEdit.Height := 21;
    LoadsEdit.ParentShowHint := False;
    LoadsEdit.ShowHint := True;
    LoadsEdit.TabOrder := 18;

    RunAwayDir := TComboBox.Create(frmDesign);
    RunAwayDir.Parent := frmDesign;
    RunAwayDir.Left := 127;
    RunAwayDir.Top := 158;
    RunAwayDir.Width := 124;
    RunAwayDir.Height := 21;
    RunAwayDir.Hint := 'Which direction to run to if we encounter a fight.';
    RunAwayDir.ItemHeight := 13;
    RunAwayDir.ParentShowHint := False;
    RunAwayDir.ShowHint := True;
    RunAwayDir.TabOrder := 19;
    RunAwayDir.Items.Add('N');
    RunAwayDir.Items.Add('E');
    RunAwayDir.Items.Add('S');
    RunAwayDir.Items.Add('W');

    NetOrPowerCombo := TComboBox.Create(frmDesign);
    NetOrPowerCombo.Parent := frmDesign;
    NetOrPowerCombo.Left := 22;
    NetOrPowerCombo.Top := 188;
    NetOrPowerCombo.Width := 107;
    NetOrPowerCombo.Height := 21;
    NetOrPowerCombo.Hint := 'Bank or Power-fish';
    NetOrPowerCombo.ItemHeight := 13;
    NetOrPowerCombo.ParentShowHint := False;
    NetOrPowerCombo.ShowHint := True;
    NetOrPowerCombo.TabOrder := 24;
    NetOrPowerCombo.Items.Add('Bank');
    NetOrPowerCombo.Items.Add('Power');

    SecondsEdit := TEdit.Create(frmDesign);
    SecondsEdit.Parent := frmDesign;
    SecondsEdit.Left := 225;
    SecondsEdit.Top := 189;
    SecondsEdit.Width := 121;
    SecondsEdit.Height := 21;
    SecondsEdit.Hint := 'Seconds to wait before clicking on fishing spot again(Failsafe)';
    SecondsEdit.ParentShowHint := False;
    SecondsEdit.ShowHint := True;
    SecondsEdit.TabOrder := 25;

    Seconds := TLabel.Create(frmDesign);
    Seconds.Parent := frmDesign;
    Seconds.Left := 165;
    Seconds.Top := 192;
    Seconds.Width := 48;
    Seconds.Height := 13;
    Seconds.Caption := 'Seconds: ';

    ActiveCheckBox := TCheckBox.Create(frmDesign);
    ActiveCheckBox.Parent := frmDesign;
    ActiveCheckBox.Left := 256;
    ActiveCheckBox.Top := 104;
    ActiveCheckBox.Width := 97;
    ActiveCheckBox.Height := 17;
    ActiveCheckBox.Hint := 'Is the current player active?';
    ActiveCheckBox.Caption := 'Active?';
    ActiveCheckBox.ParentShowHint := False;
    ActiveCheckBox.ShowHint := True;
    ActiveCheckBox.TabOrder := 20;

    BankPinCheckBox := TCheckBox.Create(frmDesign);
    BankPinCheckBox.Parent := frmDesign;
    BankPinCheckBox.Left := 256;
    BankPinCheckBox.Top := 131;
    BankPinCheckBox.Width := 97;
    BankPinCheckBox.Height := 17;
    BankPinCheckBox.Hint := 'Does the current player have a bank pin?';
    BankPinCheckBox.Caption := 'Bank Pin?';
    BankPinCheckBox.ParentShowHint := False;
    BankPinCheckBox.ShowHint := True;
    BankPinCheckBox.TabOrder := 21;
    BankPinCheckBox.OnClick := @ShowPinEdit;

    BankPinEdit := TEdit.Create(frmDesign);
    BankPinEdit.Parent := frmDesign;
    BankPinEdit.Left := 257;
    BankPinEdit.Top := 160;
    BankPinEdit.Width := 121;
    BankPinEdit.Height := 21;
    BankPinEdit.TabOrder := 22;
    BankPinEdit.Visible := False;

    OkBtn := TButton.Create(frmDesign);
    OkBtn.Parent := frmDesign;
    OkBtn.Left := 156;
    OkBtn.Top := 226;
    OkBtn.Width := 75;
    OkBtn.Height := 25;
    OkBtn.Caption := 'OK!';
    OkBtn.TabOrder := 26;
    OkBtn.Tag := 3;
    OkBtn.OnClick := @ClickBtn;

    ResetBtn := TButton.Create(frmDesign);
    ResetBtn.Parent := frmDesign;
    ResetBtn.Left := 75;
    ResetBtn.Top := 226;
    ResetBtn.Width := 75;
    ResetBtn.Height := 25;
    ResetBtn.Caption := 'Reset';
    ResetBtn.TabOrder := 26;
    ResetBtn.OnClick := @Reset;

    TotalScriptRunsLabel := TLabel.Create(frmDesign);
    TotalScriptRunsLabel.Parent := frmDesign;
    TotalScriptRunsLabel.Left := 95;
    TotalScriptRunsLabel.Top := 80;
    TotalScriptRunsLabel.Width := 35;
    TotalScriptRunsLabel.Height := 25;
    TotalScriptRunsLabel.Caption := 'Total Script Runs:';

    TotalScriptRunsLabel1 := TLabel.Create(frmDesign);
    TotalScriptRunsLabel1.Parent := frmDesign;
    TotalScriptRunsLabel1.Left := 210;
    TotalScriptRunsLabel1.Top := 80;
    TotalScriptRunsLabel1.Width := 35;
    TotalScriptRunsLabel1.Height := 25;
    TotalScriptRunsLabel1.Caption := FloatToStr(TotalScriptRuns);

    TotalFishies := TLabel.Create(frmDesign);
    TotalFishies.Parent := frmDesign;
    TotalFishies.Left := 95;
    TotalFishies.Top := 110;
    TotalFishies.Width := 35;
    TotalFishies.Height := 25;
    TotalFishies.Caption := 'Total fish caught:';

    TotalFishiesCaught := TLabel.Create(frmDesign);
    TotalFishiesCaught.Parent := frmDesign;
    TotalFishiesCaught.Left := 210;
    TotalFishiesCaught.Top := 110;
    TotalFishiesCaught.Width := 35;
    TotalFishiesCaught.Height := 25;
    TotalFishiesCaught.Caption := FloatToStr(TotalFish);

    TotalShrimps := TLabel.Create(frmDesign);
    TotalShrimps.Parent := frmDesign;
    TotalShrimps.Left := 95;
    TotalShrimps.Top := 140;
    TotalShrimps.Width := 35;
    TotalShrimps.Height := 25;
    TotalShrimps.Caption := 'Total shrimp caught:';

    TotalShrimpCaught := TLabel.Create(frmDesign);
    TotalShrimpCaught.Parent := frmDesign;
    TotalShrimpCaught.Left := 210;
    TotalShrimpCaught.Top := 140;
    TotalShrimpCaught.Width := 35;
    TotalShrimpCaught.Height := 25;
    TotalShrimpCaught.Caption := FloatToStr(TotalShrimp);

    UpdateScriptBtn := TButton.Create(frmDesign);
    UpdateScriptBtn.Parent := frmDesign;
    UpdateScriptBtn.Left := 160;
    UpdateScriptBtn.Top := 270;
    UpdateScriptBtn.Width := 115;
    UpdateScriptBtn.Height := 25;
    UpdateScriptBtn.Caption := 'Check Script Version!';
    UpdateScriptBtn.Tag := 4;
    UpdateScriptBtn.OnClick := @ClickBtn;

    StatusBar := TStatusBar.Create(frmDesign);
    StatusBar.Parent := frmDesign;
    StatusBar.Left := 0;
    StatusBar.Top := 299;
    StatusBar.Width := 380;

    SPanel1 := StatusBar.Panels.Add;
    SPanel1.Text := 'Draynor Netter by ITSCHRIS917';


    End;

    procedure SafeShowWF;
    var
      tva: TVariantArray;
    begin
      setarraylength(tva, 0);
      ThreadSafeCall('InitForm', tva);
    end;

    procedure ShowFormModal;
    begin
      frmDesign.ShowModal
    end;

    procedure SafeShowFormModal;
    var
      tva: TVariantArray;
    begin
      setarraylength(tva, 0);
      ThreadSafeCall('ShowFormModal', tva);
    end;

    procedure Form;
    begin
      SafeShowWF;
      UponLoading;
      SafeShowFormModal;
    end;

    begin
      SetupSRL;
      LoadGlobalReport
      {TotalShrimp := TotalShrimpInForm + 432;
      TotalScriptRuns := TotalScriptRunsInForm + 1;
      TotalFish := TotalFishInForm + 567;}

      SaveGlobalReport;
      Form;
      FreeForm(frmDesign);
    end.

  6. #6
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    2,984
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Check all your StrToFloat for false values or use StrToFloatDef
    Administrator's Warning:


  7. #7
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks Sumillion, i have updated all of my LoadPLayers procedures etc. Hopefully it works now...

  8. #8
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    It's unfair that Sumilion knows everything... Lol :P

    My my solution to the problem in the first line, was apparently wrong :P
    I'm glad I didn't post it :P

    -Knives

  9. #9
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What was the point of that post Knives?? Spam much?

  10. #10
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Just for fun. I didn't know that was against the rules.

    -Knives

  11. #11
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    2,984
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by King of Knives View Post
    It's unfair that Sumilion knows everything... Lol :P

    My my solution to the problem in the first line, was apparently wrong :P
    I'm glad I didn't post it :P

    -Knives
    Hah, well, after the horror i went through creating the new Users.scar (you will see it in SRL 4, the beta was already a bit viewable in SRL 4 beta) i consider myself a moderate form expert.

    ~Sumilion

    ps. yes spamming is against regulation.
    Administrator's Warning:


  12. #12
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I wouldn't consider my post spam. But this will probably also be classified as spam now.

    I'm a loser with forms. I can make a form kill a computer, but that's about it.
    And how can SetupSRL; interfere with how forms work? Could I get an explanation there?

    -Knives

    PS: I meant: I didn't know that fun was against the rules.

  13. #13
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SetupSRL calls basic procedures needed in most scripts, like in my form.. It calls procedures that have things to do with the player array, causing an Out of Range error.. correct me if im wrong Sumillion... I wish i could personally check it, but i dont have SCAR on this computer..

  14. #14
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I hate when using a computer, and it doesn't have SCAR. From there the day just goes downhill :P

    Last I read SetupSRL; all I saw was that it adjusted integers... Maybe I wasn't paying attention... That happens sometimes.

    -Knives

  15. #15
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    2,984
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by King of Knives View Post
    I hate when using a computer, and it doesn't have SCAR. From there the day just goes downhill :P

    Last I read SetupSRL; all I saw was that it adjusted integers... Maybe I wasn't paying attention... That happens sometimes.

    -Knives
    We should just somehow get Scar in windows by default =\

    SetupSRL; calls InitPlayerArray; which indoes just set values. But they are necessary.

    Quote Originally Posted by itschris917 View Post
    SetupSRL calls basic procedures needed in most scripts, like in my form.. It calls procedures that have things to do with the player array, causing an Out of Range error.. correct me if im wrong Sumillion... I wish i could personally check it, but i dont have SCAR on this computer..
    Yep, your right.

    Quote Originally Posted by King of Knives View Post
    I wouldn't consider my post spam. But this will probably also be classified as spam now.

    I'm a loser with forms. I can make a form kill a computer, but that's about it.
    And how can SetupSRL; interfere with how forms work? Could I get an explanation there?

    -Knives

    PS: I meant: I didn't know that fun was against the rules.
    Fun isnt against the rules, spam is Sometimes they are very close though.
    SetupSRL; loads the PlayerArray, his form read the PlayerArray, but then it does have to be loaded.
    Administrator's Warning:


  16. #16
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I guess I missed that part... All I remember reading was MouseSpeed := 7 or something...
    Well, you answered my question.

    PS: Sumilion, will you be my god?

    -Knives

  17. #17
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    2,984
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by King of Knives View Post
    PS: Sumilion, will you be my god?

    -Knives
    Sure, no problem
    Administrator's Warning:


Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Out of Range Error
    By Torrent of Flame in forum OSR Help
    Replies: 7
    Last Post: 12-20-2008, 09:24 PM
  2. Scar Form Error: Out of Global Vars range!
    By Nava2 in forum OSR Help
    Replies: 6
    Last Post: 08-04-2008, 03:47 PM
  3. Out Of Range Error
    By decide in forum OSR Help
    Replies: 8
    Last Post: 08-02-2008, 10:29 AM
  4. Replies: 2
    Last Post: 03-29-2008, 11:35 AM
  5. out of range error..
    By drizzt in forum OSR Help
    Replies: 6
    Last Post: 02-16-2008, 03:21 PM

Posting Permissions

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