Can't erase a picture

I'm making a picture based inventory and there is a collectible in my game called "golden coin" that we can either find or not, which influences the ending. I added a meter next to the coin's icon to show the player how many coins they've found so far (the menu, the icon and the meter are stored in different files). I made so all the pictures that the inventory consists of are erased when it's turned off or when one of the items is used. And all seems to be working perfectly fine, except for the meter image that doesn't disappear immidiately when an item is used, but when the cutsce that using the item iniciated ends.
Zrzut ekranu (243).png
Zrzut ekranu (244).png


As you can see the "x1" one is still displayed even tough the rest of the menu is gone.
The meter is marked as "71" and there is a command to erase picture 71 BEFORE the cutscene so why in the world it's erased only after the cutscene is finished.
Zrzut ekranu (245).png
Zrzut ekranu (246).png
Zrzut ekranu (247).png
you use 2x erase picture 89, but also, if item == 0, doesn't show
any image, so make it there, erase image 79 if it's 0.

I dont know how how the images looks either or how you draw the number.
you use 2x erase picture 89, but also, if item == 0, doesn't show
any image, so make it there, erase image 79 if it's 0.

I dont know how how the images looks either or how you draw the number.
I tried to delete the one of the doubled "erase picture 89" and set "erase picture 71" when "if: Golden coins = 0" as you said but nothing changed at all.
!coin1.png
!x2.png

Here it what these numbers look like. They are simple pngs displayed as pictures.
another work around if erase picture 71 dont work when value = 0,
make a empty picture 1x1 px and show picture like that.

as it doesn't have a value or a coin to show.
otherwise, do you have a mini demo so I could check it out?
another work around if erase picture 71 dont work when value = 0,
make a empty picture 1x1 px and show picture like that.

as it doesn't have a value or a coin to show.
otherwise, do you have a mini demo so I could check it out?
Ok I'm not sure how the dm system works on this forum but I hope my message reached you.
I included a link to download my game's demo there.
From the naming of your images, it looks like you don't actually draw "x1" in the snippet shown - when there's only one coin, you instead "just" draw the coin with no number.

My guess would be that you draw it somewhere else, and that's why it isn't removed. Maybe when you tested something out, you forgot to remove it?

But it is indeed a bit hard without the full overview of your game.
From the naming of your images, it looks like you don't actually draw "x1" in the snippet shown - when there's only one coin, you instead "just" draw the coin with no number.

My guess would be that you draw it somewhere else, and that's why it isn't removed. Maybe when you tested something out, you forgot to remove it?

But it is indeed a bit hard without the full overview of your game.
Hey I sent you a link to download a copy of my project.
Regarding your suggestion, I don't know what you mean by "snippet shown".
And no, where there is only one coin, in the event you can see in the picture there is the number shown. !coin1 is a picture of the number "x1", the icon of the coin is stored in a different file, which is activated by a different event that I didn't show, because it works fine. My problem is not about the icons but about the meters.
Moving the "Golden Coin" common event to after switching the inventory off makes it go away before showing the message.

FYI, I could also remove all of the "Erase Picture" events and have the menu still be removed so the end result became this:

Screenshot 2022-08-03 224956.png


Not sure if this is intentional (I found out because I deleted some of them to test the behavior, as I suspected it being triggered elsewhere - which seems to be in another event controlled by the 420 switch).

Let me know if that solution works for you - otherwise I'll take another look tomorrow morning 🙂 Getting late here.
Moving the "Golden Coin" common event to after switching the inventory off makes it go away before showing the message.

FYI, I could also remove all of the "Erase Picture" events and have the menu still be removed so the end result became this:

View attachment 236569

Not sure if this is intentional (I found out because I deleted some of them to test the behavior, as I suspected it being triggered elsewhere - which seems to be in another event controlled by the 420 switch).

Let me know if that solution works for you - otherwise I'll take another look tomorrow morning 🙂 Getting late here.
You tested this for yourself and it works?
It works, and after a moment of thinking, I also know what the problem likely is 🙂

While the menu switch is on, it will be drawing things continuously - that's why removing those parts didn't do anything, they were on until the menu switch was turned off.

However, the meters are created somewhere else and is thus not deleted in the same instance as the rest of the menu, which causes this weird behavior.

Hope that makes a little sense 🙂

What I showed there works so that, when you click the coin, it closes everything, then displays the message.

I also noticed a bug where the counter didn't go down properly when using a coin to zero then adding a new one - I think this solves that as well.
It works, and after a moment of thinking, I also know what the problem likely is 🙂

While the menu switch is on, it will be drawing things continuously - that's why removing those parts didn't do anything, they were on until the menu switch was turned off.

However, the meters are created somewhere else and is thus not deleted in the same instance as the rest of the menu, which causes this weird behavior.

Hope that makes a little sense 🙂

What I showed there works so that, when you click the coin, it closes everything, then displays the message.

I also noticed a bug where the counter didn't go down properly when using a coin to zero then adding a new one - I think this solves that as well.
1659562791473.png

Hey I did as you said. I put the dialogue after the switches are turned off and instead of calling a common event I made this dialogue directly inside of this map event but most importantly I turned this event from "parallel" to "autorun" and now everything seems to be working perfectly fine. I hope nothing will break all of the sudden in the future but for now thank you for your help @Ekima and @ShadowDragon
I still recommend to make it more organized, as @Ekima said, some things
are controlled elsewhere, but if you re-origanize things, the menu above
can be far shorter, smoother, and more oversight what triggers where.

a sidenote is to comments to do what they do and what triggers where.
so you can find it back faster.

but good luck on your project (and dont make the icons of your inventory
the same size of your resolution as this can cause issues later on as it
stacks the images layer by layer).

also resulting in unwanted size on your project.

but good luck further 🙂
Happy to hear you got things to work! 🙂

Another way you could optimize things for your own sanity is to limit code duplication. If you have some code that's the exact same that you call in multiple places, you can extract that into a Common Event and call that instead.

For instance, you could move the events for closing down menu/inventory and ending your cut scene into a Common Event and call it "Close Inventory", then call it for each of the positions - and then add any differences after triggering it. That way, when you want to change behavior, you only have to do it in one place and you're less likely to accidentally add bugs.

That, along with comments as @ShadowDragon mentioned, are real quality of life habits and will make it a lot easier to manage things down the line.

In any case - best of luck with your game making! 😀
Thank you both a lot for these tips :3

Original thread: https://forums.rpgmakerweb.com/threads/cant-erase-a-picture.150059/