subsystem_Save

This contains the source code documentation of the class subsystem_Save.

subsystem_Save

Inherits: DialogicSubsystem

Subsystem that manages saving and loading data.

Properties


Methods

ReturnsMethod
voidadd_empty_slot ( slot_name: String )
voidclear_game_state ( _clear_flag: int = 0 )
voiddelete_slot ( slot_name: String )
Stringget_default_slot ( )
Stringget_encryption_password ( )
Variantget_global_info ( key: String, default: Variant )
Stringget_latest_slot ( )
Dictionaryget_slot_info ( slot_name: String = "" )
Arrayget_slot_names ( )
Stringget_slot_path ( slot_name: String )
ImageTextureget_slot_thumbnail ( slot_name: String )
boolhas_slot ( slot_name: String )
voidload ( slot_name: String = "" )
Variantload_file ( slot_name: String, file_name: String, default: Variant )
voidperform_autosave ( )
voidreset_slot ( slot_name: String = "" )
voidsave ( slot_name: String = "", is_autosave: bool = false, thumbnail_mode: int = 1, slot_info: Dictionary = <unknown> )
voidsave_file ( slot_name: String, file_name: String, data: Variant )
voidsave_slot_thumbnail ( slot_name: String )
voidset_global_info ( key: String, value: Variant )
voidset_latest_slot ( slot_name: String )
voidset_slot_info ( slot_name: String, info: Dictionary )
voidtake_thumbnail ( )

Constants

const SAVE_SLOTS_DIR = "user://dialogic/saves/"

No description available.


const AUTO_SAVE_SETTINGS = "dialogic/save/autosave"

No description available.


const AUTO_SAVE_MODE_SETTINGS = "dialogic/save/autosave_mode"

No description available.


const NONE = 0

No description available.


const TAKE_AND_STORE = 1

No description available.


const STORE_ONLY = 2

No description available.


const ON_TIMELINE_JUMPS = 0

No description available.


const ON_TIMER = 1

No description available.


const ON_TEXT_EVENT = 2

No description available.


Signals

signal saved ( info: Dictionary )

Emitted when a save happened. The info contains the following keys: - slot_name: The String name of the slot that the game state was saved to. - is_autosave: true if the save was an autosave.


Property Descriptions

var autosave_enabled = false

Whether the auto-save feature is enabled. The initial value can be set in the project settings via th Dialogic editor. This can be toggled during the game.


var autosave_mode = 0

Under what conditions the auto-save feature will trigger if autosave_enabled is true.


var autosave_time = 60

After what time interval the auto-save feature will trigger if autosave_enabled is true and autosave_mode is AutoSaveMode.ON_TIMER.


var autosave_timer =

################################################################################################## Reference to the autosave timer.


var latest_thumbnail = null

No description available.


Method Descriptions

func add_empty_slot ( slot_name: String ) ⇒ void

This adds a new save folder with the given name


func clear_game_state ( _clear_flag: int = 0 ) ⇒ void

Built-in, called by DialogicGameHandler.


func delete_slot ( slot_name: String ) ⇒ void

Removes all the given slot along with all it's info/files.


func get_default_slot ( ) ⇒ String

Returns the default slot name defined in the dialogic settings


func get_encryption_password ( ) ⇒ String

Gets the encryption password from the project settings if it has been set. If no password has been set, an empty string is returned.


func get_global_info ( key: String, default: Variant ) ⇒ Variant

Access the data unrelated to a save slot. First, the data must have been set with set_global_info.


func get_latest_slot ( ) ⇒ String

Returns the latest slot or empty if nothing was saved yet


func get_slot_info ( slot_name: String = "" ) ⇒ Dictionary

No description available.


func get_slot_names ( ) ⇒ Array

################################################################################################## Returns a list of all available slots. Useful for iterating over all slots, e.g., when building a UI with all save slots.


func get_slot_path ( slot_name: String ) ⇒ String

Returns the full path to the given slot folder


func get_slot_thumbnail ( slot_name: String ) ⇒ ImageTexture

Returns the thumbnail of the given slot.


func has_slot ( slot_name: String ) ⇒ bool

Returns true if the given slot exists.


func load ( slot_name: String = "" ) ⇒ void

Loads all info from the given slot in the DialogicGameHandler (Dialogic Autoload). If no slot is given, the default slot is used. To check if something is saved in that slot use has_slot(). If the slot does not exist, this method will fail.


func load_file ( slot_name: String, file_name: String, default: Variant ) ⇒ Variant

Loads a file using slot_name and returns the contained info. This method allows you to build your own save and load system. You may be looking for the simple load method to load the game state.


func perform_autosave ( ) ⇒ void

Perform an autosave. This method will be called automatically if the auto-save mode is enabled.


func reset_slot ( slot_name: String = "" ) ⇒ void

Reset the state of the given save folder (or default)


func save ( slot_name: String = "", is_autosave: bool = false, thumbnail_mode: int = 1, slot_info: Dictionary = <unknown> ) ⇒ void

Saves the current state to the given slot. If no slot is given, the default slot is used. You can change this name in the Dialogic editor. If you want to save to the last used slot, you can get its slot name with the [method get_latest_slot()] method.


func save_file ( slot_name: String, file_name: String, data: Variant ) ⇒ void

Saves a variable to a file in the given slot. Be aware, the slot_name will be used as a filesystem folder name. Some operating systems do not support every character in folder names. It is recommended to use only letters, numbers, and underscores. This method allows you to build your own save and load system. You may be looking for the simple save method to save the game state.


func save_slot_thumbnail ( slot_name: String ) ⇒ void

No need to call from outside. Used to store the latest thumbnail to the given slot.


func set_global_info ( key: String, value: Variant ) ⇒ void

Data set in global info can be accessed unrelated to the save slots. For instance, you may want to store game settings in here, as they affect the game globally unrelated to the slot used.


func set_latest_slot ( slot_name: String ) ⇒ void

No description available.


func set_slot_info ( slot_name: String, info: Dictionary ) ⇒ void

No description available.


func take_thumbnail ( ) ⇒ void

This method creates a thumbnail of the current game view, it allows to save the game without having the UI on the save slot image. The thumbnail will be stored in latest_thumbnail. Call this method before opening your save & load menu. After that, call save with [constant ThumbnailMode.STORE_ONLY]. The save will automatically use the stored thumbnail.