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.

[RMXP] Suppress errors

I have a game which, some of the time, *will* error, due to a network connection.

I have added to main this:

begin
# blah blah main script
rescue Exception => e
$scene = Scene_Error.new(e.message)
end



I want, instead of showing an alert as usual saying there has been an error, to send the player to a scene which shows a nicely printed message. I've called this Scene_Error.

The problem is that while this successfully stops the error message, the game closes after the error anyway. I think RMXP is merely programmed to do this (print error then close).

Can I suppress this close so that I can display my scene?

Nothing will be shown in this scene other than a window with some text in (from e.message).

Here is my scene if it's needed:

Ruby:
class Scene_Error

  def initialize(message)

    @message = message

  end

  

  def main

    @help_window = Window_Help.new

    @help_window.set_text(@message)

    @help_window.y = 288

    

    Graphics.transition

    loop do

      Graphics.update

      @help_window.update

      if $scene != self

        break

      end

    end

    

    Graphics.freeze

    @help_window.dispose

  end

end
 

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