MakeNPC( name as text )
var/filepath = "npcs/npc_[name].sav"
var/savefile/F = New( filepath )
F["owner"] << usr.ckey
etc.
global.npc_saves += filepath
LoadNPCs()
for( var/dir in global.npc_saves )
if( file(dir) )
etc.
else
global.npc_saves -= dir
... But, using this method, file() returns true regardless of if the savefile exists or not.
I've tried various other methods, ( isfile() always returns false instead, etc. ) and eventually found something that did work, but it involves reading a value from the savefile, which ends up creating a blank savefile if the file doesn't exist. While this does work, because a blank savefile doesn't have the value I'm checking for, it feels like this solution could be confusing for the end user, as suddenly a file that they deleted suddenly "sprang back up", even if now 0 bytes in size. And I can't seem to figure out if I can delete the file from BYOND, either.
Am I just approaching this from the wrong way, or am I just stuck with this if I want to use this method?