Run script when menu opens up

kako05

Veteran
Veteran
Joined
Sep 11, 2017
Messages
160
Reaction score
18
First Language
Australian
Primarily Uses
RMMV
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 :)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,367
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
you'll need aplugin that modifies the menu, or need to modify the plugin that handles those cursors.
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
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.
 

kako05

Veteran
Veteran
Joined
Sep 11, 2017
Messages
160
Reaction score
18
First Language
Australian
Primarily Uses
RMMV
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.
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
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()
};
})()
 

kako05

Veteran
Veteran
Joined
Sep 11, 2017
Messages
160
Reaction score
18
First Language
Australian
Primarily Uses
RMMV
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,085
Members
137,585
Latest member
Reversinator
Top