Trying to create a plugin to show (and erase) pictures

Hi,

Sorry if this thread is in the wrong place, but here is my problem: I'm completely new to plugin scripting, so I decided to start with something simple. I wanted to create a plugin that would show a picture and then erase it after a certain amount of time. So I created a .js file in notepad++ with the following code:

function ShowMyPicture() {
//$gameScreen.showPicture(pictureId, name, origin, x, y, scaleX, scaleY, opacity, blendMode)
$gameScreen.showPicture(1, "Test01.png", 0, 0, 0, 100, 100, 255, 0)
//$gameInterpreter.wait(frames);
$gameInterpreter.wait(100);
//$gameScreen.erasePicture(pictureId);
$gameScreen.erasePicture(1);

}
ShowMyPicture();

I activated the plugin in the plugin manager of RPG maker and created an event with the following event command:
Script: ShowMyPicture

Problem is; nothing happens, no error, nothing. Is the way I call my function in the event wrong, or is my javascript at fault?

Edit: The Test01.png file is located in the pictures folder of my project.
$gameInterpreter.wait(100); ok but is for the game Scene.
$gameScreen.erasePicture(1); will execute after

$gameInterpreter.wait(100); will not make you script at pause but the game

if you want make pause script , try with
https://www.w3schools.com/jsref/met_win_settimeout.asp

PHP:
function ShowMyPicture() {
$gameScreen.showPicture(1, "Test01.png", 0, 0, 0, 100, 100, 255, 0)
//$gameInterpreter.wait(100); // dont use this

setTimeout(function(){$gameScreen.erasePicture(1); }, 10000); // wait 10 000ms

}
$gameInterpreter.wait(100); ok but is for the game Scene.
$gameScreen.erasePicture(1); will execute after

$gameInterpreter.wait(100); will not make you script at pause but the game

if you want make pause script , try with
https://www.w3schools.com/jsref/met_win_settimeout.asp

PHP:
function ShowMyPicture() {
$gameScreen.showPicture(1, "Test01.png", 0, 0, 0, 100, 100, 255, 0)
//$gameInterpreter.wait(100); // dont use this

setTimeout(function(){$gameScreen.erasePicture(1); }, 10000); // wait 10 000ms

}
Okay, that makes sense. But even when I just use the line in my function (so no pause or erase):
$gameScreen.showPicture(1, "Test01.png", 0, 0, 0, 100, 100, 255, 0)

No picture is shown. Should the picture not stay visible on screen indefinitely (in the case)?
if you try inject the code in the debug terminal is it show ?
Ehh...debug terminal? Where do I find that? Sorry for being such a noob:-/.
its ok no worry we are all here to help you to learn.

The debug terminal can open with F8 (when the game RUN)
when you want to experiment with codes you can inject them directly into this windows.
iJjtus6Q_o.jpg


example type window in this terminal and you will have all rmmv commands.
try inject
$gameScreen.showPicture(1, "Test01.png", 0, 0, 0, 100, 100, 255, 0)
is supose to show you the picture in game or return you a error log
I activated the plugin in the plugin manager of RPG maker and created an event with the following event command:
Script: ShowMyPicture
The script inside the event command should be with parentheses like this:
Code:
Script: ShowMyPicture();
YES!!! Solved! Thank you Jonforum and Aloe Guvner! You both added to the solution.
Turned out I couldn't uses "Test01.png" as the filename, because the game would then search for a file called Test01.png.png. Debug terminal made that clear.
And script call in the event command lacked "();".

Thank you so much!

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-create-a-plugin-to-show-and-erase-pictures.91520/