MZ Help with variable use in a script call

Hi folks,

I'm using a script call in a movement route to change the image of the event. The script sets the file to change it to based on the ID of the event running the script and a variable for the folder name. I'm having trouble getting it to work when a variable is used for part of the file path, but everything else works fine.

The name of the folder for my test event is "chamber1".

The script is this:
JavaScript:
this.setImage(`{$gameVariables.value(1033)}/!${this.eventId()}`, 1)

The problem is just with the folder name using the variables. If I instead do this:
JavaScript:
this.setImage(`chamber1/!${this.eventId()}`, 1
)

... then it works fine and sets the file "chamber1/!$10" as the event ID is 10 and the folder "chamber1" has a file named "!$10.png". So, "this.eventId()" works just fine in this script call, but the "gameVariables.value(1033)" seems to not work at all.

I've run a show text command before doing this to make sure that the variable is in fact set to the string "chamber1", and something similar to this is working in other plugin commands that I have set up (but using \v[1033] for those since they are using text). I've tried using {\v[1033]} and \v[1033] similarly here, but they also don't work.

Any help is much appreciated!
did you try this?
Code:
this.setImage(`${$gameVariables.value(1033)}/!${this.eventId()}`, 1)
you do need a $ every time you interpolate a value inside the string
did you try this?
Code:
this.setImage(`${$gameVariables.value(1033)}/!${this.eventId()}`, 1)
you do need a $ every time you interpolate a value inside the string
Well, I feel silly now. Of course it would be something that simple, haha.

I was thinking of the $ in the other value as being part of the filename, since !$ is a thing, without realizing my filenames only use ! and the $ was part of the interpolation.

Thanks for the help! It is working just fine now.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-variable-use-in-a-script-call.180765/