Saving&Loading

Well... Why does this not work? Saving seems to work. But loading doesn't work and gives an audio beep. Did I alias wrong?

Outcommenting def self.extract_save_contents(contents) will just crash the game with undefined method "window tone" for Nil class.

module DataManager class << self alias nap_minimap_make_save_contents make_save_contents alias nap_minimap_extract_save_contents extract_save_contents end def self.make_save_contents contents = {} if !contents contents[:nap_minimap] = {} contents[:nap_minimap][:test] = 'test' contents end def self.extract_save_contents(contents) nap_minimap_extract_save_contents(contents) p contents[:nap_minimap][:test] endendI have another script that also uses this method but this one works. This script is placed above the minimap script if it matters. Maybe this one is faulty as well? But this one seems to work:

Spoiler
Code:
module DataManager  class << self    alias nap_busts_make_save_contents make_save_contents    alias nap_busts_extract_save_contents extract_save_contents  end    def self.make_save_contents    contents = nap_busts_make_save_contents    contents = contents.merge(make_busts_contents)    contents  end    def self.make_busts_contents    contents = {}    contents[:nap_busts] = {}    contents[:nap_busts][:mirror]     = $game_message.bust_mirror    contents[:nap_busts][:folder]     = $game_message.bust_folder    contents[:nap_busts][:auto_reset] = $game_message.bust_mirror_reset    contents  end    def self.extract_save_contents(contents)    nap_busts_extract_save_contents(contents)    extract_busts_contents(contents)  end    def self.extract_busts_contents(contents)    $game_message.bust_mirror       = contents[:nap_busts][:mirror]    $game_message.bust_folder       = contents[:nap_busts][:folder]    $game_message.bust_mirror_reset = contents[:nap_busts][:auto_reset]  endend
You need to pass the argument of the method to the alias call too.
Ah yes that fixes the 'beep' problem. Still have the crash though. Probably because contents is created again in my code and therefor any other data previously inserted into contents is lost?

Also the make_busts_contents() is never executed anymore... I must be aliasing wrong?
You created an alias for make_save_contents, but you never used it, so the original is never called at all.
That solved it.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/saving-loading.21833/