Sugarcube & Save Titles

So I’m trying to figure out how to set a save title based on a variable, or… I guess, more simply append a variable to a save title. I already searched for this question before and greyelf did refer to the config.save stuff but all that really lets you do (simply) is set a specific title based on passage. Which is nice, but I’d like to have something like description AND a variable added on top. i.e, if the config description is set to the name of the story, it would be nice to append a variable like day number/turn number after that. Anyone know how to do this? I have the feeling that the metadata commands would do this, but I have no clue how to use them properly…

In your JavaScript section you’ll simply need to add something like this:

Config.saves.onSave = function (save) {
	save.title = "Description: " + State.variables.variableName;
};

That function will get triggered when the player goes to save the game, and it will modify the title of the save (per the Save API’s description of the save object) to be “Description: (value of $variableName)”. See the Config.saves.onSave property and the State.variables property for details.

That said, if the description is too long, then the end of the title will be truncated with an ellipsis, so you might want to put the day/turn number in the front.

Hope that helps! :slight_smile:

Whoa, cool! Thanks.