SRL Archive - General Botting Help

Determining settings file path??


Nufineek

2014-10-07 12:58:10

So..after one of the recent SRL updates, my Simba stopped saving Script’s settings xml file to the path I define within the script using scriptSettingsPath := ‘C:\……. Instead, it makes a folder with the same name as the script and puts the settings.xml into that folder. Has the way to specify settings path changed?? Thanks

Simbanoobie

2014-10-07 14:04:06


procedure _PF_SaveSettings();
var
i, j: Integer;
Path, FilePath: String;
List: TStringList;
begin
Path := AppPath + 'Scripts/' + PlayerForm.MainForm.getCaption() + '/';
FilePath := Path + 'Settings.txt';

DebugLn(Format('PlayerForm: Saving player settings to %s', [Path]));

if (Length(PlayerForm.Players) = 0) then
Exit();

if (not DirectoryExists(Path)) then
ForceDirectories(Path);

if (DirectoryExists(Path)) then
begin
if (FileExists(FilePath)) then
DeleteFile(FilePath);

List.Init();

try
List.Add(Format('<Army>%s</Army>', [playerForm.__loadedArmyName]));
List.Add('');

for i := 0 to High(PlayerForm.Players) do
begin
List.Add(Format('<%s>', [PlayerForm.Players[i].LoginName]));
List.Add(' ' + ToString(PlayerForm.Players[i].Settings));
List.Add(Format('</%s>', [PlayerForm.Players[i].LoginName]));
List.Add('');
end;
finally
if (Length(List.getText()) > 0) then
List.SaveToFile(FilePath);
List.Free();
end;
end;
end;

It seems like scriptsettingsPath isn't being used anymore (although it is still defined as a string within the srlplayerform). You could edit the above procedure in the srlplayerform to save to a different location.

Nufineek

2014-10-07 16:49:40

From: Simbanoobie

procedure _PF_SaveSettings();
var
i, j: Integer;
Path, FilePath: String;
List: TStringList;
begin
Path := AppPath + 'Scripts/' + PlayerForm.MainForm.getCaption() + '/';
FilePath := Path + 'Settings.txt';

DebugLn(Format('PlayerForm: Saving player settings to %s', [Path]));

if (Length(PlayerForm.Players) = 0) then
Exit();

if (not DirectoryExists(Path)) then
ForceDirectories(Path);

if (DirectoryExists(Path)) then
begin
if (FileExists(FilePath)) then
DeleteFile(FilePath);

List.Init();

try
List.Add(Format('<Army>%s</Army>', [playerForm.__loadedArmyName]));
List.Add('');

for i := 0 to High(PlayerForm.Players) do
begin
List.Add(Format('<%s>', [PlayerForm.Players[i].LoginName]));
List.Add(' ' + ToString(PlayerForm.Players[i].Settings));
List.Add(Format('</%s>', [PlayerForm.Players[i].LoginName]));
List.Add('');
end;
finally
if (Length(List.getText()) > 0) then
List.SaveToFile(FilePath);
List.Free();
end;
end;
end;

It seems like scriptsettingsPath isn't being used anymore (although it is still defined as a string within the srlplayerform). You could edit the above procedure in the srlplayerform to save to a different location.

Oh yeah. Exactly what I needed. Thanks man!