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.

[XP] Better "Script is hanging." message

Better "Script is hanging." message

Introduction
I was attempting to remove or disable the annoying Hangup error, I failed..
But the positive is that I found a way to give a better message instead of "Script is hanging.".

Screenshots
No need.

Script
Code:
class Hangup < Exception
  def initialize(*args)
    print "Something horrible has happened!"
    exit
  end
end

Instructions
Just insert it over all other scripts. (over "Game_Temp")

Author's Notes
No credits is needed.

Credit
S.S Muu - For everything
 
45 views isn't a lot. Try and be patient when waiting for feedback.

Anyway, it's not much of a script, but it works. I think you could also go into one of the default scripts and manually replace the message there. But... gj? :straightthumb:
 
Regi":18rx7yud said:
I think you could also go into one of the default scripts and manually replace the message there.
No, you can't.
Well, this is more for scripters, or well maybe those who're trying to make online games. I just found it by accident so I thought it would be nice to share it.
Sorry if you didn't like it...
 
It's a quite useful bit of code really.

You could also add variables or anything in there. Such as, if you were to put:

print "A script is taking too long to process. Error in scene #{$scene}" then it would tell you what scene it happened in, aiding the scripter who can then try and fix it.

Also, you could add conditions. If you know it hangups a lot in say... Scene_Connect, and you know why it hangs up, you could do:

Code:
class Hangup < Exception
  def initialize(*args)
    if $scene.is_a?(Scene_Connect)
      print "Something horrible has happened! It was because of -this-"
    else
      print "Something horrible has happened!"
    end
      exit
  end
end
 
heh, at least someone likes it   :)

I guess it would be more useful if I succeed with removing it like I was trying to, well I guess we have to satisfy with this way instead.
Code:
begin
  # Code here
rescue Hangup
end
 
"Something horrible has happened!"
That's awesome, not useful at all, but awesome!

I knew about the rescue Hangup thing, now this is something that can be useful depending on what you're trying to do.
 
This script is a complete waste of time. But I'm sure someone will eventually find it useful in some form or fashion :\.

FOR VX:
Go to "Main" and edit the words...
 
You may want to try the same way Zeriab did in his 'F12 removal script'. Basically, alias Graphics.update and add
Code:
rescue Hangup
>_>
 

Zeriab

Sponsor

It will not work since the exception can be thrown every and not just in the Graphic.update method.
This is also the reason why my F12 removal script only works for RMXP and not for RMVX where the Reset exception can be thrown pretty much anywhere just like the Hangup exception.

Here is an ugly hack I have been playing around with:
Code:
class Hangup < Exception
  def initialize(*args)
    return if args[-1] == true
    begin
      raise Hangup.new(*(args << true))
    rescue Hangup => err
      print "Too much time has passed since last Graphic.update call\n" + "-"*69 + "\n" +
        err.class.to_s + ": " + err.message + "\n\n" + 
        err.backtrace.join("\n")
    end
    exit
  end
end

It is definitely not something that should be present in the release version.

*hugs*
- Zeriab
 

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