MV DEX_TryJPG doesn't try jpg anymore

Github link

My memory tells me that it used to work, but now it doesn't. I guess an update came and broke it.

The plugin works by telling the engine to try to load a .jpg version of a picture if it can't find a .png version. Alternatively, it can try to load .jpg by default, and then try .png when failing to find the .jpg file.

Telling it to load .jpg by default leads to it loading .jpg files just fine.

The part that doesn't work is when it's supposed to change the file extension when encountering an error, in both instances of it.

I've added something to write stuff in the console in these parts of the code, but it doesn't work: the console shows nothing. My best guess is that MV isn't actually executing them when encountering an error. Maybe Bitmap.prototype._onError has been deprecated?
I grepped the js folder and it's in there, in rpg_core. Have you put the console check immediately at the start of the function, before any conditionals?
You're right, I must have done something wrong when checking the first time, as when I check now the message does appear. (Both when putting it before and in the conditional.) At least it falsifies my hypothesis.

However, MV still encounters a missing png file error rather than loading the jpg alternative.
At a quick glance, without comparing to the code for Bitmap stuff in the engine, it looks pretty straightforward.

To confirm, your default is to load PNG, so you put your console check at the function starting in line 48.

So put one inside the conditional. Go to the end of line 52 and paste on
Code:
console.log("triedJPG false, src is ", this._image.src);

That will tell you the code got inside of that condition and show you the altered filename it looked for.
I confirm that I put my console check on line 48.

I tried putting the log at the end of line 52. It gives me the right src, ending with .jpg and all that. I'm tempted to say that it should be working, if not for the fact that the game still displays a loading error message for failure for load the .png file.

That being said, the code snippet appears in the log after four failed attempts to reach the .png image. (And after the game displays the error message.) Maybe the root of the issue is a timing problem?

Original thread: https://forums.rpgmakerweb.com/threads/dex_tryjpg-doesnt-try-jpg-anymore.161383/