Hey guys, so I have this code:
function servercmdWriteFile(%filename, %input)
{
%filename = new FileObject();
%filename.OpenForAppend("Add-Ons/script_Testing/filewrite.cs");
%filename.writeLine(%input);
%filename.close();
%filename.delete();
echo("You wrote in the file.");
}
function servercmdReadFile(%filename)
{
%filename = new FileObject();
%filename.OpenForRead("Add-Ons/script_Testing/filewrite.cs");
while(!%filename.isEOF())
{
announce("Lines You've Read:" SPC %lineCt);
%lineCt++;
announce(%filename.ReadLine());
}
announce("In total, you've read" SPC %lineCt SPC "line(s).");
%filename.close();
%filename.delete();
}
I want to be able to modify a file ingame, using the servercmds I set up. It's working fine when I do the read command:

...but, how do I make it so this data is stored to a text/.cs document? At the bottom of the tutorial I was using, it said that the command
save(object, file); could be used to save to a file. I have no idea how to use this, though.
function servercmdWriteFile(%filename, %input)
{
%filename = new FileObject();
%filename.OpenForAppend("Add-Ons/script_Testing/filewrite.cs");
%filename.writeLine(%input);
save(%filename, "Add-Ons/script_Testing/filewrite.cs");
%filename.close();
%filename.delete();
echo("You wrote in the file.");
}
is far from working.
Am I misunderstanding the whole thing completely, or do I just not know how to use that command?