tmedwards / sugarcube-2

SugarCube is a free (gratis and libre) story format for Twine/Twee.
https://www.motoslave.net/sugarcube/2/
BSD 2-Clause "Simplified" License
177 stars 41 forks source link

Ability to add note to save slot #39

Closed ArdiGame closed 4 years ago

ArdiGame commented 4 years ago

I would love to see a way to add a custom name or small note to the slot upon save, similar to Sierra's "Quest" games.

twine-sc2_customsavebox

Jaydax1729 commented 4 years ago

Oddly sometimes I see details in the second section but mostly I see only load or Delete

HiEv commented 4 years ago

Are you talking about the user being able to do that or the developer?

Either way, you can do that by creating a Config.saves.onSave function and set the "title" property on the "save" object, which will set the title of the save. For a simple example, you could put this in your JavaScript section:

Config.saves.onSave = function (save) {
    save.title = prompt("Enter Save Slot Title:", save.title);
};

and that would prompt the user to give the save slot a custom title.

Hope that helps! :smiley:

ArdiGame commented 4 years ago

@HiEv Sorry, should have clarified that. I'd want it to be an end-user function, though being able to set that as a developer is nice too, but it feels like that would be too complicated to be worth it.

Much appreciated for the function idea. I'll definitely utilize that in my current project. 😃

While it's possible to create a function to do this in individual projects, I personally think it would do well as a default feature, or at least something toggleable like a dedicated config api option.

HiEv commented 4 years ago

@rambdev - Perhaps you didn't notice my edit, but the code there now will let the end-user set the title of the save slot.

Try it out. :smiley:

ArdiGame commented 4 years ago

@HiEv Ah, I didn't see that. The original code was allowing end-user usage as well as far as I can tell, but I'll give that a try too. Thanks!

tmedwards commented 4 years ago

Closed in favor of the v3 issue: https://github.com/tmedwards/sugarcube-3-prealpha/issues/1

NOTE: The v3 repository is not yet public, so the above link probably will not work for you until it is.