CarpenterScr

Veteran
Veteran
Joined
Nov 2, 2020
Messages
66
Reaction score
6
First Language
english
Primarily Uses
RMMV
I'd like to disable these 2 commands (taken from SRPG) if a certain switch is on.

Window_MenuCommand.prototype.addTurnEndCommand = function() {
this.addCommand(_textSrpgTurnEnd, 'turnEnd', true);
};

Window_MenuCommand.prototype.addAutoBattleCommand = function() {
this.addCommand(_textSrpgAutoBattle, 'autoBattle', true);
};

What kind of code would I need to implement it?
 

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
512
Reaction score
486
First Language
german
Primarily Uses
RMMZ
Code:
Window_MenuCommand.prototype.addTurnEndCommand = function() {
    if ($gameSwitches.value(XY))
        this.addCommand(_textSrpgTurnEnd, 'turnEnd', true);
};

Window_MenuCommand.prototype.addAutoBattleCommand = function() {
    if ($gameSwitches.value(XY))
        this.addCommand(_textSrpgAutoBattle, 'autoBattle', true);
};

Paste it in as a new Plugin below SRD's Plugin. Replace XY with your switch Id. Tell me if it works for you :)
 
Last edited:

CarpenterScr

Veteran
Veteran
Joined
Nov 2, 2020
Messages
66
Reaction score
6
First Language
english
Primarily Uses
RMMV
Thank you for your help.
Unfortunately I get an error message.

error.png

EDIT: I don't know if this is what you were trying to do, but I would like the two commands to be greyed out, not totally removed.
 

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
512
Reaction score
486
First Language
german
Primarily Uses
RMMZ
Oh, to grey them out, use this:


Code:
Window_MenuCommand.prototype.addTurnEndCommand = function() {
    const enabled = $gameSwitches.value(XY);
    this.addCommand(_textSrpgTurnEnd, 'turnEnd', enabled);
};

Window_MenuCommand.prototype.addAutoBattleCommand = function() {
    const enabled = $gameSwitches.value(XY);
    this.addCommand(_textSrpgAutoBattle, 'autoBattle', enabled);
};

Okay, the error message says, that "_textSrpgTurnEnd" is not available. I don't know how to access this variable, so I can only recommend you to add this code snippet directly into the SRPG Plugin at the bottom; If this still does not work, you may think about overriding the code parts of SRPG with my Code snippet.
 

CarpenterScr

Veteran
Veteran
Joined
Nov 2, 2020
Messages
66
Reaction score
6
First Language
english
Primarily Uses
RMMV
I'm still getting that "_textSrpgTurnEnd" is not defined (similar error).

EDIT:
this works (inserted directly in the code, not at the bottom)

Window_MenuCommand.prototype.addTurnEndCommand = function() {
const enabled = $gameSwitches.value(X);
this.addCommand(_textSrpgTurnEnd, 'turnEnd', enabled);
};


However it does the opposite... it's disabled if the switch X is OFF not ON... what should I change to make it do the opposite?
 
Last edited:

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
512
Reaction score
486
First Language
german
Primarily Uses
RMMZ
However it does the opposite... it's disabled if the switch X is OFF not ON... what should I change to make it do the opposite?
Oh, that's weird 0.o
Anyway, when you want the opposite behaviour, add a ! right before $gameSwitches.value(...), this will invert the variable "enabled".

Code:
const enabled = !$gameSwitches.value(X);
 

Latest Threads

Latest Posts

Latest Profile Posts

oh god I'm going to die
AAAAAAAAi.png
Kind of relieved that I had medibang installed when I need to edit Sprite I was about to download gimp but I remember I had medibang installed lol
Voting for the first round of the Map Madness Tournament is now live! Vote for your favorite in each matchup!

Finally started working on Grim Trigger episode 2 today :LZScat: it's half comic/half visual novel!

GfY3Rwj.png
Is it interesting to get more backstory on villains? A key moment in their past, their childhood, or maybe something that shows they've always been that way? To see or not to see?

Forum statistics

Threads
110,367
Messages
1,052,644
Members
143,402
Latest member
IBanana
Top