Hi all!

I'm making a space shooter game. In the game I want to have a simple form of dialog. This is simply a text that shows after x frames have passed and it shows for y frames.

[pascal]
type
TDialog = record
Name: String; // identifier used by the editor
StartFrame, NumOfFrames: Integer;
Text1, Text2, Text3: String; // text to display
end;
TDialogs = array of TDialog;
[/pascal]

To store this information I've decided to use ini files (I may use a TStream later, but during development ini files are more flexible). The save and load procedures look like this:

[pascal]
procedure SaveDialogToIni(var Dialog: TDialogs; const FileName: String);
var
Ini: TIniFile;
i: Integer;
begin
Ini := TIniFile.Create(FileName);
try
Ini.WriteInteger('General', 'NumOfDlg', Length(Dialog));
for i := 0 to High(Dialog) do
begin
Ini.WriteString ('Dialog'+IntToStr(i+1), 'Name' , Dialog[i].Name );
Ini.WriteInteger('Dialog'+IntToStr(i+1), 'StartFrame' , Dialog[i].StartFrame );
Ini.WriteInteger('Dialog'+IntToStr(i+1), 'NumOfFrames', Dialog[i].NumOfFrames);
Ini.WriteString ('Dialog'+IntToStr(i+1), 'Text1' , Dialog[i].Text1 );
Ini.WriteString ('Dialog'+IntToStr(i+1), 'Text2' , Dialog[i].Text2 );
Ini.WriteString ('Dialog'+IntToStr(i+1), 'Text3' , Dialog[i].Text3 );
end;
finally
Ini.Free;
end;
end;

procedure LoadDialogFromIni(var Dialog: TDialogs; const FileName: String);
var
Ini: TIniFile;
i, len: Integer;
begin
Dialog := nil;

Ini := TIniFile.Create(FileName);
try
len := Ini.ReadInteger('General', 'NumOfDlg', 0);
SetLength(Dialog, len);
for i := 0 to len - 1 do
begin
Dialog[i].Name := Ini.ReadString ('Dialog'+IntToStr(i+1), 'Name' , '');
Dialog[i].StartFrame := Ini.ReadInteger('Dialog'+IntToStr(i+1), 'StartFrame' , 0 );
Dialog[i].NumOfFrames := Ini.ReadInteger('Dialog'+IntToStr(i+1), 'NumOfFrames', 0 );
Dialog[i].Text1 := Ini.ReadString ('Dialog'+IntToStr(i+1), 'Text1' , '');
Dialog[i].Text2 := Ini.ReadString ('Dialog'+IntToStr(i+1), 'Text2' , '');
Dialog[i].Text3 := Ini.ReadString ('Dialog'+IntToStr(i+1), 'Text3' , '');
end;
finally
Ini.Free;
end;
end;
[/pascal]

I use the same dialog-unit in two programs (the game and the dialog editor). In the editor everything the following loads the info and everything is fine:
[pascal]
if OpenDialog1.Execute then
begin
ListBox1.Clear;

LoadDialogFromIni(Dialog, OpenDialog1.FileName);

for i := 0 to High(Dialog) do
ListBox1.Items.Add(Dialog[i].Name);
end;
[/pascal]

However in the game I use:
[pascal]
LoadDialogFromIni(Dialog, AName + '.dlg');
[/pascal]
and it doesn't load.

Any ideas?