RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
VXA picture script bug?

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 77
RMRK Junior
Whenever I delete a picture with a center origin, I get an error on this line:

Quote
      self.ox = bitmap.width / 2


It's a bug in the script itself, I tried in a vanilla project.

EDIT: I think I know what's probably causing it; it doesn't actually clear the image from memory, it just replaces it with a blank 0x0 bitmap and applies the settings, so it ends up trying to divide a null. This also explains the issue with lag.
« Last Edit: April 22, 2013, 12:12:45 PM by Wiimeiser »

*
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Rep:
Level 96
&&&&&&&&&&&&&&&&&&&&&&&&&&&
GIAW 14: 2nd Place (Hard Mode)2013 Zero to Hero2013 Biggest Drama WhoreParticipant - GIAW 11Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.
Which script? It's kinda hard to help if we don't know what script you're talking about.
&&&&&&&&&&&&&&&&

*
Rep:
Level 82
Vanilla project means that no custom scripts are being used, so it's definitely a default script, and probably Sprite_Picture.

That is best guess, however.

Whenever I delete a picture with a center origin, I get an error on this line:

Quote
      self.ox = bitmap.width / 2


It's a bug in the script itself, I tried in a vanilla project.

EDIT: I think I know what's probably causing it; it doesn't actually clear the image from memory, it just replaces it with a blank 0x0 bitmap and applies the settings, so it ends up trying to divide a null. This also explains the issue with lag.

But it's not a divide by 0, it's divide by 2, so a bitmap of width 0 would result in self.ox = 0 /2 = 0.

It would do good to know:

What the error type is, and what it is you are doing to delete a picture. Are you talking about through an event command (Erase Picture, for example) or through code (either a script or the Script Command)? Knowing that might help work it out. I'm unable to cause an error, but seeing as I know nothing about how to cause it it's hard to know if I am doing the same thing.

You could send the project you have that has the error.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

***
Rep:
Level 77
RMRK Junior
It's a bug in a default script, what it seems to be trying to do is halve a number that doesn't exist when it erases a picture that isn't at source 0 or is centered, as far as I can tell. So what it's doing is carrying over settings for a picture that doesn't exist and AFAIK it tries to divide nothing (not even zero?) in half

*
Rep:
Level 82
I can't recreate the bug/error without some exact information or just a copy of the project folder that has the bug in place.

If the bitmap variable is nil, you should get an "undefined method 'width' for nil:NilClass" error.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Hmm, judging by what you've said and looking at Sprite_Picture and assuming that the error is a NilError, I could see it occurring in two situations:

(1) You show a picture through an event command with Centre origin, but don't set any actual graphic to be shown. That would cause the error since origin would be 1 but the picture name would be empty. In that case, the error would occur immediately upon trying to show the picture, not at the time it is erased.

(2) You use a script call to clear the name of a picture without changing the origin to 0.

If you are using the default erase method for Game_Picture, then there shouldn't be an occasion where the picture name is empty but the origin is 1. Both are deleted in the same method, so I can't see why this error would occur when you erase the picture through an event command.

So I guess I have this question:

(1) Is it possible that you are not setting a graphic when you use the Show Picture command?

And I also have Logan's questions too:

(2) Are you using events or scripts to call and erase the picture?
(3) What does the error message say?
(4) Will you upload a demo with the error?
« Last Edit: April 23, 2013, 01:41:28 AM by modern algebra »

***
Rep:
Level 77
RMRK Junior
It happens when I erase a picture, check the event in the project. Sorry for the unusual choice of picture, since there's nothing in the Pictures folder by default I just grabbed the first thing I could(Yes, that's actually in my main project's Pictures folder for no given reason)

*
Rep:
Level 82
It's actually a bug/problem with your version of the scripts data and not VXA in general.

In my version of Game_Picture, I have the following code:

Code: [Select]
  def erase
    @name = ""
    @origin = 0
  end

In your version, that same method:

Code: [Select]
  def erase
    @name = ""
  end

For whatever reason, you are missing a line there.

What this means is that the @origin variable is not set to 0 when a picture is erased. This causes this code to pass incorrectly:

Code: [Select]
  def update_origin
    if @picture.origin == 0
      self.ox = 0
      self.oy = 0
    else
      self.ox = bitmap.width / 2
      self.oy = bitmap.height / 2
    end
  end

The "if" check fails, which leads to the "else" case being processed. Then, it tries to call width on the bitmap object, but because it is a nil value, it is unable to call the method and you get the NoMethodError that you are seeing.

What you need to do then, is open up the Game_Picture script, go to line 116 and add in the missing line:

Code: [Select]
@origin = 0

and your issue will be fixed.

I'm not sure why your version of the script data is incorrect but it will cause that bug to be present in any new project that you create.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

***
Rep:
Level 77
RMRK Junior
Thanks, I think it's broken because I got the Preorder version...