Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Bigace360

Failed to create Bitmap

Recommended Posts

Can someone tell me how to fix this error and why I get it? While trying to work on compatibility with My custom menu script and scene status/end scripts, I seem to run into this error for some reason:

Script 'ACE Menu System v1.10' line 362: RGSSError occured.

 

failed to create bitmap

 

I'll keep on looking into, but this is annoying as I should starting something else but have deal something as stupid as this.

Share this post


Link to post
Share on other sites

We'd need a link to said script, however it is likely that you're accidentally trying to create a new Bitmap object with null/negative width or height as parameters. Double-check your parameters' values right before the Bitmap.new statement.

Share this post


Link to post
Share on other sites

We'll here's the link to the scripts without going to the blog:

ACE Menu System [RMXP]

ACE Status system

ACE Option System

Thing is that it looks just the Equipment system, but the scene_equip works. which is very strange.

Share this post


Link to post
Share on other sites

Place this anywhere in the editor and run the game. It will show you where the error is coming from.

 

 

class Bitmap

 alias find_error_init initialize
 def initialize(*args)
begin
  find_error_init(*args)
rescue
  error = ([$!.to_s, ''] + $@).join("\n")
  print error
end
 end
end

 

 

EDIT:

Wait, I just noticed that RGSSErrors still report where last stacktrace, so this isn't really needed.

What exactly is the problem? Can't you just look at the line and see what's going wrong with it? I imagine that the dimensions are being set via a variable, and not a hard-coded value. The value is likely equal to 0, which is going to cause your error. This most commonly happens when people use the String#text_size method to create dynamic bitmaps and forget to check if the string is empty first. Empty strings return a size with 0 dimensions, which Bitmaps don't like.

 

That would be far easier than others mindlessly looking through scripts. At the very least you could let us know the bitmap that is causing the problems.

Share this post


Link to post
Share on other sites

I've looked at the line and the one for status system looks identical to equipment system, but for some reason only the equipment system works. Wierd right, anyways when I put in status system I get an error that sends me to line 362 in the Menu System:

 

self.contents = Bitmap.new(width - 32, @item_max * 32)

Which is in a new class called Window_Command_Base < Window_Selectable

 

and when I add Option system, it gives me an error on line 534

self.contents = Bitmap.new(width - 32, height - 32)

Whis is in the Window class, new method: update_font.

 

But you are right something is equaled to zero, but it seems only after I add one of these that it does that.

Share this post


Link to post
Share on other sites

@item_max obviously equals 0.

 

Anything multiplied by 0 is 0, so @item * 32 for the height is 0, and there is your error.

Share this post


Link to post
Share on other sites

ForeverZer0's right. Also (this is just an hypothesis since I didn't take time to look at your scripts) it is possible that you try to make the contents bitmap before setting the window's position and size (using super in the initialize method), thus both width and height would still be zero at that time.

Share this post


Link to post
Share on other sites

@item_max obviously equals 0.

 

Anything multiplied by 0 is 0, so @item * 32 for the height is 0, and there is your error.

 

There's nothing in my script that makes item_max = 0, as I've said it's almost the same as my scene_equip script. It's just weird that it's appearing in one script but not the other.

ForeverZer0's right. Also (this is just an hypothesis since I didn't take time to look at your scripts) it is possible that you try to make the contents bitmap before setting the window's position and size (using super in the initialize method), thus both width and height would still be zero at that time.

 

nope, I write the contents bitmap after not before.

Edited by bigace

Share this post


Link to post
Share on other sites

Have you actually checked the value of @item_max right before the error is thrown?

I am going to take a wild guess and say "no"

 

The only other possibility is if you are creating the window with dimensions less 32 or less in either direction. There is literally no other possibility.

Share this post


Link to post
Share on other sites

I don't see it and I'm about to throw this computer out of the window, as I've practically wasted a day on this. I think I need to rewrite as there's clearly something I did wrong with the code as i've said twice it's identically to the other one that works so there should no reason it's not working. I'll work on it some more in the future, whenever that is. Just too fucking fustrated with this.

Share this post


Link to post
Share on other sites

You have this line:

 

self.contents = Bitmap.new(width - 32, @item_max * 32)

 

Make it look like this, and see what it says:

 

p width > 32 ? 'width is good, no problem' : 'width is the problem'
p @item_max > 0 '@item_max is good, no problem' : 'Uh, oh, @item_max is 0'
self.contents = Bitmap.new(width - 32, @item_max * 32)

 

This is something minor to fix, you are just getting frustrated and not seeing the problem clearly.

Share this post


Link to post
Share on other sites

You forgot a question mark. The corrected version is:

 

p width > 32 ? 'width is good, no problem' : 'width is the problem'
p @item_max > 0 ? '@item_max is good, no problem' : 'Uh, oh, @item_max is 0'
self.contents = Bitmap.new(width - 32, @item_max * 32)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...