A better Game_Interpreter Line 1411 error backtracer

Screenshot_1248.jpg
​
Problem:

Game_Interpreter Line 1411 is usually a bane or our existence. It's an error that points out to Game_Interpreter line 1411, which it's on its own has nothing to do with the error. it just a line that handles the script call, and even the full backtracer usually don't print the full stack error for script call.

Solution:

I made a shared method that works as a method on its own, not script call. So the error tracing works properly. Performance-wise, it MIGHT hit a little more to the script call. So, it might best to only use this for debugging. This is the only code you need and it does not automatically solve your problem. It just to for better tracking.
Code:
class Game_Interpreter
 
  def command_355
    script = @list[@index].parameters[0] + "\n"
    while next_event_code == 655
      @index += 1
      script += @list[@index].parameters[0] + "\n"
    end
    name = "command_ex"
    eval("create_method(:#{name}) {#{script}}")
    method(name).call
  end
 
  def create_method(name, &block)
    self.class.send(:define_method, name, &block)
  end
 
end

How did I test this?

I made two slots of script
Screenshot_1250.jpg

- Game_Interpreter: is my snippet above
- Faulty: where the error happens. it basically just
Screenshot_1251.jpg

And the last, I test it with a simple script call
Screenshot_1254.jpg


Without my script, it goes like this
Screenshot_1252.jpg

With my script, it goes like this
Screenshot_1253.jpg


Terms of Service:
Why would you even bother to put ToS for debugging tools? Do whatever you want.
Yes, it means free for everything.

Original thread: https://forums.rpgmakerweb.com/threads/a-better-game_interpreter-line-1411-error-backtracer.112849/