Saving without prompting for filename

Does Inform 7 provide any way to save a game without prompting the player for a filename? (i.e., to force the save to a particular filename).

I could imagine syntax like

save the game as "gameone"

I realize that it could fail if the filename is illegal, and that behavior might depend on the interpreter, but that’s OK.

It’s not provided out of the box, but you could do it with a small extension. (Quite possibly this already exists.)

The only hangup is that you can’t specify a directory – neither Glulx nor Z-code lets you do that. So where the file winds up is up to the interpreter. Could be the same directory as the game file, or in a folder in the user’s documents directory somewhere. That may be fine, though, depending on what you need.

2 Likes

Yep, here’s an example of how it would work for Glulx. This extension always uses the name “autosave” (it’s hardcoded into the functions) but it wouldn’t be too hard to read the value of an I7 text variable instead.

2 Likes

Heh, shoulda known. :) Thanks.

2 Likes