Hello again!! 😀
I'm trying to implement a parameter for my plugin:
* @param Menu Help Windows
* @type note[]
* @Default []
So, based on the commandwindow index, it will be show something in the help window i made for menu.
i'v already tried to do this in two ways, but in the final, i get the same error.
Here is the config of parameters in game:
but i keep get this error:
i've searched a lot in google, and i found the most answers is because the code trying to pass undefined to JSON.parse as an argument.
I try several things to fix, but none of them worked =/
the problem always happen when i go to a command where i not define any help text.
In the picture above, i have defined help text for the two first commands of menu. But in third i add nothing. then when i go to to him the error shows.
Here the code:
I'm trying to implement a parameter for my plugin:
* @param Menu Help Windows
* @type note[]
* @Default []
So, based on the commandwindow index, it will be show something in the help window i made for menu.
i'v already tried to do this in two ways, but in the final, i get the same error.
Here is the config of parameters in game:
but i keep get this error:
i've searched a lot in google, and i found the most answers is because the code trying to pass undefined to JSON.parse as an argument.
I try several things to fix, but none of them worked =/
the problem always happen when i go to a command where i not define any help text.
In the picture above, i have defined help text for the two first commands of menu. But in third i add nothing. then when i go to to him the error shows.
Here the code:
Code:
* @param Menu Help Windows
* @type note[]
* @default []
*
*
*/
var Imported = Imported || {}; //import namespace
Imported.Eli_HelpWindowsStruct = true;
var Eli = Eli || {}; //author namespace
Eli.HelpWindowsStruct = Eli.HelpWindowsStruct || {}; //plugin namespace
'use strict';
Eli.Parameters = PluginManager.parameters('Eli_HelpWindowsStruct');
Eli.Param = Eli.Param || {};
Eli.Param.HelpWindowsStruct = {
MenuHelpText: JSON.parse(Eli.Parameters['Menu Help Windows'])
};
// CODE
//SCENE MENU HELP - 955
var Eli_Scene_Menu_create = Scene_Menu.prototype.create;
Scene_Menu.prototype.create = function() {
Eli_Scene_Menu_create.call(this);
this.createHelpWindow();
};
Scene_Menu.prototype.createHelpWindow = function() {
this._helpWindow = new Window_Help();
this.addWindow(this._helpWindow);
this._helpWindow.y = this._commandWindow.height;//324;
this._helpWindow.x = 0;
this._helpWindow.width = this._commandWindow.width;//730;
this._helpWindow.height = Graphics.boxHeight - (this._commandWindow.height + this._goldWindow.height);
};
var Eli_Scene_Menu_update = Scene_Menu.prototype.update;
Scene_Menu.prototype.update = function() {
Scene_MenuBase.prototype.update.call(this);
this._helpWindow.setText(JSON.parse(Eli.Param.HelpWindowsStruct.MenuHelpText[this._commandWindow._index]));
};