0 votes
by (1.1k points)
retagged by

Just a little doubt, how to do something like a save menu with both load-save options?



2 Answers

+2 votes
by (63.1k points)
selected by
Best answer

Something like this will work but it's messy and probably not perfect.

$(document).on(':dialogopen', function () {
    setTimeout(function () {
        if ($('#ui-dialog-body').hasClass('saves')) {
            var loadBtns = $('#ui-dialog-body.saves button.load').toArray();
            loadBtns.forEach( function (el) {
                var $load = $(el);
                var slot = Number($load.attr('id').split('-')[2]);
                            .ariaClick({ label : 'Overwrite Slot ' + (slot + 1) }, function () {
            $('#ui-dialog-body.saves button.delete').ariaClick( function () {
    }, Engine.minDomActionDelay);

Edit: fixed errors.

0 votes
by (44.7k points)
That's the standard SugarCube "Saves" dialog in that image.

You didn't say what story format you're using, but if it's SugarCube, then you already have that.
by (1.1k points)

Sorry, that was corrected. And the default save menu of mine is like this...


by (159k points)


That's the standard SugarCube "Saves" dialog in that image.

Actually it's not, each slot has being given an extra Save option so that the end-user can "save over" the current data without needing to use that slot's Delete option first.


As I understand things the layout/contents of the standard Save Dialog is (re)generated each time that dialog is shown. So to modify it's functionally "on the fly" there would need to be some sort of notification event between the time that dialog's content has been generated and the time that dialog is show to the end-user, and I personally don't know of such an event.

This would mean you would need to construct your own custom Save dialog, which I believe is possible using the Dialog API combined with information like that found in the Save Settings section of the Config API and the functionallity of the Save API.