RGSSError
DescriptionWhere is the RGSSError class used? This question seems simple but finding all the places is not easy.
PriorityLow.
PrerequisitesNone.
AssignedForeverZer0
Everything elseJust find out where it is used, we only need a list of all uses for now.
Damn, I never even thought about that. The only instances I know of off-hand are when attempting to access a disposed Bitmap, Viewport, or Sprite. It looks like I'm going to go try to throw some errors now...
The task is yours.
Well, after some extensive testing and searching google, I believe I have a complete list of what throws an RGSSError. It's is pretty much what you would expect, but here it is in summary:
An invocation of an instance method or attempted reference to a variable of Viewport, Bitmap, Sprite, Tilemap, or Window after they have been disposed.
There are couple of exceptions:
- The "disposed?" method of each of these classes will always be safe to call.
- The Sprite class will still be able to make references with the "bitmap" method, though trying to set the bitmap with "bitmap=" will still throw the error.
- The "autotiles" of the Tilemap class is still safe.
One last occurrence of RGSSError is if you initialize an instance of the Bitmap class with a width/height less than 1.
Strangely enough, Viewports and Rects can be initialized using negative values for width and height without a problem, which I personally didn't know before. I really don't see the use, but it is possible.
Anyways, unless anyone sees can think of something I overlooked, I would call this task complete.
Quote from: ForeverZer0 on March 27, 2011, 12:28:17 am
Strangely enough, Viewports and Rects can be initialized using negative values for width and height without a problem, which I personally didn't know before. I really don't see the use, but it is possible.
I didn't know that either. Well, if it is possible, then we will leave it like that.
Quote from: ForeverZer0 on March 27, 2011, 12:28:17 am
One last occurrence of RGSSError is if you initialize an instance of the Bitmap class with a width/height less than 1.
I think you can get one as well if you initialize Window with width/height less than 33.
No, you can create a window with negative values for width and height, as well (I went and tested to be sure). I believe the width and height of the window are simply used to set its viewport, which apparently doesn't care what its set to. This executed without any complaints:
window = Window_Base.new(0, 0, 4, -3)
window.contents = Bitmap.new(1, 7)
You will still get the error if you set the contents width/height values less than one, since it is a Bitmap, but it seems that it is a little more flexible than I first thought when it comes to what throws an error. The 32 pixel border is really just a convention in RGSS, I have actually deviated from it in a couple of scripts. Zer0 CMS actually uses a border of 24 pixels if I remember correctly. I personally always disliked the standard large font and large border, so when I made my own I kept it a little smaller.
One last question. Are there any specific error messages? If yes, which ones (e.g. for the bitmap with width/height less than 1)?
Just a "failed to create bitmap" message that I'm sure you've seen before for the bitmap.
Everything else just gives a generic "disposed <CLASS NAME>" message.