alias origin_exit exit unless method_defined? :exit
def exit(*args)
case $scene
when Scene_Map
AutoSave.common_save unless $game_map.interpreter.running?
when Scene_Battle
AutoSave.common_save unless $game_battle.interpreter.running?
else
if $scene.type != NilClass and $scene.type != Scene_Title
AutoSave.common_save
end
end
origin_exit(*args)
end
end
module AutoSave
if @scene_proc.nil?
@last_scene = nil.class
@scene_proc = proc do |value|
if value.nil? or value.is_a?(Scene_Title)
if @last_scene != NilClass and @last_scene != Scene_Title
AutoSave.common_save
end
end
@last_scene = value.type
end
trace_var(:$scene,@scene_proc)
end