MZ Hover Picture plugin need help

This here is the code for a plugin I'm trying to make to allow a common event, Variable Id and a variable value to run when a mouse is hovering over a picture. It's similar to the ButtonPicture.js plugin that came with RPG Maker MZ. When I run the code I don't get any errors but it doesn't seem to be working either and I was hoping I could get some help as I am new to coding and making plugins for RPG Maker MZ. I will also make this plugin available for FREE after it is done and working.

(() => {
const pluginName = "HoverPicture";

PluginManager.registerCommand(pluginName, "set", args => {
const pictureId = Number(args.pictureId);
const commonEventId = Number(args.commonEventId);
const variableId = Number(args.VariableId);
const variableValue = args.VariableValue;
const picture = $gameScreen.picture(pictureId);
if (picture) {
picture.mzkp_commonEventId = commonEventId;
picture.mzkp_variableId = variableId;
picture.mzkp_variableValue = variableValue;}
});

Sprite_Picture.prototype.isHoveredEnabled = function() {
const picture = this.picture();
return picture && picture.mzkp_commonEventId && picture.mzkp_variableId && picture.mzkp_variableValue && !$gameMessage.isBusy();
};

Sprite_Picture.prototype.onHover = function() {
const picture = this.picture();
if (picture && picture.mzkp_commonEventId && picture.mzkp_variableId && picture.mzkp_variableValue) {
$gameTemp.reserveCommonEvent(picture.mzkp_commonEventId);
$gameVariables.setValue(picture.mzkp_variableId, picture.mzkp_variableValue);
}
};



Spriteset_Base.prototype.mzkp_isAnyPictureHovered = function() {
return this._pictureContainer.children.some(sprite =>
sprite.isHovered()
);
};

const _Scene_Map_isAnyButtonHovered =
Scene_Map.prototype._Scene_Map_isAnyButtonHovered;
Scene_Map.prototype._Scene_Map_isAnyButtonHovered = function() {
return (
_Scene_Map_isAnyButtonHovered.apply(this, arguments) ||
this._spriteset.mzkp_isAnyPictureHovered()
);
};
})();

Thank you for your time and thanks in advance for any help.
Here's an extraction of my own Plugin, which is still not released officially, but I think I can share a snippet from it.

It may not be completed but it should help you a little bit:

Code:
(function() {

const isBusy = _ => $gameMessage.isBusy();

const alias_SpritePicture_update = Sprite_Picture.prototype.update;
Sprite_Picture.prototype.update = function() {
    alias_SpritePicture_update.call(this);
    const picture = this.picture();
    if (picture) {
        picture._hovered = this.isBeingTouched();
    }
}

Game_Picture.prototype.isBeingTouched = function() {
    return !!this._hovered;
}

const alias_GamePicture_update = Game_Picture.prototype.update;
Game_Picture.prototype.update = function() {
    alias_GamePicture_update.call(this);
    const isBeingTouched = this.isBeingTouched();
    if (!isBusy() && isBeingTouched && !this._hoveredFlag && this.onMouseEnter) {
        this.onMouseEnter.call(this);
    }
    if (!isBusy() && !isBeingTouched && this._hoveredFlag && this.onMouseLeave) {
        this.onMouseLeave.call(this);
    }
    this._hoveredFlag = isBeingTouched;
}

})();

Now, you can query if a picture with id 12 is hovered or not:

Code:
const picture = $gameScreen.picture(12);
const b = picture && picture.isBeingTouched();
// b either true or false depending it's hovered


You can also add listeners like this:
Code:
$gameScreen.picture(1).onMouseEnter = () => console.log("Hello There")
$gameScreen.picture(1).onMouseLeave = () => console.log("Bye bye")

Mind that listeners are not persistent when loading a save game.
If the plugin doesn't have any effect, are you sure it's loading? Press F8 during play test to open the dev tools window, and check the Console tab there for any error messages (red text). If a plugin has a syntax error, it will fail to load and therefore have no effect on gameplay.

By default Sprite_Picture does not have onHover or isHovered methods. And Scene_Map doesn't have an isAnyButtonHovered method. So those won't exist or be called unless you have extra code that does so. Did you write this yourself?

MZ makes this stuff relatively easy because Sprite_Picture inherits from Sprite_Clickable. You can just patch the sprite's onMouseEnter/onMouseLeave methods to implement a hover effect.

In case it helps, my Cae_PictureTouch plugin is free and has hover features:
The big difference between my plugin and ButtonPicture is that mine allows pictures to be triggered while the main interpreter (i.e. a non-Parallel event) is busy.
If the plugin doesn't have any effect, are you sure it's loading? Press F8 during play test to open the dev tools window, and check the Console tab there for any error messages (red text). If a plugin has a syntax error, it will fail to load and therefore have no effect on gameplay.

By default Sprite_Picture does not have onHover or isHovered methods. And Scene_Map doesn't have an isAnyButtonHovered method. So those won't exist or be called unless you have extra code that does so. Did you write this yourself?

MZ makes this stuff relatively easy because Sprite_Picture inherits from Sprite_Clickable. You can just patch the sprite's onMouseEnter/onMouseLeave methods to implement a hover effect.

In case it helps, my Cae_PictureTouch plugin is free and has hover features:
The big difference between my plugin and ButtonPicture is that mine allows pictures to be triggered while the main interpreter (i.e. a non-Parallel event) is busy.
Your plugin does work I downloaded it and tested it and it does what I want but the problem is that I can't use both your plugin and the ButtonPicture plugin, the version I'm using of the ButtonPicture plugin is the latest one that allows you to also assign a variable Id and Variable value to the button and I've taken advantage of the variable id and value quite a bit.
the version I'm using of the ButtonPicture plugin is the latest one that allows you to also assign a variable Id and Variable value to the button
I guess you mean this community edit of ButtonPicture?
It's not quite as convenient, but Cae_PictureTouch v1.6 has a Picture ID Variable plugin parameter. When a picture's common event bind starts, that variable (if any) gets set equal to the picture's ID.

VisuStella also have a plugin (paid), but it looks like it only offers highlight on hover?
Might be suitable, depending on what you're trying to do.

Original thread: https://forums.rpgmakerweb.com/threads/hover-picture-plugin-need-help.157528/