if "object?" exists condition

Hey guys,

Is it possible for a conditional branch to only execute its contents if a specific object, variable, or whatever exists? like:
Code:
◆Script:$gameScreen.showPicture(99, "Untitled", 0, $gameMap.event(this._eventId).x*48, $gameMap.event(this._eventId).y*48, 100, 100, 255, 0)
◆If:Script:pseudo if $gameScreen.picture(98) exists
  ◆Play SE:Bell3 (90, 100, 0)
  ◆Script:console.log($gameScreen.picture(98)._x);
  ◆
:End
or
Code:
◆Script:testVar = 1
◆If:Script:pseudo if testVar exists
  ◆Play SE:Bell3 (90, 100, 0)
  ◆Script:console.log(testVar);
  ◆
:End
And if it is possible, what would that script be?
You can find yourself 😛
Step 1: Show picture 1 (via classic event command)
Step 2: Once the picture is shown, open dev console (while playtesting, press F8).
Step 3: Type in $gameScreen.picture(1) and hit enter
Step 4: Type in $gameScreen.picture(2) and hit enter
Step 5: Compare these two pictures
Step 6: Based on their differences you should be able to build the if, because the empty picture is missing something important.
@Poryg ''$gameScreen.picture(98) !== undefined'' It works! and i learned that you can check the values inside the dev console, which i can see become really useful in the future. Thanks for the tutoring bro.😀
@Poryg Oh actually, this option doesnt seem to work when I use it for a variable
Code:
◆Script:testVar = 1
◆If:Script:pseudo if testVar exists
  ◆Play SE:Bell3 (90, 100, 0)
  ◆Script:console.log(testVar);
  ◆
:End
And still get an error about "testVar is not defined", is it also possible to use this: ''$gameScreen.picture(98) !== undefined'' - but for undefined variables? I tried checking it on the console log too, but it actually gives an error, instead of it just being undefined like with unexistant pictures
if (typeof testVar !== "undefined")

Original thread: https://forums.rpgmakerweb.com/threads/if-object-exists-condition.94409/