Creating a new menu

I am trying to make a new menu and am having no luck.


What I want, is to have new menu option in the main menu that you select, and it leads to a new menu. Essentially what i am trying to create is a character book, containing info on all of the characters that you have met on your journey. The only two plugins for this that i could find don't work.


I use YANFLYs main menu manager to add a new option to access the menu, and that works fine. 


I am able to get a background image to appear, so the plugin command I made to access the menu works.


The problem is when I try to have the menu appear. 


I have been using other js files as reference, and initially I used an instance of the window_menuCommand (based on the main menu code), but it just made a new copy of the main menu appear.


I realised what was going on at this point and am now using the window_command class. Only now, no options appear at all. I get a little window box with nothing in it.


I have been using addCommand, followed by setHandler.

Code:
//==============================================================================================================
// 		Character profile screen
//==============================================================================================================

/*:
 * @plugindesc Displays detailed statuses of characters met in the game.
 * @author Omni
 *
 * @param Unknown Data
 * @desc The index name for an unknown character.
 * @default ??????
 *
 * @help
 *
 * Plugin Command:
 *   CharProfile open       # Open the character profile screen
 *
 *
 */



(function() {


	var parameters = PluginManager.parameters('OMNI_Character Profile');
    var unknownData = String(parameters['Unknown Data'] || '??????');

	var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;

	var selected = '';
	
	Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command === 'CharProfile') {
            switch (args[0]) {
            case 'open':
                SceneManager.push(Scene_CharProfile);
                break;
            case 'add':
                //$gameSystem.addToEnemyBook(Number(args[1]));
                break;
            case 'remove':
                //$gameSystem.removeFromEnemyBook(Number(args[1]));
                break;
            case 'complete':
               // $gameSystem.completeEnemyBook();
                break;
            case 'clear':
               // $gameSystem.clearEnemyBook();
                break;
            }
        }
    };

	
	// === character profile select menu =======================================================================
	// this is the menu where the player selects the character the wish to view.
	
	function Scene_CharProfile() {
        this.initialize.apply(this, arguments);
    }

	Scene_CharProfile.prototype = Object.create(Scene_MenuBase.prototype);
    Scene_CharProfile.prototype.constructor = Scene_CharProfile;

    Scene_CharProfile.prototype.initialize = function() {
        Scene_MenuBase.prototype.initialize.call(this);
    };
	
	Scene_CharProfile.prototype.create = function() {
		Scene_MenuBase.prototype.create.call(this);
		//this._backgroundSprite = new Sprite();
		//this._backgroundSprite.bitmap = ImageManager.loadBitmap('img/CharBook/', 'CharBookBG', 0, true);
		//this.addChild(this._backgroundSprite);
		
		this.createCommandWindow();
	};
	
	Scene_Menu.prototype.start = function() {
		Scene_MenuBase.prototype.start.call(this);
		//this._commandWindow.refresh();
	};

	Scene_CharProfile.prototype.createCommandWindow = function() {
		this._commandWindow = new Window_Command(0, 0);
		this._commandWindow.addCommand('Char1','Char1');
		this._commandWindow.addCommand('Char2','Char2');
		this._commandWindow.setHandler('Char1',    this.commandDisplay.bind(this));
		this._commandWindow.setHandler('Char2',      this.commandDisplay.bind(this));
		this._commandWindow.setHandler('cancel',    this.popScene.bind(this));
		this.addWindow(this._commandWindow);
	};
	
	Scene_CharProfile.prototype.commandDisplay = function() {
		selected = this._commandWindow.currentSymbol();
		SceneManager.push(Scene_CharDetails);
	};
	
	// ==== character details section ================================================================
	// this is where all of the character information is displayed.
	
	function Scene_CharDetails() {
        this.initialize.apply(this, arguments);
    }

	Scene_CharDetails.prototype = Object.create(Window_Selectable.prototype);
	Scene_CharDetails.prototype.constructor = Scene_CharDetails;

	Scene_CharDetails.prototype.initialize = function() {
		$gameMessage.add("Details of " + selected + "");
		var width = Graphics.boxWidth;
		var height = Graphics.boxHeight;
		Window_Selectable.prototype.initialize.call(this, 0, 0, width, height);
		//this.refresh();
		//this.activate();
	};












})();
I'm by no means a wizard at this, but I recently just put together a new menu of sorts that stems from the main menu like you are talking about, but leads to yet another menu.


I found it best to think of Scenes vs Windows as: Scenes are the code that manipulate what Windows do. Scenes control the handling and input, but Windows display what it is you're seeing.


First, I see this unusual thing:

Spoiler
Scene_CharDetails.prototype = Object.create(Window_Selectable.prototype);
Scene_CharDetails.prototype.constructor = Scene_CharDetails;

Where you are trying to make your Scene object out of a Window object... which I mean, none of the other Scenes do this, so you probably don't need to do that either. It should probably be something like:

Spoiler
Scene_CharDetails.prototype = Object.create(Scene_MenuBase.prototype);
Scene_CharDetails.prototype.constructor = Scene_CharDetails;

I would assume, since you are stemming your system off of the Menu, mostly. Object.create(Scene_Menu.prototype) probably would work too.


Also, I don't see any additional windows. If you look in Scene_Menu, you'll see in one of the first functions (.create) some stuff that you are lacking.


In your thing, you lack this method (and a lot of others, but I assume that is because you just haven't gotten there).

Spoiler
Scene_Menu.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createCommandWindow();
this.createGoldWindow();
this.createStatusWindow();
};

Here is typically where your scene will generate all the initial windows and do the things that get the ball rolling, as seen(scene, haha, get it?) above. Here Scene_Menu creates the command window (for the commands on the left in default), creates the window for gold, and the giant window on the right for all your actors menu-status stuff. 


From there is where you, as a programmer, get to shine, because you get to make all the commands for handling input from the user!


I suppose if I am understanding your description, and you are just looking to display a command_menu style list of all the actors encountered, you probably need a way to access that, and then generate a window that displays the information based on the currently-selected actor in the command window.


Like I mentioned before, I put together a plugin (not publicly distributed as of this minute) that utilizes all that I've described, and if you need some help (it works, I promise!) or a reference point, I think I can sift through it and isolate it so you can take a peek and try to understand it. I commented everything, basically so I knew what each function did, etc.

Original thread: https://forums.rpgmakerweb.com/threads/creating-a-new-menu.70772/