Common Event Menu

hey guys

im having an issue with a script im playing with for my game
i watched a video on how to make common events happen from menu
and i wanted to add switch control
the first half worked then i tried to add another item with a switch for a debug menu
and it broke the whole script

the issue seams to be in the commented out area

Spoiler: Script
Window_MenuCommand.prototype.addOriginalCommands = function() {
this.addCommand("Professions", 'professions', true);
};

var xscene_menu_ccw = Scene_Menu.prototype.createCommandWindow;
Scene_Menu.prototype.createCommandWindow = function() {
xscene_menu_ccw.call(this);
this._commandWindow.setHandler('professions', this.commandProfessions.bind(this));
this.addWindow(this._commandWindow);
};

Scene_Menu.prototype.commandProfessions = function() {
$gameTemp.reserveCommonEvent($gameSystem._commonEventNumber);
SceneManager.push(Scene_Map);
}

var alias_gameSystem = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
alias_gameSystem.call(this);
this._commonEventNumber = 2;
}

Game_Interpreter.prototype.pluginCommand = function(command, args) {
if (command === "commonEventProfession") {
$gameSystem._commonEventNumber = args[0];
}
};

// if ($gameSwitches.setValue(1, true)😉 {
// Window_MenuCommand.prototype.addOriginalCommands = function() {
// this.addCommand("Debug", 'debug', true);
// };

// var xscene_menu_ccw = Scene_Menu.prototype.createCommandWindow;
// Scene_Menu.prototype.createCommandWindow = function() {
// xscene_menu_ccw.call(this);
// this._commandWindow.setHandler('debug', this.commandProfessions.bind(this));
// this.addWindow(this._commandWindow);
// };

// Scene_Menu.prototype.commandDebug = function() {
// $gameTemp.reserveCommonEvent($gameSystem._commonEventNumber);
// SceneManager.push(Scene_Map);
// }

// var alias_gameSystem = Game_System.prototype.initialize;
// Game_System.prototype.initialize = function() {
// alias_gameSystem.call(this);
// this._commonEventNumber = 1;
// }

// Game_Interpreter.prototype.pluginCommand = function(command, args) {
// if (command === "commonEventDebug") {
// $gameSystem._commonEventNumber = args[0];
// }
// };
// };
It's hard to follow all of that on my phone, but the first if statement has a strange conditional. You're using a script call instead of an eval there, and that script call does not have a return value, so that's probably where your code breaks.
im sorry to say i do not do javascript atall, i am just really determined to get a desired effect 😛

Original thread: https://forums.rpgmakerweb.com/threads/common-event-menu.87771/