This just happened to me and I want advice to stop it from happening again. I have no idea if this is a well-known glitch or not. Or if there’s a way to reverse it.
Today, I turned on my computer to open up Inform, to work on my game. I open up my project and…it’s blank. Like, not a word written in the source file. All gone.
I didn’t do anything to delete it. It was around two thousand words of source code, so it’s not like I back-spaced it all away. And it’s not an issue of forgetting to save. I know for a fact I saved regularly. If I forgot, it would have been maybe a sentence or paragraph lost, not the whole damned thing.
Thankfully, my game isn’t entirely lost. I had the foresight to just in case, email myself the source text of my game a scene ago. I’m still upset and frustrated I have to re-write an entire scene, but since I wrote this scene yesterday, it’s still fresh enough in my mind that I’ll probably be able to re-construct it.
I just want to know if this is a known bug and if so, if there’s a way to prevent it. Now, I’m gonna be super paranoid about backing up my game. Strangely enough, my other game I’m working on is intact. It’s just this one that vanished. And, the folder for it is still present, it just thinks it’s a blank game. No text at all in the source. In fact, the default title line of text even vanished, in this case "‘petgame’ by squidteeth’. Sigh. I sure am in a mood from this.
What OS are you running and what version of Inform? Any additional information would be helpful.
The reason I ask is that I’ve been using Inform7 (now just Inform) on both MacOS and Windows since at least 2007 and have never had this happen. I also do not recall ever hearing of this, nor can I find anything like this on this forum using a search. (There is a post from a number of years back from someone who accidentally deleted their game, but no unexplained mystery-deletions.)
Yeah, I have to add as a point of data, I’ve never heard of a spontaneous source clear by Inform itself.
I find the commonest brand of accident I experience that could lead to this is… in the IDE, it’s very easy to accidentally type into your source when you think the cursor is in the game window and vice versa.
I have damaged games this way (finished off a test play session by hitting space or delete or return, and punched a hole in the source) just before saving. Or started to type, thinking I was playing, not realising I just typed over some source, refocusing the cursor in the game window and continuing on without realising what I just did.
In the absence of a true bug, I would guess accidentally selecting the source, pressing space or return without realising the window you’re in, then saving, would be the most logically feasible cause. You could even UNDO this error at the time, but then finish off by choosing not to save your updated work, meaning the last save would be the empty one.
I can’t say this is what’s happened, but if nothing else, it’s something to watch out for.
I’ve also never had this happen, and it sounds very strange.
Taking regular backups, of anything you don’t want to lose, is very important. Remove “foresight” from the equation - you should always take backups no matter what.
Welcome! But, also, ouch … I’ve seen reports of this before (8+ years maybe?) with the Windows IDE. It seems it does delete the file, then remake it – I’ve tried to make my file a link to a github repo, but it’s replaced with a file and not a link.
Good job saving the work you had.
Before I started using source control, I tried to copy over my story.ni to something like story-20230810.txt. This can be done once a day, and I assume a script can be written so that if the size drops off drastically, it doesn’t happen. It seems worth the time to write a script to make it happen.
Good job making backups – I often do that just before trying some tricky code anyway. It’s good practice. But many of us don’t.
I’d suggest a cron job on Unix which can be run in all your .inform directories:
cp story.ni story-`date` +'%y%m%d'
It’s not so easy to do with Windows (probably use simple Python) but I still think this question came up enough that it’s worth having somewhere.
I recommend backing up story.ni into a different directory, outside your foo.inform project folder. It’s conceivable that an Inform bug could cause it to lose or overwrite the entire foo.inform/Source directory.
(There have been a couple reported cases where the project folder got corrupted and Inform refused to open it. Those didn’t involve lost data – the story.ni file was still present – but it speaks to some kind of rare IDE bug, and you don’t really want to rely on bugs behaving nicely.)
If you use Git or some other source control system, it’s pretty easy to track Inform changes in it. Create a Git repository which contains foo.inform and foo.materials. Then add only foo.inform/Source/story.ni from the foo.inform – you don’t want the rest of it. (Maybe Skein.skein if you’re actively using the Skein.)
It would be quite a good idea for the IDE to automatically keep old versions. or even just the last version would be helpful. story.ni.bak or something.
Thanks for the answers guys! You’ve been very helpful. I was a bit afraid this was some sort of noob question that gets asked here all the time or something.
I wouldn’t write out that I accidentally did it myself somehow. I guess it’ll remain a mystery, but for now, I’m gonna make a habit of regularly making backups. It can’t hurt.
I was able to rewrite the lost scene and I think it’s better in attempt two. I was able to make some things more concise that needed trimming, and add more detail to parts that could use it, so I guess though frustrating, it was a blessing in disguise.
I’d also add uuid.txt so that you always have the same IFID for the project. (And maybe Settings.plist to keep the compiler version Inform will use, but it’s less important.)