Problem with "erase picture" command

● ARCHIVED · READ-ONLY
Started by Quork 17 posts View original ↗
  1. 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:

    Spoiler
    Clipboard01.jpg
    Works like a charm.

    Spoiler
    Clipboard02.jpg
    Works like a charm as well.

    Spoiler
    Clipboard03.jpg
    This however results in

    Spoiler
    Clipboard04.jpg
    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?
  2. 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.
  3. Just checked. Nope, using another image does not work either. Returns the exact same error.
  4. 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).
  5. 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?
  6. 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?
  7. Sure, here it is:

    Spoiler
    Clipboard05.jpg
    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.
  8. 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.
  9. yeah, do you by any chance have at least another event that uses those pics?
  10. 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.

    Spoiler
    Clipboard06.jpg
  11. 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.
  12. 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
  13. Thank you! I will check this out back at home. When will those bugfixes be in the steam version?
  14. Quork said:
    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.
  15. 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!
  16. 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.