Run script when menu opens up

There are multiple selectable characters in my game, which changes the mouse icon when you hover over them. The problem is when a player presses "esc","x","right mouse button" to open the menu, the mouse icon is still the same (changed). I use a plugin command "ResetCustomCursor", but I'm yet to find a solution to the menu opening problem.
Please help 🙂
you'll need aplugin that modifies the menu, or need to modify the plugin that handles those cursors.
Alias Scene Menu start inside your own little plugin and run your code:
Code:
(function(){
var _your_new_alias = Scene_Menu.prototype.start
Scene_Menu.prototype.start = function() {
    _your_new_alias.call(this);
//your code here
};
})()

Or declare this in an event script call at game start, both will work, but a plugin will be easier to trace and maintain.
Alias Scene Menu start inside your own little plugin and run your code:
Code:
(function(){
var _your_new_alias = Scene_Menu.prototype.start
Scene_Menu.prototype.start = function() {
    _your_new_alias.call(this);
//your code here
};
})()

Or declare this in an event script call at game start, both will work, but a plugin will be easier to trace and maintain.

Thanks, but I get an error with this script. I know I'm doing something wrong. Would it be hard to adjust the plugin I'm using with yours?



It should be only one line
"
$._resetCustomCursor = function() {
this._setCustomCursor(this.defaultCursorImage);
}
"
But as js total newbie as me, can't get it right.
You're having a context error most likely.
The $._resetCustomCursor function is defined within the TDDP_MouseSystemEx object, not the $ object, you can see this because "$" is inside the beginning IIFE and "TDDP_MouseSystemEx" is inside the () at the end of the plugin.

Try this:
Code:
(function(){
var _your_new_alias = Scene_Menu.prototype.start
Scene_Menu.prototype.start = function() {
   _your_new_alias.call(this);
   TDDP_MouseSystemEx._resetCustomCursor()
};
})()
You're having a context error most likely.
The $._resetCustomCursor function is defined within the TDDP_MouseSystemEx object, not the $ object, you can see this because "$" is inside the beginning IIFE and "TDDP_MouseSystemEx" is inside the () at the end of the plugin.

Try this:
Code:
(function(){
var _your_new_alias = Scene_Menu.prototype.start
Scene_Menu.prototype.start = function() {
   _your_new_alias.call(this);
   TDDP_MouseSystemEx._resetCustomCursor()
};
})()

Wooow! Thanks. This was bugging me a lot 🙂 Really appreciate! Works great.

Original thread: https://forums.rpgmakerweb.com/threads/run-script-when-menu-opens-up.108382/