Problem with "erase picture" command

Status
Not open for further replies.

Quork

Villager
Member
Joined
Sep 10, 2014
Messages
14
Reaction score
0
First Language
German
Primarily Uses
I'm sort of at a loss here... I observed the following behaviour of the software and can't understand why this happens. To add further confusion, if I make a new event with just showing and then later on erasing an image, I can give the image any number I want, it works like a charm unlike the problem I am having. But see for yourselves:

Works like a charm.

Works like a charm as well.

This however results in

Obviously the second variant is the optimal workaround here, but I will be coming to other situations where I have to add and remove images without erasing the earlier ones. So what in the name of fluff is going on here? Did I miss something, do something wrong, is it a bug?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Could you try using a different image file for one of them? If that doesn't error, then it means the error is due to the fact that you used the same image file for both of them.
 
Last edited by a moderator:

Quork

Villager
Member
Joined
Sep 10, 2014
Messages
14
Reaction score
0
First Language
German
Primarily Uses
Just checked. Nope, using another image does not work either. Returns the exact same error.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Because disposing a picture (via erase) disposes the bitmap as well. When you show a picture, it sets the bitmap TO that object in cache, so when you dispose it, it disposes the object in cache as well. That means if two pictures share the same object and you erase one of them, the bitmap of the other picture is also erased.


If you only want one picture on the screen at a time, and it's the same one, just use multiple Show Picture statements, putting them in different places, without erasing them first (erasing a picture only to show it again at a different location is a waste of CPU and if you do it a lot it'll slow down your game).
 

Quork

Villager
Member
Joined
Sep 10, 2014
Messages
14
Reaction score
0
First Language
German
Primarily Uses
I'm not sure if I am getting you right. To clear things up: What do you call an object? Does one event equal one object? That would mean I can't show several images at the same time?
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
When you use the show picture event command, it creates a bitmap object of that image in case one doesn't exist. Now if you use erase picture, it also erases that bitmap. So if you have two pictures created using show picture that uses the same image file, they would also be using the same bitmap, now since you erased the second picture which uses the same bitmap as the first picture, you effectively deleted the bitmap used by the first picture too. So now since the first picture isn't yet erased, it still tried to fetch data from the now deleted bitmap, hence the error.


That is my first thought, which is why I asked you to try to use another image for ONE of the show pictures.

Just checked. Nope, using another image does not work either. Returns the exact same error.
So just to clarify, did you just change one of them or did you change both (so effectively, both of them still used the same image)? Coz if you changed both, then my explanation and Shaz' should explain that behavior


Now if you only changed the image for one of them and it still errors, then the error is caused by something else.


PS: Could you show us a screenshot of your event when you tested what I told you to do?
 
Last edited by a moderator:

Quork

Villager
Member
Joined
Sep 10, 2014
Messages
14
Reaction score
0
First Language
German
Primarily Uses
Sure, here it is:

As you see I used two different images. Sorry for not having written it clearly, but I had understood your suggestion correctly earlier and changed one of them, as you see in the screenshot. It shows the first image, 1.5s later it shows the second image and another 2s later it crashes (the game, not RM) with the above-shown terminal error.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I don't see anything in there that would cause a problem ... unless you have ANOTHER event somewhere that is already showing the same picture you've put in picture 2.

BTW - when you show us a screenshot, we don't need to see your whole desktop - it makes it VERY hard to read what you've got in the events.  To screenshot only the current window (the event window), use Alt+PrtScrn.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
yeah, do you by any chance have at least another event that uses those pics?
 

Quork

Villager
Member
Joined
Sep 10, 2014
Messages
14
Reaction score
0
First Language
German
Primarily Uses
Sorry for the screenshot sizes, seems I misunderstood the rule thread of the support forum.

Yes, I do use the image nr. 1 in several events; I am using it for dialogues. However there are no problems whatsoever there; before getting to this point in the game the very same image has already been loaded and erased about a dozen times without any problems. On the other hand, the problem at this specific point occurs also if I start the game directly there, so the image is unused (or does a savegame, which is what I use to get to the current work spot fast, include the cache?). Also while the image nr. 1 is the one used several times, the image nr. 2 I put in for testing after you suggested checking this is not used in the game at all before; and the error occurs at the point where image 2 is to be deleted.

EDIT

Changed image nr. 1 as well, so both images used are a) different and B) unused at any other point in the game.

 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
No, the cache is not saved with the save file.

I believe you still have image number 1 being used somewhere else.  The only reason you'd get that error after erasing is if two events were trying to display it at the same time.  If you want to, you can set that event back to use image #1 again, then zip up your project and load it up somewhere (not 4shared) so we can take a look for you.

It's one thing to change everything around just to get it working, but it's another thing entirely to figure out WHY it's doing it and actually fix the problem.  Otherwise, there's a good chance it's going to happen again.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
okay, it looks like you have an old version of the engine, without a few bug fixes that have been released.

Here are the changes you need to make to your scripts:

In Game_Interpreter, from line 913, you have this code:

 #--------------------------------------------------------------------------  # * Screen Shake  #--------------------------------------------------------------------------  def command_225    screen.start_shake(@params[0], @params[1], @params[2])    wait(@params[1]) if @params[2]  endEdit: grrrr ... majority of post cut off ... let's try this again

change the above to this:

#-------------------------------------------------------------------------- # * Screen Shake #-------------------------------------------------------------------------- def command_225 screen.start_shake(@params[0], @params[1], @params[2]) wait(@params[2]) if @params[3] endIn Game_Picture, from line 111, change this:

#-------------------------------------------------------------------------- # * Erase Picture #-------------------------------------------------------------------------- def erase @name = "" endto this:
Code:
  #--------------------------------------------------------------------------  # * Erase Picture  #--------------------------------------------------------------------------  def erase    @name = ""    @origin = 0  end
and in Game_System, from line 34, change this:

Code:
  #--------------------------------------------------------------------------  # * Determine if Japanese Mode  #--------------------------------------------------------------------------  def japanese?    $data_system.japanese  end
to this:
Code:
  #--------------------------------------------------------------------------  # * Determine if Japanese Mode  #--------------------------------------------------------------------------  def japanese?    #$data_system.japanese    return false  end
 
Last edited by a moderator:

Quork

Villager
Member
Joined
Sep 10, 2014
Messages
14
Reaction score
0
First Language
German
Primarily Uses
Thank you! I will check this out back at home. When will those bugfixes be in the steam version?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,359
Reaction score
7,672
First Language
German
Primarily Uses
RMMV
Thank you! I will check this out back at home. When will those bugfixes be in the steam version?
Most probably they are already in the steam version - the problem is that the engine is copied into a project when that project is created, and it will NOT be updated later (to prevent erasing modifications to the engine there is no autoupdate after project creation).
So any bugfix after project creation has to be applied manually like Shaz told you.
 

Quork

Villager
Member
Joined
Sep 10, 2014
Messages
14
Reaction score
0
First Language
German
Primarily Uses
Makes sense. Thank you for the explanation! I'll go and check if things do work now and if yes, I'll report this thread as solved. Salamat, thanks and dankeschön!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
If you start a new project and the changes I listed are not there, you may need to reinstall the engine (and/or the RTP). I am not sure of the process for doing this with the Steam version, but that will give you the latest and greatest version available. As Andar said though, any projects already created will not be updated, so you'll need to do it manually for those.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,018
Members
137,563
Latest member
MinyakaAeon
Top