Can't seem to get MZ to read string contained in a variable as a valid filename for picture?

Hi all! Thank you in advance for the help. A bit stumped, as this seems to work with MV but not MZ? Worried it may be a plug-in I'm using messing with stuff.

Here I am Showing Picture 21, hoping to store the desired filename in VariableID 26 (the other variables 2, 3, and 4 store Screen resolution and image offset info).

$gameScreen.showPicture(21, $gameVariables.value(26).toString(), 1, 0, 0 - $gameVariables.value(3), $gameVariables.value(2) - $gameVariables.value(4), 100, 100, 255, 0);


The error I'm getting is "Uncaught TypeError: Cannot read property 'length' of undefined."

I am definitely initializing Variable 26 with a valid name, and with a valid file with the right name exactly in the right spot for it to reference before this code references it. My general feeling is that MZ (or plugin interference) is refusing to accept a string as an argument for a filename, but it works in MV.

Any help is appreciated!
Have you tried your script call with hard values? I'm wondering why your second value, $gameVariables.value(26).toString(), needs to be changed to a string since it should be the name of the file itself which would already be a string? Unless your file names are all numerical (e.g. 123.png) and you're choosing by a number that you then need to convert to a string? At any rate, this is an example of a script call I use in both MV and MZ that works correctly.

Code:
$gameScreen.showPicture(1, $gameVariables.value(63), 0, 360, 50, 100, 100, 255, 0);

The other thing I noticed is that my code holds 9 values and yours has 10 values. Unless there's an optional value that I just never use, maybe you have an extra value in there?
You say you're definitely putting a valid value into variable 26, but you're clearly not or this would work. 😛 Can you show us how you're populating the variable?
Welp, not converting it to a string works! Also I have no idea how that stray value got in there >_<

I spent hours a past weekend trying to store a picture name in a variable and continually got errors, and eventually found the .toString and it worked, so I assumed I had to do it, but it seems I must've had a bug somewhere else. Thanks for the help!

Original thread: https://forums.rpgmakerweb.com/threads/cant-seem-to-get-mz-to-read-string-contained-in-a-variable-as-a-valid-filename-for-picture.145089/