Últimos temas
» Script de menupor maxi Jue 04 Dic 2014, 1:44 pm
» Ayuda intro animado!!!
por maxi Miér 03 Dic 2014, 9:41 pm
» ayuda con este engin
por maxi Miér 03 Dic 2014, 8:42 am
» Hud de Vida 100% Personalizable - Engine Sencillo! Sin Scripts :)
por davidaikago Jue 20 Nov 2014, 10:58 am
» Ultimate parallax control by:GDS [ace]
por arellano Miér 08 Oct 2014, 8:28 pm
» Script Touhou (animated) Map name (v1.4)
por davidaikago Miér 08 Oct 2014, 2:09 pm
» tutorial puerta nueva
por davidaikago Miér 08 Oct 2014, 9:08 am
» cámara de fotos
por davidaikago Miér 08 Oct 2014, 9:05 am
» Imperial Action System II Demo
por davidaikago Miér 08 Oct 2014, 8:47 am
» VE Batalla animada [ACE]
por FhierusIV Jue 18 Sep 2014, 10:57 am
» Nuevo Reglamento del Foro [Vigente desde Septiembre 2014]
por maxi Miér 17 Sep 2014, 8:37 am
» MOG|Animated Title
por Souta21 Mar 09 Sep 2014, 7:24 pm
» Tutorial Engine - Cambiar Character al Equipar Objeto
por maxi Lun 21 Jul 2014, 10:19 am
» Script de climas
por gambasoxd Sáb 19 Jul 2014, 8:58 am
» Script de contraseña(codigo) para abrir un cofre
por rpgame Jue 03 Jul 2014, 6:03 pm
¿Quién está en línea?
En total hay 1 usuario en línea: 0 Registrados, 0 Ocultos y 1 Invitado Ninguno
El record de usuarios en línea fue de 117 durante el Mar 09 Ago 2011, 3:39 pm
ScriptError Detector VX ACE
RPG maker VX :: Scripts ::
Página 1 de 1.
ScriptError Detector VX ACE
Creo que en malos tiempos es bueno ayudarse mutuamente, así que aquí os traigo un script que no soluciona, pero facilita mucho la localización de fallos de script (las ventanitas emergentes) creando un archivo de texto en la carpeta del proyecto con el nombre de Log.txt. En él encontraréis (en inglés, por supuesto las características del fallo. Cuándo, dónde y por qué, si no me equivoco.
Y, sin más preambulos...
Y, sin más preambulos...
- Código:
# --------------------------------------------------------
# ? Exception Logger [VX Ace] - v1.0
# by Krosk
# --------------------------------------------------------
#
# This script will read the backtrace of any exception
# occurring within the game, and write it back in a file
# for an easier debugging experience.
#
# Any exception triggered by a script error within a script,
# or an event will be caught.
#
# If a script error happens when reading a file
# (e.g. external script), this script can also be used
# to catch and log the exception. In this case,
# catch the exception with the following block.
# begin
# file = File.open("path/to/file.rb", r)
# ...
# rescue Exception => exception
# EXCLOG::error_handler(exception, file)
# end
#
# The default log file is Log.txt, and can be edited with
# the EXCLOG_FILE parameter.
#
# --------------------------------------------------------
module EXCLOG
EXCLOG_FILE = "Log.txt"
#--------------------------------------------------------------------------
# ? No need to edit below this line
#--------------------------------------------------------------------------
Call = ""
#--------------------------------------------------------------------------
# Auto detect script name
#--------------------------------------------------------------------------
EXCLOG_NAME = ""
$RGSS_SCRIPTS.each do |script_entry|
break unless script_entry[3].lines.each do |line|
if line[/EXCLOG_NAME/]
EXCLOG_NAME.replace(script_entry[1])
break
end
end
end
#--------------------------------------------------------------------------
# Backtrace logging
#--------------------------------------------------------------------------
def self.error_handler(exception, file_arg = nil)
source = $RGSS_SCRIPTS[exception.backtrace[0].split(':')[0][1..-2].to_i][1]
source_line = exception.backtrace[0].split(":")[1]
if file_arg != nil
file = file_arg
source = file.path
end
if source == EXCLOG_NAME # Probably an event interruption
source = "event"
end
logfile = File.open(EXCLOG_FILE, "w")
logfile.write("---------- Script error : #{source} ----------\n")
logfile.write("----- Error class\n")
logfile.write("#{exception.class}\n\n")
logfile.write("----- Message\n")
if exception.class == NoMethodError
logfile.write("- ARGS : #{exception.args.inspect}\n")
end
logfile.write(exception.message + "\n\n")
if file_arg != nil
logfile.write("----- Error location in #{file.path}\n")
logfile.write("Line #{file.lineno}\n")
logfile.write(IO.readlines(file.path)[file.lineno-1] + "\n")
elsif source == "event"
logfile.write("----- Event Script error location\n")
logfile.write(Call + "\n\n")
else
logfile.write("----- Common script error location at '#{source}'\n")
logfile.write("Line #{source_line}\n\n")
end
logfile.write("----- Backtrace\n")
for trace in exception.backtrace
location = trace.split(":")
script_id = location[0][1..-2].to_i
script_name = $RGSS_SCRIPTS[script_id][1]
logfile.write("Script : #{script_name} | Line : #{location[1]}")
if location[2] != nil
logfile.write(" | Method : #{location[2]}")
end
logfile.write("\n>\t")
logfile.write($RGSS_SCRIPTS[script_id][3].split("\n")[location[1].to_i-1])
logfile.write("\n")
end
logfile.close
raise
end
def self.register_call(arg, map_id, event_id, depth)
string = ""
if map_id == 0 # very likely to be in a battle
string << "BATTLE: #{$game_troop.troop.id}\n" if $game_party.in_battle
string << "COMMONT_EVENT (?) - " if depth > 0
string << "SCRIPT:\n#{arg}"
else # common map
event = $game_map.events[event_id]
string << "MAP:#{map_id} EVENT:#{event_id} X:#{event.x},Y:#{event.y}\n"
string << "COMMONT_EVENT (?) - " if depth > 0
string << "SCRIPT:\n#{arg}"
end
Call.replace(string)
end
end
#--------------------------------------------------------------------------
# Game_Interpreter hook, logging last script call
# If an in-game exception points here, the error
# comes from a script inside an event (map, common or battle)
#--------------------------------------------------------------------------
class Game_Interpreter
def eval(arg)
EXCLOG::register_call(arg, map_id, event_id, @depth)
Kernel::eval(arg)
end
end
#--------------------------------------------------------------------------
# Main hook
#--------------------------------------------------------------------------
alias exc_rgss_main rgss_main
def rgss_main(*args, &block)
exc_rgss_main(*args, &block)
rescue Exception => exception
EXCLOG::error_handler(exception)
end
#==========================================================================
# End of file
#==========================================================================
garret95- 500
-
28
634
713
43
Extras
Sobre mí:: Pokémon X: 5327-1353-8568 (Avisadme por MP si agregáis)
RPG maker VX :: Scripts ::
Página 1 de 1.
Permisos de este foro:
No puedes responder a temas en este foro.