mc_teo
2009-05-04 15:21:27
This is my first tutorial, on a handy little procedure.
WriteINI() is a very nice, and easy way to save peoples settings from a DeclarePlayers Procedure.
The format is:
A section can be used for different players.
the key would be like 'user', and the value would be the username.
this is best inplimented in forms, for a save and load button.
A working example:
So this saves the Info into 'Scripts/settings.ini' in the format of
this could be put behind a "Save" button on a form to save it all, so next time you would only have to load it, by pressing "Load"…
This deletes the Key passed to it and the Value associated with it.
Anyways, this is my first tutorial…
Please leave me any comments
WriteINI() is a very nice, and easy way to save peoples settings from a DeclarePlayers Procedure.
The format is:
WriteINI(Section, Key, Value, FilePath);
Value := ReadINI(Section, Key, FilePath);
A section can be used for different players.
the key would be like 'user', and the value would be the username.
this is best inplimented in forms, for a save and load button.
A working example:
program SaveAndLoad;
const
Info = 'Information_goes_here';
var
filename:string;
Value:string;
procedure Save;
begin
WriteINI('TestSection', 'TestKey', Info, FileName);
end;
procedure Load;
begin
Value := ReadINI('TestSection', 'TestKey', Filename);
end;
begin
FileName := AppPath + 'Scripts\settings.ini';
Save;
Load;
WriteLn(Value);
end.
So this saves the Info into 'Scripts/settings.ini' in the format of
[TestSection]
TestKey=Information_goes_here
and loads it to write it out.this could be put behind a "Save" button on a form to save it all, so next time you would only have to load it, by pressing "Load"…
DeleteINI(Section, Key, FilePath);
This deletes the Key passed to it and the Value associated with it.
Anyways, this is my first tutorial…
Please leave me any comments