I have this:
new SimObject("Microlite")
{
datalList = "name level str dex mind hp ac class race physical subterfuge knowledge communication strmod dexmod mindmod attackmeleemod attackmagicmod attackmisslemod inventory";
worldName = "Blockland"; // todo: figure out how to save config data
dungeonMaster = getNumKeyId(); // get host bl_id
};
exec("microlite/config.cs");
function Microlite::save()
{
export("Microlite.*", "microlite/config.cs");
}
It's untested but I don't honestly believe it'll work, can someone suggest something better? I need to backup the fields noted in the definition of the SimObject.
I could do something like this, which I am doing elsewhere for other things:
function Microlite::exportCharacter(%client)
{
echo("Exporting character for " @ %client.blid);
%path = "microlite/" @ %client.blid @ ".txt");
new fileObject("MicroliteFO");
MicroliteFO.openForWrite(%path);
for(%i = 0; %i < getWordCount(Microlite.dataList); %i++)
{
%var = getWord(Microlite.dataList, i);
MicroliteFO.writeLine(%var @ "\t" @ %client.Microlite[%var]);
}
echo("Exported character.");
MicroliteFO.close(); MicroliteFO.delete();
}
Note the reference to
Microlite.dataList, defined in the first bit of code.
The stuff I'm exporting for the character sheets is defined as
%client.Microlite[%var], where name is one of the things in
Microlite.dataList. I could the same sort of thing, manually exporting it, but I was hoping for a default functions similar to
export(variableRegex, pathTo.cs);.
Any suggestions?
The entire code, neccesary for whatever purpose, can be found
here.