Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

HBGames

Error write to file
Version: 1.0.0

Introduction

This script was made a while ago, but I finnally updated and finished it. This script will log any error from the StandardError type to a file, which I prove to be great for alpha/beta tests and bugtracking. The script will write down the dat and time, the error type and message and the scene in which the error was raised (Note: actually the name of the class in the $scene object))

Features
  • Writes (Standard)Errors to a file

Script

Code:
#==============================================================================
class StandardError < Exception
  alias :old_init :initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     arg : arguments
  #--------------------------------------------------------------------------
  def initialize(arg)
    old_init(arg)
    time = Time.now
    time = time.strftime("%a %d %b %Y, %X") 
    File.open("ErrorLog.rxdata","a+"){ |fh| fh.puts("#{time}]>[#{self.class}] || [(#{$scene.class})] || Message: #{self.message}" )}
  end
end

FAQ

Go ahead and ask me something!

Compatibility

I encountered some weird error when pressing F12 twice. If it occurs to you add this to the script:

Code:
if $error != nil
[..script..]
$error = 'aliased'
end
This will prevent any double aliasing. The bug is created when aliasing in built-in scripts.

Credits and Thanks

Thanks to myself, and GoldenShadow, because he told me this woulc ome in handy.

Author's Notes

Erm... Well, its not a that big script..

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top