Napoleon

Veteran
Veteran
Joined
Dec 29, 2012
Messages
869
Reaction score
97
First Language
Dutch
Primarily Uses
How to debug this one.. I put print-statement just about anywhere but still haven't found it.

error.png

I think it's one of the 400+ events on the map... but which one...
 
Last edited by a moderator:

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,308
Reaction score
1,507
First Language
English
Primarily Uses
Other
I suggest writing a script that exports the script calls of each event out to a text file. Makes searching a lot easier. Doesn't matter if the script is quick and dirty.

Recently I did the same for RMXP where I modified my event message export script. Feel free to use it for inspiration: http://pastebin.com/80d20TVK

*hugs*

 - Zeriab
 

cremnophobia

Veteran
Veteran
Joined
Dec 10, 2013
Messages
227
Reaction score
100
Primarily Uses
Debugging call scripts is a pain since XP. I'm sure there are already scripts which help with that.

But it's actually really easy to do it by yourself. You just have to rescue the exception and then print something like the event ID. Since VX Ace doesn't have a nice event list, you probably also have to add some more attributes to be able to identify the culprit (like its start position or even its name).

Code:
class Game_Interpreter  alias_method :command_355_orig, :command_355  def command_355    command_355_orig  rescue SyntaxError => e    printf "EV%03d: bad call script\n", @event_id    raise e  endend
 
Last edited by a moderator:

Napoleon

Veteran
Veteran
Joined
Dec 29, 2012
Messages
869
Reaction score
97
First Language
Dutch
Primarily Uses
That solution is just perfect! Thanks.

Some modifcations:

Code:
#sb:event_debugger [debug]#===============================================================================# Game Interpreter#===============================================================================class Game_Interpreter  #-----------------------------------------------------------------------------  # Command 355                                                          [ALIAS]  #-----------------------------------------------------------------------------  alias nap_debug_command_355 command_355  def command_355    begin      nap_debug_command_355    rescue Exception => e      p e      str = "[Command_355] 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#{e}\n"      print str      log_error(str) if defined?(log_error)      raise e    end  end  #-----------------------------------------------------------------------------  # command_111                                                          [ALIAS]  #-----------------------------------------------------------------------------  alias nap_debug_command_111 command_111  def command_111    begin      nap_debug_command_111    rescue Exception => e      p e      str = "[Command 111] 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#{e}\n"      print str      log_error(str) if defined?(log_error)      raise e    end  endend # class Game_Interpreter#===============================================================================
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,320
Reaction score
15,150
First Language
English
Primarily Uses
RMMV
Even though you've already found it, 1411 in Game_Interpreter is the

eval(script)command. So you are already reduced to the events in your current map and in common events that have a Script command.
If it happens when you interact with an event, then it's probably that event that's got the call - or a common event called by that event, or another that is activated by that event turning on a switch or something.


Whenever this happens to me, I just jump into the script and add

Code:
p script
just before the eval line. Then play with the console on, and when the game crashes, take a look at the last command in the console. That'll be your culprit :)
 

Napoleon

Veteran
Veteran
Joined
Dec 29, 2012
Messages
869
Reaction score
97
First Language
Dutch
Primarily Uses
p scriptwill work too. But I do prefer the more automated option.

I do have events that start other events and such. But indeed 95% of the time it's the event that you interact with, or some parallel/autorun event. But the other 5% can be annoying to track down sometimes without any of the solutions mentioned above, or one alike. Sometimes they are started by a script or some other condition and it can be one like 200 tiles away from the player.

Or some invisible on-player-touch-event that I totally forgot about.
 

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,308
Reaction score
1,507
First Language
English
Primarily Uses
Other
What happens if a common event or battle event crashes on a call script?
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,973
Reaction score
3,089
First Language
French
Primarily Uses
RMMV
What happens if a common event or battle event crashes on a call script?
If my guess is correct the eval method will not work proprelly and call a non-correct evaluation of the crash 
 

Napoleon

Veteran
Veteran
Joined
Dec 29, 2012
Messages
869
Reaction score
97
First Language
Dutch
Primarily Uses
It still works correctly as long as the common event was called through another event. If the common event was called through a custom script, then I don't know.
 

cremnophobia

Veteran
Veteran
Joined
Dec 10, 2013
Messages
227
Reaction score
100
Primarily Uses
Oh, I didn't think of common events, but even then it's just a matter of writing a few lines to support other event types.

if @event_id == 0 match = $data_common_events.compact.find { |ce| ce.list.equal?(@list) } if match printf "Common Event (ID: %03d) (Name: %s)\n", match.id, match.name else # Battle Event end else # Map Event endBy the way, I think I would just define Game_Interpreter#eval instead of aliasing/overwriting every relevant method:

Code:
class Game_Interpreter  def eval(string)    super  rescue Exception => e    # ...    raise e  endend
 
Last edited by a moderator:

Napoleon

Veteran
Veteran
Joined
Dec 29, 2012
Messages
869
Reaction score
97
First Language
Dutch
Primarily Uses
Battle events also end up in command_355 and command_111. So I only need to alias those 2 right?

I made some modifications to support battle-events as well. It now works with battle-events (does not specify the exact event but okay), map events, common events, common events called through script calls and script calls within a condition.

Code:
#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: [URL="http://forums.rpgmakerweb.com/index.php?/topic/31913-finding-what-script-causes-the-error-or-what-part/#"]http://forums.rpgmakerweb.com/index.php?/topic/31913-finding-what-script-causes-the-error-or-what-part/#[/URL] License: Public Domain#===============================================================================# Game Interpreter#===============================================================================class Game_Interpreter  #-----------------------------------------------------------------------------  # Command 355                                                          [ALIAS]  # For: Script Call  #-----------------------------------------------------------------------------  alias nap_debug_command_355 command_355  def command_355    begin      nap_debug_command_355    rescue Exception => e      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      nap_exception(e, __method__)    end  end  #-----------------------------------------------------------------------------  # Napoleons Exception                                                    [NEW]  #-----------------------------------------------------------------------------  def 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#===============================================================================
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,320
Reaction score
15,150
First Language
English
Primarily Uses
RMMV
A common event called from a map event via Call Common Event will have the map event's id, not 0.


Control Variables also has a Script call, as does Set Move Route.
 
Last edited by a moderator:

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,308
Reaction score
1,507
First Language
English
Primarily Uses
Other
In RPG Maker XP a common event with Trigger=None can be called in the following ways:

  • Skill in battle
  • Skill on the map
  • Item in battle
  • Item on the map
  • Battle Event
  • Common Autorun Event
  • Common Parallel Event
  • Triggered Map Event
  • Autorun Map Event
  • Parallel Map Event

I am not familiar enough with Ace to say how it is there. However, I do suggest a more methodological approach.

Which possible triggering conditions are there? What contexts do they translate to? (I.e. Skill and Item initiated common event calls may be contextual equivalent)

*hugs*

 - Zeriab
 

Napoleon

Veteran
Veteran
Joined
Dec 29, 2012
Messages
869
Reaction score
97
First Language
Dutch
Primarily Uses
New update that also supports control variables and move-routes. Note that the code is not 'clean' anymore but it works.

#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#===============================================================================
Output example:

Code:
===================================================Error Date & Time: 2014-09-11 19:53:44 +0200:Version: v1.0.0.1759===================================================[command_355] Crash in common event with ID: 3, Name: 'Crash Test'wrong number of arguments (0 for 2..3)3Crash Test===================================================Error Date & Time: 2014-09-11 19:57:34 +0200:Version: v1.0.0.1760===================================================[command_111] Crash in map_id: 39, Event 5: EV005 at location (4,3).uninitialized constant Game_Interpreter::Test===================================================Error Date & Time: 2014-09-12 15:27:48 +0200:Version: v1.0.0.1766===================================================[process_move_command] Crash in moveroute: 39.uninitialized constant Game_Character::Test===================================================Error Date & Time: 2014-09-12 15:33:17 +0200:Version: v1.0.0.1769===================================================Crash in move-route for map: 39, for event: 8, at location: (8,11)Script-line: Set Move Route Crash Test.uninitialized constant Game_Character::Test===================================================Error Date & Time: 2014-09-12 15:36:57 +0200:Version: v1.0.0.1774===================================================[command_122] Crash when setting a control-variable in map_id: 39.uninitialized constant Game_Interpreter::Test===================================================Error Date & Time: 2014-09-12 15:39:34 +0200:Version: v1.0.0.1777===================================================[command_122] Crash when setting a control-variable in map_id: 39 Params:[1, 1, 0, 4, "Control Variables Crash Test"].uninitialized constant Game_Interpreter::Test
 

Latest Threads

Latest Posts

Latest Profile Posts

Working in the IT industry:
- "How long does it take?".
- "It takes 1 month".
- "What if we add more people to the project?".
- "It would take 2 months".
Doing RPG Maker News for 16th September 2021

Stream is live! I am currently doing pixel art and will be practicing shading! Feel free to drop by!
wow, Surface Tension is really one MF of an FPS level huh
So, I got let go from my current job because my skill set didn't align with the department's goals anymore. I have some hope, because I am currently in contact with a manager from a different department, and they are desperate for more employees. We'll see what happens... :kaoswt:

Forum statistics

Threads
115,120
Messages
1,087,373
Members
149,607
Latest member
iamicon
Top