Something quick I same up with, because I saved my city, then when I loaded i noticed there was an explosion brick that killed players after 30 seconds that I could not find. So I made a code to remove any event types I wanted to be deleted.
function deleteEventsByname(%saveFile, %eventType)
{
if(%eventType $= "")
{
error("deleteEventsByname() => Event Type Required.");
return;
}
if(isFile(findFirstFile("saves/*/" @ %saveFile @ ".bls")) == false) {
error("deleteEventsByname() => File Not Found.");
return;
}
%saver = new FileObject();
%file = new FileObject();
%file.openForRead(findFirstFile("saves/*/" @ %saveFile @ ".bls"));
%saver.openForAppend(filePath(findFirstFile("saves/*/" @ %saveFile @ ".bls")) @ "/" @ %saveFile @ "_No_" @ %eventType @"_Events.bls");
while(!%file.isEOF())
{
%line = %file.readLine();
if(strstr(%line, stricmp(%line, %eventType)) == -1) {
%saver.writeLine(%line);
}
}
%file.close();
%file.delete();
%saver.close();
%saver.delete();
}
Usage: deleteEventsByname(<Save Name>, <Event Type>);
And to dump events to a file:
function dumpSaveEventsToLog(%save)
{
if(isFile(findFirstFile("saves/*/" @ %save @ ".bls")) == false) {
error("dumpSaveEventsToLog() => File Not Found.");
return;
}
%dumpCount++;
%file = new FileObject();
%file.openForRead(findFirstFile("saves/*/" @ %save @ ".bls"));
%saver = new FileObject();
%saver.openForAppend("./" @ %save @ "_Event_Dump.txt");
while(!%file.isEOF())
{
%line = %file.readLine();
if(getWord(%line, 0) $= "+-EVENT")
{
%saver.writeLine(%line);
%dumpcount++;
}
}
%saver.writeLine("");
%saver.writeLine("");
%saver.writeLine("Number of Events Dumped:" SPC %dumpcount);
%file.close();
%file.delete();
%saver.close();
%saver.delete();
echo("File Saved to:" SPC %save @ "_Event_Dump.txt");
}
Usage: dumpSaveEventsToLog(<Save Name>);