Results 1 to 3 of 3

Thread: Yet another problem with my form...

  1. #1
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default Yet another problem with my form...

    Well, almost everything in the form is working as it should be, buttons, menu items. However, when you fill in the play details, and click "Add Player", the list will add that most recent player. If you then click this player, all the fields will turn blank, and that player will disappear off the list. It only ever happens with the most recent player, so I though I may have a HowManyPlayers - 1 or something, but apparently not. Understand?

    This is the code:

    SCAR Code:
    Program CutMeUp;
    {.include SRL\SRL.scar}

    Type
      DownloadInfo = record
        Location, Name, Destination: String;
      end;
     
    var
      CurrentFP: Integer;
      Form: TForm;
      Edits: Array [0..4] of TEdit;
      CheckBoxes: Array [0..1] of TCheckBox;
      RadioButtons: Array [0..1] of TRadioButton;
      Buttons: Array [0..7] of TButton;
      ComboBoxes: Array [0..1] of TComboBox;
      MenuItems: Array of Array of TMenuItem;
      FormMainMenu: TMainMenu;
      PlayerList: TListBox;
      RunScript, Save: Boolean;


    Procedure AddPlayer(AddExtra: Boolean); Forward;

    Procedure FillPlayerList;
    Var
      i: Integer;
    Begin
      With PlayerList do
      Begin
        Clear;
        For i := 0 to GetArrayLength(Players) - 1 do
        If Players[i].Name <> '' then
          With Items do
            Add(IntToStr(i) + ':' + Players[i].Name);
      end;
    end;

    Procedure ResetFields;
    Var
      i: Integer;
    Begin
      For i := 0 to 4 do
        With Edits[i] do
          Text := '';
      With CheckBoxes[1] do
        Checked := False;
      With ComboBoxes[1] do
        Text := 'True';
      With ComboBoxes[0] do
        Text := 'Select Log Type';
    end;

    Procedure ClearPlayerList;
    Var
    i: Integer;
    Begin
      For i := 0 to HowManyPlayers - 1 do
      Begin
        Players[i].Name := '';
        Players[i].Pass := '';
        Players[i].Integers[0] := 0;
        Players[i].Booleans[0] := False;
        Players[i].Booleans[1] := False;
        Players[i].Booleans[2] := False;
        Players[i].Active := False;
        Players[i].Nick := '';
        Players[i].BoxRewards := [];
        Players[i].Strings[0] := '';
      end;
      HowManyPlayers := 0;
      NumberOfPlayers(HowManyPlayers);
      CurrentFP := -1;
      ResetFields;
      FillPlayerList;
    end;

    Procedure ClickPlayerList;
    Begin
      Try
        Players[CurrentFP].Name := Edits[0].Text;
        Players[CurrentFP].Pass := Edits[1].Text;
        Players[CurrentFP].Integers[0] := StrToIntDef(Edits[4].text, 0);
        Players[CurrentFP].Booleans[0] := CheckBoxes[0].Checked;   //Fletch
        Players[CurrentFP].Booleans[1] := CheckBoxes[1].Checked;   //String
        Players[CurrentFP].Booleans[2] := RadioButtons[0].Checked; //Longbow or shortbow
        Players[CurrentFP].Active := StrToBool(ComboBoxes[1].Text);
        Players[CurrentFP].Nick := Edits[2].Text;
        Players[CurrentFP].BoxRewards := srl_Explode(Edits[3].text, ',');
        Players[CurrentFP].Strings[0] := ComboBoxes[0].Text;
      Except
        ShowMessage('Player form incomplete, please fill in all required areas');
        Exit;
      end;
      Begin
        CurrentFP := PlayerList.ItemIndex;
        Edits[0].Text := Players[CurrentFP].Name;
        Edits[1].Text := Players[CurrentFP].Pass;
        Edits[2].Text := Players[CurrentFP].Nick;
        Edits[3].Text := srl_Implode(Players[CurrentFP].BoxRewards, ',');
        ComboBoxes[1].Text := BoolToStr(Players[CurrentFP].Active);
        ComboBoxes[0].Text := Players[CurrentFP].Strings[0];
        Edits[4].Text := IntToStr(Players[CurrentFP].Integers[0])
        CheckBoxes[0].Checked := Players[CurrentFP].Booleans[0];
        CheckBoxes[1].Checked := Players[CurrentFP].Booleans[1];
        RadioButtons[Integer(not(Players[CurrentFP].Booleans[2]))].Checked;
        FillPlayerList;
      end;
      If Edits[0].text <> '' then
        Buttons[0].Caption := 'New player'
      else
        Buttons[0].Caption := 'Add player';
      FillPlayerList;
    end;

    Procedure AddPlayer(AddExtra: Boolean);
    Var
      LogTypes: TStringArray;
    Begin
      LogTypes := ['Normal', 'Oak', 'Willow', 'Maple', 'Yew', 'Magic'];
      If Buttons[0].Caption = 'Add player' then
      Begin
        If not(CurrentFP < 0) then
        If Players[CurrentFP].Name = Edits[0].Text then Exit;
        Begin
          Try
            HowManyPlayers := HowManyPlayers + 1;
            NumberOfPlayers(HowManyPlayers);
            CurrentFP := CurrentFP + 1;
            Players[CurrentFP].Name := Edits[0].Text;
            Players[CurrentFP].Pass := Edits[1].Text;
            Players[CurrentFP].Integers[0] := StrToIntDef(Edits[4].text, 0);
            Players[CurrentFP].Booleans[0] := CheckBoxes[0].Checked;   //Fletch
            Players[CurrentFP].Booleans[1] := CheckBoxes[1].Checked;   //String
            Players[CurrentFP].Booleans[2] := RadioButtons[0].Checked; //Longbow or shortbow
            Players[CurrentFP].Active := StrToBool(ComboBoxes[1].Text);
            Players[CurrentFP].Nick := Edits[2].Text;
            Players[CurrentFP].BoxRewards := srl_Explode(Edits[3].text, ',')
            If InStrArr(ComboBoxes[0].Text, LogTypes, False) then
              Players[CurrentFP].Strings[0] := ComboBoxes[0].Text
            Else
            Begin
              If AddExtra then
                ShowMessage('Player form incomplete, please fill in all required areas');
              Exit;
            end;
          Except
            If AddExtra then
              ShowMessage('Player form incomplete, please fill in all required areas');
            //WriteLN(ExceptionToString(ExceptionType, ExceptionParam));
            Exit;
          end;
          FillPlayerList;
          ResetFields;
        end;
      end else
        ResetFields;
      Buttons[0].Caption := 'Add player';
      FillPlayerList;
    end;

    Procedure DeletePlayer;
    Begin
      CurrentFP := CurrentFP - 1;
      HowManyPlayers := HowManyPlayers - 1;
      NumberOfPlayers(HowManyPlayers);
      If CurrentFP >= 0 then
      Begin
        Edits[0].Text := Players[CurrentFP].Name;
        Edits[1].Text := Players[CurrentFP].Pass;
        Edits[2].Text := Players[CurrentFP].Nick;
        Edits[3].Text := srl_Implode(Players[CurrentFP].BoxRewards, ',');
        ComboBoxes[1].Text := BoolToStr(Players[CurrentFP].Active);
        ComboBoxes[0].Text := Players[CurrentFP].Strings[0];
        Edits[4].Text := IntToStr(Players[CurrentFP].Integers[0])
        CheckBoxes[0].Checked := Players[CurrentFP].Booleans[0];
        CheckBoxes[1].Checked := Players[CurrentFP].Booleans[1];
        RadioButtons[Integer(not(Players[CurrentFP].Booleans[2]))].Checked;
      end else
        ResetFields;
    end;
     
    Procedure SavePlayerList;
    Var
      SaveFile: TStringList;
      i, ii: Integer;
    Begin
      SaveFile := TStringList.Create;
      SaveFile.Add(IntToStr(HowManyPlayers));
      For i := 0 To HowManyPlayers - 1 Do
      Begin
        SaveFile.Add(Players[i].Name);
        SaveFile.Add(Players[i].Nick);
        SaveFile.Add(Players[i].Pass);
        SaveFile.Add(srl_Implode(Players[i].BoxRewards, ','));
        SaveFile.Add(IntToStr(Players[i].Integers[0]));
        SaveFile.Add(Players[i].Strings[0]);
        SaveFile.Add(BoolToStr(Players[i].Active));
        For ii := 0 to 2 do
          SaveFile.Add(BoolToStr(Players[i].Booleans[ii]));
      end;
      //CloseFile(ReWriteFile(AppPath + 'Cut Me Up\Player Lists\PlayerList.txt', True))
      SaveToFile(SaveFile, AppPath + 'Cut Me Up\Player Lists\PlayerList.txt');
    end;

    Procedure SavePlayerListAs;
    Var
      OpenDialog: TSaveDialog;
      SaveFile: TStringList;
      i, ii: Integer;
      TempString: String;
    Begin
      AddPlayer(False);
      OpenDialog := TSaveDialog.Create(Form);
      With OpenDialog do
      Begin
        InitialDir := ScriptPath
        Filter := 'Text Files (*.txt)|*.txt|';
        If Execute then
        Begin
          If (ExtractFileExt(FileName) = '') then
            TempString := FileName + '.txt'
          else
            TempString := FileName;
        end else
        Begin
          SaveFile.Free;
          Free;
          Exit;
        end;
        Free
      end;
      SaveFile := TStringList.Create;
      SaveFile.Add(IntToStr(HowManyPlayers));
      For i := 0 To HowManyPlayers - 1 Do
      Begin
        SaveFile.Add(Players[i].Name);
        SaveFile.Add(Players[i].Nick);
        SaveFile.Add(Players[i].Pass);
        SaveFile.Add(srl_Implode(Players[i].BoxRewards, ','));
        SaveFile.Add(IntToStr(Players[i].Integers[0]));
        SaveFile.Add(Players[i].Strings[0]);
        SaveFile.Add(BoolToStr(Players[i].Active));
        For ii := 0 to 2 do
          SaveFile.Add(BoolToStr(Players[i].Booleans[ii]));
      end;
      Try
        SaveToFile(SaveFile, TempString);
      Except
        SaveFile.Free;
        GetApplication.MessageBox('File not found', '', 0);
      end;
    end;

    Procedure OpenPlayerList;
    Var
      SaveFile: TStringList;
      i, ii, iii: Integer;
    Begin
      If not(FileExists(AppPath + 'Cut Me Up\Player Lists\PlayerList.txt')) Then Exit;
      Begin
        SaveFile := TStringList.Create;
        Try
          If LoadFromFile(SaveFile, AppPath + 'Cut Me Up\Player Lists\PlayerList.txt') then
          Begin
            If (SaveFile.Strings[0] = '') or (SaveFile.Strings[0] = '0') then Exit;
            HowManyPlayers := StrToInt(SaveFile.Strings[0]);
            NumberOfPlayers(HowManyPlayers);
            For i := 0 to HowManyPlayers - 1 do
            Begin
              ii := 10 * i;
              Players[i].Name := SaveFile.Strings[ii + 1];
              Players[i].Pass := SaveFile.Strings[ii + 2];
              Players[i].Nick := SaveFile.Strings[ii + 3];
              Players[i].BoxRewards := srl_Explode(SaveFile.Strings[ii + 4], ',');
              Players[i].Integers[0] := StrToInt(SaveFile.Strings[ii + 5]);
              Players[i].Strings[0] := SaveFile.Strings[ii + 6];
              Players[i].Active := StrToBool(SaveFile.Strings[ii + 7]);
              For iii := 0 to 2 do
                Players[i].Booleans[iii] := StrToBool(SaveFile.Strings[ii + 8 + iii]);
            end;
            CurrentFP := HowManyPlayers - 1;
            Edits[0].Text := Players[CurrentFP].Name;
            Edits[1].Text := Players[CurrentFP].Pass;
            Edits[2].Text := Players[CurrentFP].Nick;
            Edits[3].Text := srl_Implode(Players[CurrentFP].BoxRewards, ',');
            ComboBoxes[1].Text := BoolToStr(Players[CurrentFP].Active);
            ComboBoxes[0].Text := Players[CurrentFP].Strings[0];
            Edits[4].Text := IntToStr(Players[CurrentFP].Integers[0])
            CheckBoxes[0].Checked := Players[CurrentFP].Booleans[0];
            CheckBoxes[1].Checked := Players[CurrentFP].Booleans[1];
            RadioButtons[Integer(not(Players[CurrentFP].Booleans[2]))].Checked;
            FillPlayerList;
            If Edits[0].Text <> '' then
              Buttons[0].Caption := 'New player';
          end;
        Finally
          SaveFile.Free;
        end;
      end;
    end;

    {Procedure OpenPlayerListFrom;
    Var
      FileInfo: TStringList;
      OpenDialog: TSaveDialog;
      TempString: String;
      i, ii, iii: Integer;
    Begin
      OpenDialog := TSaveDialog.Create(Form);
      With OpenDialog do
      Begin
        InitialDir := ScriptPath;
        Options := [ofFileMustExist, ofReadOnly];
        Filter := 'SCAR Scripts (*.scar)|*.scar|' +
                  'Text Files (*.txt)|*.txt|' +
                  'All Files|*|';
        If Execute then
          TempString := FileName
        else
        Begin
          FileInfo.Free;
          Free;
          Exit;
        end;
        Free;
      end;
      Try
        LoadFromFile(FileInfo, TempString);
      Except
        FileInfo.Free;
        GetApplication.MessageBox('File not found', '', 0);
        Exit;
      end;
      HowManyPlayers := StrToInt(FileInfo.Strings[0]);
      NumberOfPlayers(HowManyPlayers);
      For i := 0 to HowManyPlayers - 1 do
      Begin
        ii := 10 * i;
        Players[i].Name := FileInfo.Strings[ii + 1];
        Players[i].Pass := FileInfo.Strings[ii + 2];
        Players[i].Nick := FileInfo.Strings[ii + 3];
        Players[i].BoxRewards := srl_Explode(FileInfo.Strings[ii + 4], ',');
        Players[i].Integers[0] := StrToInt(FileInfo.Strings[ii + 5]);
        Players[i].Strings[0] := FileInfo.Strings[ii + 6];
        Players[i].Active := StrToBool(FileInfo.Strings[ii + 7]);
        For iii := 0 to 2 do
          Players[i].Booleans[iii] := StrToBool(FileInfo.Strings[ii + 8 + iii]);
      end;
      CurrentFP := HowManyPlayers - 1;
      Edits[0].Text := Players[CurrentFP].Name;
      Edits[1].Text := Players[CurrentFP].Pass;
      Edits[2].Text := Players[CurrentFP].Nick;
      Edits[3].Text := srl_Implode(Players[CurrentFP].BoxRewards, ',');
      ComboBoxes[1].Text := BoolToStr(Players[CurrentFP].Active);
      ComboBoxes[0].Text := Players[CurrentFP].Strings[0];
      Edits[4].Text := IntToStr(Players[CurrentFP].Integers[0])
      CheckBoxes[0].Checked := Players[CurrentFP].Booleans[0];
      CheckBoxes[1].Checked := Players[CurrentFP].Booleans[1];
      RadioButtons[Integer(not(Players[CurrentFP].Booleans[2]))].Checked;
      FillPlayerList;
    end;}


    Procedure CloseForm(SavePF, Run: Boolean);
    Begin
      AddPlayer(False);
      RunScript := not Run;
      Save := SavePF;
      Form.ModalResult := mrOk;
    end;

    Procedure MenuClicked(Sender: TObject);
    Begin
      Case Sender of
        MenuItems[0][1]: SavePlayerList;
        MenuItems[0][2]: SavePlayerListAs;
        MenuItems[0][3]: OpenPlayerList;
        MenuItems[0][4]: ClearPlayerList;
        MenuItems[1][1]: AddPlayer(True);
        MenuItems[1][2]: DeletePlayer;
        MenuItems[2][1]: CloseForm(False, True);
        MenuItems[2][2]: CloseForm(True, True);
        MenuItems[2][3]: CloseForm(True, False);
        MenuItems[2][4]: CloseForm(False, False);
      end;
    end;

    Procedure ItemClicked(Sender: TObject);
    Begin
      Case Sender of
        PlayerList: ClickPlayerList;
        Buttons[0]: AddPlayer(True);
        Buttons[1]: DeletePlayer;
        Buttons[2]: CloseForm(False, True);
        Buttons[3]: CloseForm(True, True);
        Buttons[4]: CloseForm(True, False);
        Buttons[5]: CloseForm(False, False);
      end;
    end;

    Function DownloadFiles: Boolean;
    Var
      Downloads: Array [0..1] of DownloadInfo;
      i, FileNo: Integer;
      FileData: String;
    Begin
      Result := False;
      For i := 0 to 1 do
        Downloads[i].Destination := AppPath + 'Cut Me Up\Script Files\';
      Downloads[0].Location := 'http://richardhonor.freehostia.com/CutMeUp/FormImage.bmp';
      Downloads[0].Name := Downloads[0].Destination  + 'FormImage.bmp';
      Downloads[1].Location := 'http://richardhonor.freehostia.com/CutMeUp/LatestStuff.txt';
      Downloads[1].Name := Downloads[0].Destination  + 'LatestStuff.txt';
      For i := 0 to 1 do
      Begin
        If FileExists(Downloads[i].Name) then
          Result := True
        else
        Begin
          FileData := GetPage(Downloads[i].Location);
          ClearDebug;
          WriteLN('Downloading files, please do not stop the script');
          WriteLN('Downloading file ' + IntToStr(i + 1) + ' of ' + IntToStr(High(Downloads) + 1));
          FileNo := RewriteFile(Downloads[i].Name, True);
          If FileNo > -1 then
            If FileData <> '' then
              Result := (WriteFileString(FileNo, FileData));
          If not(Result) then
            WriteLN('Unable to download files, please make sure you allow access through firewalls');
          CloseFile(FileNo);
        end;
      end;
    end;

    procedure InitForm;
    Var
      BMP, w, h: Integer;
      i, ii: Integer;
      Labels: Array [0..5] of TLabel;
      LabelNames: Array [0..4] of Array of String;
      MenuNames: Array of Array of String;
      TopImage: TImage;
    begin
      LabelNames[0] := ['Username:', 'Password:', 'NickName:', 'Box Rewards:', 'Loads:', 'Active:'];
      LabelNames[1] := ['Fletch', 'String'];
      LabelNames[2] := ['Longbow', 'Shortbow'];
      LabelNames[3] := ['Select Log Type', 'Normal', 'Oak', 'Willow', 'Maple', 'Yew', 'Magic'];
      LabelNames[4] := ['Add player', 'Delete player', 'Start script', 'Save and start', 'Save and Exit', 'Exit without saving'];
      Form := CreateForm;
      With Form do
      begin
        Width := 506;
        Height := 510;
        Position := poDesktopCenter;
        Caption := 'Cut Me Up!';
        Color := clWhite;
        PixelsPerInch := 96;
        BorderIcons := [biSystemMenu];
        BorderStyle := bsSingle;
        With Font do
        Begin
          Color := clWindowText;
          Name := 'Comic Sans MS';
        end;
      end;
      TopImage := TImage.Create(Form);
      With TopImage do
      Begin
        Parent := Form;
        Top := 0;
        Left := 0;
        Width := 500;
        Height := 100;
        ShowHint := True;
        Hint := 'Cut Me Up (Fletcher) ~ By Richard';
      end;
      BMP := LoadBitmap(AppPath + 'Cut Me Up\Script Files\FormImage.bmp');
      GetBitmapSize(BMP, w, h);
      CopyCanvas(GetBitmapCanvas(BMP), TopImage.canvas, 0, 0, w, h, 0, 0, w, h);
      FormMainMenu := TMainMenu.Create(Form);
      SetArrayLength(MenuNames, 3);
      MenuNames[0] := ['Player list', 'Save player list', 'Save player list as...', 'Load player list' , 'Reset player list'];
      MenuNames[1] := ['Players', 'Add player', 'Delete player'];
      MenuNames[2] := ['Exit', 'Start', 'Save and start', 'Save and exit', 'Exit'];
      SetArrayLength(MenuItems, GetArrayLength(MenuNames));
      for i := 0 to High(MenuItems) do
      begin
        SetArrayLength(MenuItems[i], GetArrayLength(MenuNames[i]));
        for ii := 0 to High(MenuItems[i]) do
        begin
          MenuItems[i][ii] := TMenuItem.Create(Form);
          MenuItems[i][ii].Caption := MenuNames[i][ii];
          MenuItems[i][ii].OnClick := @MenuClicked;
          if ii = 0 then
            FormMainMenu.Items.Add(MenuItems[i][ii])
          else
            FormMainMenu.Items.Items[i].Add(MenuItems[i][ii]);
        end;
      end;
      For i := 0 to 3 do
      Begin
        Edits[i] := TEdit.Create(Form);
        With Edits[i] do
        Begin
          Parent := Form;
          Top := 100 + (30 * (i + 1));
          Left := 110;
          Width := 200;
          Height := 20;
        end;
      end;
      With Edits[1] do
        PasswordChar := '*';
      Edits[4] := TEdit.Create(Form);
      With Edits[4] do
      Begin
        Parent := Form;
        Top := 160;
        Left := 370;
        Width := 70;
        Height := 20;
      end;
      For i := 0 to 3 do
      Begin
        Labels[i] := TLabel.Create(Form);
        With Labels[i] do
        Begin
          Parent := Form;
          Top := 100 + (30 * (i + 1));
          Left := 20;
          Caption := LabelNames[0][i];
          With Font do
          Begin
            Color := clBlack;
            Name := 'Comic Sans MS';
            Size := 10;
          end;
        end;
      end;
      For i := 4 to 5 do
      Begin
        Labels[i] := TLabel.Create(Form);
        With Labels[i] do
        Begin
          Parent := Form;
          Top := -110 + (60 * i);
          Left := 382;
          Caption := LabelNames[0][i];
          With Font do
          Begin
            Color := clBlack;
            Name := 'Comic Sans MS';
            Size := 10;
          end;
        end;
      end;
      ComboBoxes[1] := TComboBox.Create(Form);
      With ComboBoxes[1] do
      Begin
        Parent := Form;
        Top := 220;
        Left := 370;
        Width := 70;
        Height := 20;
        Text := 'True';
        With Items do
        Begin
          Add('True');
          Add('False');
        end;
      end;
      For i := 0 to 1 do
      Begin
        CheckBoxes[i] := TCheckBox.Create(Form);
        With Checkboxes[i] do
        Begin
          Parent := Form;
          Top := 240 + (25 * (i + 1));
          Left := 30;
          Width := 80;
          Height := 15;
          Caption := LabelNames[1][i];
          If i = 0 then
            Checked := True;
        end;
      end;
      For i := 0 to 1 do
      Begin
        RadioButtons[i] := TRadioButton.Create(Form);
        With RadioButtons[i] do
        Begin
          Parent := Form;
          Top := 240 + (25 * (i + 1));
          Left := 200;
          Width := 80;
          Height := 15;
          Caption := LabelNames[2][i];
          If i = 0 then
            Checked := True;
        end;
      end;
      ComboBoxes[0] := TComboBox.Create(Form);
      With ComboBoxes[0] do
      Begin
        Parent := Form;
        Top := 272;
        Left := 350;
        Width := 110;
        Height := 20;
        Text := 'Select Log Type';
        For i := 0 to High(LabelNames[3]) do
          With Items do
            Add(LabelNames[3][i]);
      end;
      PlayerList := TListBox.Create(Form);
      With PlayerList do
      Begin
        Parent := Form;
        Top := 330;
        Left := 20;
        Width := 150;
        Height := 120;
        OnClick := @ItemClicked;
      end;
      For i := 0 to 5 do
      Begin
        Buttons[i] := TButton.Create(Form);
        With Buttons[i] do
        Begin
          Parent := Form;
          Height := 25;
          Width := 120;
          OnClick := @ItemClicked;
          Caption := LabelNames[4][i];
          If (i mod 2) = 0 then
          Begin
            Left := 200;
            Top := 337 + (i * 20);
          end else
          Begin
            Left := 330;
            Top := 337 + ((i - 1) * 20);
          end;
        end;
      end;
      OpenPlayerList;
    end;

    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    procedure ShowFormModal;
    begin
      Form.ShowModal;
    end;

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

    Procedure DoForm;
    begin
      If not(DownloadFiles) then
        TerminateScript;
      CurrentFP := -1;
      HowManyPlayers := 0;
      NumberOfPlayers(HowManyPlayers);
      SafeInitForm;
      SafeShowFormModal;
      If Save then
        SavePlayerList;
      If RunScript then
        TerminateScript;
    end;

    begin
      DoForm;
    end.

    If the files are unable to download, just get them directly from my website: http://richardhonor.freehostia.com/CutMeUp
    Last edited by Richard; 08-03-2009 at 10:10 AM.

  2. #2
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Procedure ClickPlayerList;
    Add a check to it that only updates player info if it is non blank. The problem seems to be that you reset the fields, thus making the name TEdit hold '', then by clicking on the player list, you update the info, so the latest new player has a name of '' (and all other details of default), meaning that he isn't added to the player list
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  3. #3
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Oh, I see what I did there. I just assumed that the try would just not enter it if it failed.

    Thanks, as usual you never fail to help

Thread Information

Users Browsing this Thread

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

Posting Permissions

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