Question regarding how to make something happen with a button click

Hi! I'm currently struggling to make an image disappear with the click of a button, below I've attached what I've tried to do. So far, the image just stays and doesn't disappear.
The 'C' button is also the enter button on my keyboard, so I don't think that's the problem either.
I'm new at this so any help would be appreciated, thanks so much!!
What's the activation type on the event?
What's the activation type on the event?
It's action button. There's dialogue before and after the screenshot I inserted TT
It's action button. There's dialogue before and after the screenshot I inserted TT

Instead of doing it that way, where you currently have your loop, set self switch A ON. Then make a second event page set to "autorun" with self switch A as the activation condition. There, put your conditional branch for pressing C. After the erase picture, turn self switch A OFF.
Hm, now the picture still stays but the dialogue continues over the image, then the image disappears once the dialogue is done. Am I doing this correctly?
Put the "Self switch A on" after the dialogue.
OP your first shown code was absolutly correct, you just forgot the 1 Frame Wait, else its an endless loop which causes the game to freeze, atleast in vx-ace, in mv it doesnt crash but i believe it has to do with it.

...
1frame wait
repeat above


But there is another solution for your problem, after the picture, just use eventcommand show textmessage, choose transparent box and write nothing in it, after the textbox you do the erase picture command. Thatway you need to press enter for the not visible textbox to go away, which than results in picture getting erased. But your initial code should also work.

show picture
textbox
erase picture
OP your first shown code was absolutly correct, you just forgot the 1 Frame Wait, else its an endless loop which causes the game to freeze, atleast in vx-ace, in mv it doesnt crash but i believe it has to do with it.

...
1frame wait
repeat above


But there is another solution for your problem, after the picture, just use eventcommand show textmessage, choose transparent box and write nothing in it, after the textbox you do the erase picture command. Thatway you need to press enter for the not visible textbox to go away, which than results in picture getting erased. But your initial code should also work.

show picture
textbox
erase picture

Thank you so much! Finally got it to work now.
The second solution is so simply but I totally didn't think of it hahaha ><

Original thread: https://forums.rpgmakerweb.com/threads/question-regarding-how-to-make-something-happen-with-a-button-click.123607/