+1 vote
by (130 points)
edited by
As the topic states... how do I display the autosave metadata in a passage?

I want to display what game area the autosave relates to in my custom save interface.

 eg on "Day 3"

<<script>>SaveSystem.saveAuto(, $3)<</script>>

then in interface...

Autosave: Day ???

what would replace the ??? to show the metadata?

 

or alternatively, how do I display the title of the autosave in the passage? that would be better solution too.

1 Answer

+1 vote
by (68.6k points)

The save object documentation enumerates the properties you need—title and metadata.  Also, yes, you probably do not need to use the metadata property if all you want to do is display, essentially, a title.

Regardless.  I'll cover both storing and retrieving the autosave title and metadata.

Storing examples:

/* Default title, w/o metadata */
<<script>>SaveSystem.saveAuto()<<script>>

/* Default title, w/ metadata */
<<script>>SaveSystem.saveAuto(null, { place : "Armory" })<<script>>

/* Custom title, w/o metadata */
<<script>>SaveSystem.saveAuto("Day 3")<<script>>

/* Custom title, w/ metadata */
<<script>>SaveSystem.saveAuto("Day 3", { place : "Armory" })<<script>>

Retrieving examples:

/* Print title */
<<print SaveSystem.getAuto().title>>

/* Print metadata */
<<print SaveSystem.getAuto().metadata.place>>

/* Print title & metadata */
<<print SaveSystem.getAuto().title>>, <<print SaveSystem.getAuto().metadata.place>>

NOTE: While I stored an object in the save's metadata property in the examples, doing so is not a requirement.  Directly assigning it a primitive type—e.g. a number or string—is also valid.

...