MZ RMMZ keeps changing $ to %24

I keep trying to use this method
JavaScript:
$gamePlayer.setImage('$main-chara', 0)
and it keeps giving me errors of 'FILE NOT FOUND'.

The console says that it cannot find the `%24main-chara.png' file.

I tried using regexp with the .replace method and I also tried to replace it from '%24' to '$' with no luck either.

I am running the game locally, no custom servers or anything and this is on Windows 10.


Edit: This is a plugin, and it is not a command. Using the script command via the editor works fine. The encoding is UTF-8 and I use VS Code and not the Notepad editor that comes with Windows.
Hi there!
I tried here and it seems fine.
1636666720152.png

1636666742240.png

Did you try on a clean project, without plugins?
where exactly do you use that command?
if it is inside a plugin, then most likely the coding for the text file is wrong.

open the js file in notepad, select "save as" and check which coding option is selected (left to the save button).

The %-overrides get used when the browser can't handle a letter directly. That is why every space gets replaced with %20 on browser error messages and we tell everyone not to use spaces in filenames.
However the $ is a legal character - if it uses an override code then most likely it is stored in a text file with the wrong coding standart - and that can't happen with events, only with plugin files.
where exactly do you use that command?
if it is inside a plugin, then most likely the coding for the text file is wrong.

open the js file in notepad, select "save as" and check which coding option is selected (left to the save button).

The %-overrides get used when the browser can't handle a letter directly. That is why every space gets replaced with %20 on browser error messages and we tell everyone not to use spaces in filenames.
However the $ is a legal character - if it uses an override code then most likely it is stored in a text file with the wrong coding standart - and that can't happen with events, only with plugin files.
I don't use notepad, I use VS code. I just checked, and it's using the UTF-8 encoding which is what I always use, anyway, I did what you say and the same thing happens.

Also, I am not using spaces in my filename, which is why I added the dash ($main-chara.png) in the name of the file.

It is not a command, but a plugin that listens when a key is pressed. So basically the plugin is added via the editor, and it only does something the key is pressed.

Hi there!
I tried here and it seems fine.
View attachment 206370
View attachment 206371
Did you try on a clean project, without plugins?


It also works for me if I use the script command too. I will fix my original post to mean in a plugin, since that's what I meant.
Just found what was up. I didn't use the 'use strict' at the top.

Damn my use of TypeScript, and it's using 'use strict' by default lmao.

Thanks for all the help guys and the mods can consider this issue resolve.

Original thread: https://forums.rpgmakerweb.com/threads/rmmz-keeps-changing-to-24.142042/