#sb:event_debugger [debug]# Author: Napoleon# About: - Shows you more information about the crash inside an event when using a script-call.# - Plug and play.# Thanks to:
http://forums.rpgmakerweb.com/index.php?/topic/31913-finding-what-script-causes-the-error-or-what-part/# License: Public Domain or CC0 (
http://creativecommons.org/publicdomain/zero/1.0/)#===============================================================================# Game_Character#===============================================================================class Game_Character < Game_CharacterBase #----------------------------------------------------------------------------- # Process Move Command [ALIAS] # For: Set Move Route #----------------------------------------------------------------------------- alias nap_debug_process_move_command process_move_command def process_move_command(command) begin nap_debug_process_move_command(command) rescue Exception => exception str = "Crash in move-route script-call for map: #{$game_map.map_id}, for event: #{@id}, at location: (#{@x},#{@y})\nScript-line: #{command.parameters[0]}.\n#{exception}\n" print str log_error(str) if defined?(log_error) raise exception end endend#===============================================================================# Game Interpreter#===============================================================================class Game_Interpreter #----------------------------------------------------------------------------- # Command 122 [ALIAS] # For: Control Variables #----------------------------------------------------------------------------- alias nap_debug_command_122 command_122 def command_122 begin nap_debug_command_122 rescue Exception => exception str = "[#{__method__}] Crash when setting a control-variable in map_id: #{$game_map.map_id} Params:\n#{@params}.\n#{exception}\n" print str log_error(str) if defined?(log_error) raise exception end end #----------------------------------------------------------------------------- # Command 355 [ALIAS] # For: Script Call #----------------------------------------------------------------------------- alias nap_debug_command_355 command_355 def command_355 begin nap_debug_command_355 rescue Exception => e Game_Interpreter.nap_exception(e, __method__) end end #----------------------------------------------------------------------------- # Command 111 [ALIAS] # For: Conditional #----------------------------------------------------------------------------- alias nap_debug_command_111 command_111 def command_111 begin nap_debug_command_111 rescue Exception => e Game_Interpreter.nap_exception(e, __method__) end end #----------------------------------------------------------------------------- # Napoleons Exception [NEW] #----------------------------------------------------------------------------- def self.nap_exception(exception, method) if $game_party.in_battle str = "[#{method}] crash in battle-event: #{exception}\n" elsif @event_id == 0 match = $data_common_events.compact.find { |ce| ce.list.equal?(@list) } if match str = "[#{method}] Crash in common event with ID: #{match.id}, Name: '#{match.name}'\n#{exception}\n", match.id, match.name else str "[#{method}] Crash occurred in unknown entity. @event_id:#{@event_id}.\n#{exception}\n" end else str = "[#{method}] Crash in map_id: #{$game_map.map_id}, Event #{@event_id}: #{$game_map.events[@event_id].name} at location (#{$game_map.events[@event_id].x},#{$game_map.events[@event_id].y}).\n#{exception}\n" end print str log_error(str) if defined?(log_error) raise exception endend#===============================================================================