[SOLVED] Item Menu Script Has No Effect.

Status
Not open for further replies.

Nekohime1989

Nekohime
Veteran
Joined
May 31, 2014
Messages
498
Reaction score
227
First Language
English
Primarily Uses
RMMZ
Not sure if i'm missing something crucial. But my script has no effect on the item menu. It should change the name, symbols, and what items are included for each category but it does nothing.

Code:
//=============================================================================
// CustomItemCore
// CustomItemCore.js
//=============================================================================

var Imported = Imported || {};
Imported.CustomItemCore = true;
var CustomItemCore = CustomItemCore || {};

//=============================================================================
 /*:
 * @plugindesc v1.00 This plugin allows you to change the categories for your
 * item menu,
 * @author Palpaleos
 *
 * @param ---Menu 1---
 * @default
 *
 * @param Menu 1 Name
 * @parent ---Menu 1---
 * @desc This is the name for the menu command. This is an eval. To
 * make it a string, use 'quotes' around the name.
 * @default
 *
 * @param Menu 1 Symbol
 * @parent ---Menu 1---
 * @desc This is the symbol for the item submenus. This needs to be
 * unique per menu command.
 * @default
 *
 * @param Menu 1 Include
 * @parent ---Menu 1---
 * @desc This is the eval condition for items to appear in the submenu.
 * @default
 *
 * @param ---Menu 2---
 * @default
 *
 * @param Menu 2 Name
 * @parent ---Menu 2---
 * @desc This is the name for the menu command. This is an eval. To
 * make it a string, use 'quotes' around the name.
 * @default
 *
 * @param Menu 2 Symbol
 * @parent ---Menu 2---
 * @desc This is the symbol for the item submenus. This needs to be
 * unique per menu command.
 * @default
 *
 * @param Menu 2 Include
 * @parent ---Menu 2---
 * @desc This is the eval condition for items to appear in the submenu.
 * @default
 *
 * @param ---Menu 3---
 * @default
 *
 * @param Menu 3 Name
 * @parent ---Menu 3---
 * @desc This is the name for the menu command. This is an eval. To
 * make it a string, use 'quotes' around the name.
 * @default
 *
 * @param Menu 3 Symbol
 * @parent ---Menu 3---
 * @desc This is the symbol for the item submenus. This needs to be
 * unique per menu command.
 * @default
 *
 * @param Menu 3 Include
 * @parent ---Menu 3---
 * @desc This is the eval condition for items to appear in the submenu.
 * @default
 *
 * @param ---Menu 4---
 * @default
 *
 * @param Menu 4 Name
 * @parent ---Menu 4---
 * @desc This is the name for the menu command. This is an eval. To
 * make it a string, use 'quotes' around the name.
 * @default
 *
 * @param Menu 4 Symbol
 * @parent ---Menu 4---
 * @desc This is the symbol for the item submenus. This needs to be
 * unique per menu command.
 * @default
 *
 * @param Menu 4 Include
 * @parent ---Menu 4---
 * @desc This is the eval condition for items to appear in the submenu.
 * @default
 * ============================================================================
 * Introduction
 * ============================================================================

 * ============================================================================
 * How to Use This Plugin
 * ============================================================================
 */
//=============================================================================

//=============================================================================
// Data Manager
//=============================================================================

CustomItemCore.DataManager = DataManager.isDatabaseLoaded;

CustomItemCore.Game_Item_initialize = Game_Item.prototype.initialize;

//=============================================================================
// Parameter Variables
//=============================================================================
CustomItemCore.Parameters = PluginManager.parameters('CustomItemCore');
CustomItemCore.Param = CustomItemCore.Param || {};

CustomItemCore.Param.Menu1Name = eval(CustomItemCore.Parameters['Menu 1 Name']);
CustomItemCore.Param.Menu2Name = eval(CustomItemCore.Parameters['Menu 2 Name']);
CustomItemCore.Param.Menu3Name = eval(CustomItemCore.Parameters['Menu 3 Name']);
CustomItemCore.Param.Menu4Name = eval(CustomItemCore.Parameters['Menu 4 Name']);
CustomItemCore.Param.Menu1Symbol = eval(CustomItemCore.Parameters['Menu 1 Symbol']);
CustomItemCore.Param.Menu2Symbol = eval(CustomItemCore.Parameters['Menu 2 Symbol']);
CustomItemCore.Param.Menu3Symbol = eval(CustomItemCore.Parameters['Menu 3 Symbol']);
CustomItemCore.Param.Menu4Symbol = eval(CustomItemCore.Parameters['Menu 4 Symbol']);
CustomItemCore.Param.Menu1Include = eval(CustomItemCore.Parameters['Menu 1 Include']);
CustomItemCore.Param.Menu2Include = eval(CustomItemCore.Parameters['Menu 2 Include']);
CustomItemCore.Param.Menu3Include = eval(CustomItemCore.Parameters['Menu 3 Include']);
CustomItemCore.Param.Menu4Include = eval(CustomItemCore.Parameters['Menu 4 Include']);

//=============================================================================
// Item Category
// The window for selecting a category of items on the item and shop screens.
//=============================================================================

CustomItemCore.Window_ItemCategory_initialize = Window_ItemCategory.prototype.initialize;

CustomItemCore.Window_ItemCategory.prototype.makeCommandList = function() {
    this.addCommand(CustomItemCore.Param.Menu1Name, CustomItemCore.Param.Menu1Symbol);
    this.addCommand(CustomItemCore.Param.Menu2Name, CustomItemCore.Param.Menu2Symbol);
    this.addCommand(CustomItemCore.Param.Menu3Name, CustomItemCore.Param.Menu3Symbol);
    this.addCommand(CustomItemCore.Param.Menu4Name, CustomItemCore.Param.Menu4Symbol);
};

//-----------------------------------------------------------------------------
// Window_ItemList
//
// The window for selecting an item on the item screen.

CustomItemCore.Window_ItemList_intiaialize = Window_ItemList.prototype.initialize;

CustomItemCore.Window_ItemList.prototype.includes = function(item) {
    switch (this._category) {
    case CustomItemCore.Param.Menu1Symbol:
        return CustomItemCore.Param.Menu1Include;
    case CustomItemCore.Param.Menu2Symbol:
        return CustomItemCore.Param.Menu2Include;
    case CustomItemCore.Param.Menu3Symbol:
        return CustomItemCore.Param.Menu3Include;
    case CustomItemCore.Param.Menu4Symbol:
        return CustomItemCore.Param.Menu4Include;
    default:
        return false;
    }
};
 
Last edited:

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
On line 149, you have a ' that's causing an unexpected token error.
Code:
case CustomItemCore.Param.Menu2Symbol':
should read:
Code:
case CustomItemCore.Param.Menu2Symbol:
When I fix that, I get some errors from your eval statements, however. It looks like $dataSystem has not been assigned a value by the time you're trying to reference it via TextManager.
 

Nekohime1989

Nekohime
Veteran
Joined
May 31, 2014
Messages
498
Reaction score
227
First Language
English
Primarily Uses
RMMZ
Fixed the first and the second. Not sure about what the third error that appeared after fixing the first two means.
Thanks for helping. :)

VM869:1 Uncaught ReferenceError: item is not defined
at eval (eval at <anonymous> (CustomItemCore.js:125), <anonymous>:1:35)
at CustomItemCore.js:125

edit: updated code to show changes.

edit2:
Forgot the changes to the params. I'm just using text for the name *wrapped in quotes*
Symbol no changes.
The new eval is...
Code:
CustomItemCore.DataManager.isItem(item) && CustomItemCore.item.itypeId === 1
 
Last edited:

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
If you post your updated script with the first couple errors fixed, I can import the newest version into my project and see if I can help chase the error down.
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
I copy-pasted your code from the original post in, but there are no defaults for any params any more. Now I get the following error:


Looks like it's a result of the "Menu 4 Include" param reading the next line as the default instead of the default being nothing.

I removed the comments causing the Menu 4 Include param to throw that error, but now I get another error that CustomItemCore.Window_ItemCategory is not defined - which, looking through the code, appears to be correct.

Also, this line:
Code:
CustomItemCore.Window_ItemList_intiaialize = Window_ItemList.prototype.initialize;
You have a typo: initaialize instead of initialize.
 

Nekohime1989

Nekohime
Veteran
Joined
May 31, 2014
Messages
498
Reaction score
227
First Language
English
Primarily Uses
RMMZ
Code:
//=============================================================================
// CustomItemCore
// CustomItemCore.js
//=============================================================================

var Imported = Imported || {};
Imported.CustomItemCore = true;
var CustomItemCore = CustomItemCore || {};

//=============================================================================
 /*:
 * @plugindesc v1.00 This plugin allows you to change the categories for your
 * item menu,
 * @author Palpaleos
 *
 * @param ---Menu 1---
 * @default
 *
 * @param Menu 1 Name
 * @parent ---Menu 1---
 * @desc This is the name for the menu command. This is an eval. To
 * make it a string, use 'quotes' around the name.
 * @default 'Item'
 *
 * @param Menu 1 Symbol
 * @parent ---Menu 1---
 * @desc This is the symbol for the item submenus. This needs to be
 * unique per menu command.
 * @default 'item'
 *
 * @param Menu 1 Include
 * @parent ---Menu 1---
 * @desc This is the eval condition for items to appear in the submenu.
 * @default CustomItemCore.DataManager.isItem(item) && CustomItemCore.item.itypeId === 1
 *
 * @param ---Menu 2---
 * @default
 *
 * @param Menu 2 Name
 * @parent ---Menu 2---
 * @desc This is the name for the menu command. This is an eval. To
 * make it a string, use 'quotes' around the name.
 * @default 'Weapons'
 *
 * @param Menu 2 Symbol
 * @parent ---Menu 2---
 * @desc This is the symbol for the item submenus. This needs to be
 * unique per menu command.
 * @default 'weapon'
 *
 * @param Menu 2 Include
 * @parent ---Menu 2---
 * @desc This is the eval condition for items to appear in the submenu.
 * @default CustomItemCore.DataManager.isWeapon(item)
 *
 * @param ---Menu 3---
 * @default
 *
 * @param Menu 3 Name
 * @parent ---Menu 3---
 * @desc This is the name for the menu command. This is an eval. To
 * make it a string, use 'quotes' around the name.
 * @default 'Armors'
 *
 * @param Menu 3 Symbol
 * @parent ---Menu 3---
 * @desc This is the symbol for the item submenus. This needs to be
 * unique per menu command.
 * @default 'armor'
 *
 * @param Menu 3 Include
 * @parent ---Menu 3---
 * @desc This is the eval condition for items to appear in the submenu.
 * @default CustomItemCore.DataManager.isArmor(item)
 *
 * @param ---Menu 4---
 * @default
 *
 * @param Menu 4 Name
 * @parent ---Menu 4---
 * @desc This is the name for the menu command. This is an eval. To
 * make it a string, use 'quotes' around the name.
 * @default 'Key Items'
 *
 * @param Menu 4 Symbol
 * @parent ---Menu 4---
 * @desc This is the symbol for the item submenus. This needs to be
 * unique per menu command.
 * @default 'keyItem'
 *
 * @param Menu 4 Include
 * @parent ---Menu 4---
 * @desc This is the eval condition for items to appear in the submenu.
 * @default CustomItemCore.DataManager.isItem(item) && CustomItemCore.item.itypeId === 2
 * ============================================================================
 * Introduction
 * ============================================================================

 * ============================================================================
 * How to Use This Plugin
 * ============================================================================
 */
//=============================================================================

//=============================================================================
// Data Manager
//=============================================================================

CustomItemCore.DataManager = DataManager.isDatabaseLoaded;

CustomItemCore.Game_Item_initialize = Game_Item.prototype.initialize;

//=============================================================================
// Parameter Variables
//=============================================================================
CustomItemCore.Parameters = PluginManager.parameters('CustomItemCore');
CustomItemCore.Param = CustomItemCore.Param || {};

CustomItemCore.Param.Menu1Name = eval(CustomItemCore.Parameters['Menu 1 Name']);
CustomItemCore.Param.Menu2Name = eval(CustomItemCore.Parameters['Menu 2 Name']);
CustomItemCore.Param.Menu3Name = eval(CustomItemCore.Parameters['Menu 3 Name']);
CustomItemCore.Param.Menu4Name = eval(CustomItemCore.Parameters['Menu 4 Name']);
CustomItemCore.Param.Menu1Symbol = eval(CustomItemCore.Parameters['Menu 1 Symbol']);
CustomItemCore.Param.Menu2Symbol = eval(CustomItemCore.Parameters['Menu 2 Symbol']);
CustomItemCore.Param.Menu3Symbol = eval(CustomItemCore.Parameters['Menu 3 Symbol']);
CustomItemCore.Param.Menu4Symbol = eval(CustomItemCore.Parameters['Menu 4 Symbol']);
CustomItemCore.Param.Menu1Include = eval(CustomItemCore.Parameters['Menu 1 Include']);
CustomItemCore.Param.Menu2Include = eval(CustomItemCore.Parameters['Menu 2 Include']);
CustomItemCore.Param.Menu3Include = eval(CustomItemCore.Parameters['Menu 3 Include']);
CustomItemCore.Param.Menu4Include = eval(CustomItemCore.Parameters['Menu 4 Include']);

//=============================================================================
// Item Category
// The window for selecting a category of items on the item and shop screens.
//=============================================================================

CustomItemCore.Window_ItemCategory_initialize = Window_ItemCategory.prototype.initialize;

CustomItemCore.Window_ItemCategory.prototype.makeCommandList = function() {
    this.addCommand(CustomItemCore.Param.Menu1Name, CustomItemCore.Param.Menu1Symbol);
    this.addCommand(CustomItemCore.Param.Menu2Name, CustomItemCore.Param.Menu2Symbol);
    this.addCommand(CustomItemCore.Param.Menu3Name, CustomItemCore.Param.Menu3Symbol);
    this.addCommand(CustomItemCore.Param.Menu4Name, CustomItemCore.Param.Menu4Symbol);
};

//-----------------------------------------------------------------------------
// Window_ItemList
//
// The window for selecting an item on the item screen.

CustomItemCore.Window_ItemList_intiaialize = Window_ItemList.prototype.initialize;

CustomItemCore.Window_ItemList.prototype.includes = function(item) {
    switch (this._category) {
    case CustomItemCore.Param.Menu1Symbol:
        return CustomItemCore.Param.Menu1Include;
    case CustomItemCore.Param.Menu2Symbol:
        return CustomItemCore.Param.Menu2Include;
    case CustomItemCore.Param.Menu3Symbol:
        return CustomItemCore.Param.Menu3Include;
    case CustomItemCore.Param.Menu4Symbol:
        return CustomItemCore.Param.Menu4Include;
    default:
        return false;
    }
};
Okay, try this. It has the default parameters set.
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
So the error is that CustomItemCore.item is undefined. You reference it in your default parameters for Menu 1 Include and Menu 4 Include, but then you never set a CustomItemCore.item in your Plugin's code.

You also have a CustomItemCore.Window_ItemCategory.prototype.makeCommandList, but you never define the property Window_ItemCategory on CustomItemCore, so that's going to throw an error that prototype is not a property of undefined. You'll have the same error with CustomItemCore.Window_ItemList.prototype.includes - you haven't defined a CustomItemCore.Window_ItemList property yet.

You'll want to define CustomItemCore.item, CustomItemCore.Window_ItemCategory, and CustomItemCore.Window_ItemList at some point in your code.
 

Nekohime1989

Nekohime
Veteran
Joined
May 31, 2014
Messages
498
Reaction score
227
First Language
English
Primarily Uses
RMMZ
what im trying to do is overload the default functions if that makes sense. Did i mess up the initialization somehow?
They should be at the bottom.

And item is a object defined in
Code:
CustomItemCore.Game_Item_initialize = Game_Item.prototype.initialize;
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
So your default value for Menu 1 Include is
Code:
CustomItemCore.DataManager.isItem(item) && CustomItemCore.item.itypeId === 1
On line 109, you have
Code:
CustomItemCore.DataManager = DataManager.isDatabaseLoaded;
The issue there is that DataManager.isDatabaseLoaded is a function that returns true or false. So trying to add a property to a function doesn't really work - in fact, if you hit F8 and open your console, and type:
Code:
CustomItemCore.DataManager.isItem
you'll see that it's undefined.

In addition, this bit in the Menu 1 Include default:
Code:
CustomItemCore.item.itypeId === 1
It's going to look for the property "item" on your CustomItemCore object. Unfortunately, you haven't declared CustomItemCore.item anywhere in your code, so it's undefined. Consider the following:
Code:
var CustomItemCore = {};
CustomItemCore.item.itypeId === 1;
You can't set the property "itypeId" of CustomItemCore.item because you never defined CustomItemCore.item.

You mention you want to overload the Game_Item.prototype.initialize method. You're correct that you want to cache the original definition of that function in case somebody needs to reference it later, but then you have to set it to a new definition.

So, if you want to overwrite Game_Item.prototype.initialize, the accepted way is something like:
Code:
CustomItemCore.Game_Item_initialize = Game_Item.prototype.initialize;
Game_Item.prototype.initialize = function(item) {
  // Your overwrite logic goes here
};
There are a number of issues within the Plugin to address, so it might be better to start with one piece at a time. It looks like you have three goals, so maybe start with one at a time. What's the first step you'd like to accomplish?
 

Nekohime1989

Nekohime
Veteran
Joined
May 31, 2014
Messages
498
Reaction score
227
First Language
English
Primarily Uses
RMMZ
Okay so let me explain what My objective is. Since I've decided to just rewrite this from scratch. (I have no idea what I'm doing but I'm getting the hang of it. I know C++, Json, Python, Lua, and Ruby so this shouldn't be to hard to master.)
My game has no weapons or armor.
I have Ingredients 'hiddenItemA', Items 'item', Tools 'hiddenItemB', and Key Items 'keyItem'. My first objective should be too redefine my parameters and what not. Ill do that. And check back with you tomorrow to start working on my goals. I would like to do them in numerical order. Anyways thanks for all your help this afternoon it is appreciated.

My goals are as follows:
1: Replace each term with the respective text in order 'Ingredient' 'Item' 'Tool' 'Key Item'
2. Make it so each menu includes the right items.
3. Make it so when using a item on the menu screen it skips the choice of actor. But I haven't gotten that far yet. :)
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
I think you're on the right track with number 1, at least.

Here's an example of a quick Plugin I started to try and solve your first goal:
Code:
(function(module) {
    module.Zevia = module.Zevia || {};
    const CustomItem = module.Zevia.CustomItem = {};

    CustomItem.makeItemCommandList = Window_ItemCategory.prototype.makeCommandList;
    Window_ItemCategory.prototype.makeCommandList = function() {
        this.addCommand('Ingredient', 'ingredient');
        this.addCommand('Item', 'item');
        this.addCommand('Tool', 'tool');
        this.addCommand('Key Item', 'keyItem');
    };
})(window);


See if that gives you a good base to start with and let us know where you get.
 

Nekohime1989

Nekohime
Veteran
Joined
May 31, 2014
Messages
498
Reaction score
227
First Language
English
Primarily Uses
RMMZ
Code:
//=============================================================================
// CustomItemCore
// CustomItemCore.js
//=============================================================================

var Imported = Imported || {};
Imported.CustomItemCore = true;

var Palpaleos = Palpaleos || {};
Palpaleos.CustomItem = Palpaleos.CustomItem || {};

//=============================================================================
/*:
 *This plugin has no plugin commands.
*/
//=============================================================================

//=============================================================================
// Data Manager
//=============================================================================

Palpaleos.CustomItem.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
    if (!Palpaleos.CustomItem.DataManager_isDatabaseLoaded.call(this)) return false;
    if (!Palpaleos._loaded_CustomItem) {
        this.processItemNotetages($dataItems);
        Palpaleos._loaded_CustomItem = true;
    }
    return true;
};

DataManager.processItemNotetages = function(group) {
  for (var n = 1; n < group.length; n++) {
    var obj = group[n];
    var notedata = obj.note.split(/[\r\n]+/);

    obj.skipActorMenu = false;

    for (var i = 0; i < notedata.length; i++) {
      var line = notedata[i];
      if (line.match(/<(?:Skip Actor Menu)>/i)) {
        obj.skipActor = true;
        break;
      }
    }
  }
};

//=============================================================================
// Scene Manager
//=============================================================================
Palpaleos.CustomItem.Scene_ItemBase_initialize = Scene_ItemBase.prototype.initialize;
Scene_ItemBase.prototype.initialize = function() {
    Palpaleos.CustomItem.Scene_ItemBase_initialize.call(this);
};

Scene_ItemBase.prototype.determineItem = function() {
    var action = new Game_Action(this.user());
    var item = this.item();
    if (item.skipActorMenu) {
        this.useItem();
        this.activateItemWindow();
    }
    action.setItemObject(item);
    if (action.isForFriend()) {
        this.showSubWindow(this._actorWindow);
        this._actorWindow.selectForItem(this.item());
    } else {
        this.useItem();
        this.activateItemWindow();
    }
};


//=============================================================================
// Window Manager
//=============================================================================
Palpaleos.CustomItem.Window_ItemCategory_initialize = Window_ItemCategory.prototype.initialize;
Window_ItemCategory.prototype.initialize = function() {
    Palpaleos.CustomItem.Window_ItemCategory_initialize.call(this);
};
Window_ItemCategory.prototype.makeCommandList = function() {
    this.addCommand('Ingredient', 'ingredient');
    this.addCommand('Item', 'item');
    this.addCommand('Tool', 'tool');
    this.addCommand('Key Item', 'keyItem');
};

Palpaleos.CustomItem.Window_ItemList_initialize = Window_ItemList.prototype.initialize;
Window_ItemList.prototype.initialize = function() {
    Palpaleos.CustomItem.Window_ItemList_initialize.call(this);
};
Window_ItemList.prototype.includes = function(item) {
    switch (this._category) {
    case 'ingredient':
        return DataManager.isItem(item) && item.itypeId === 3;
    case 'item':
        return DataManager.isItem(item) && item.itypeId === 1;
    case 'tool':
        return DataManager.isItem(item) && item.itypeId === 4;
    case 'keyItem':
        return DataManager.isItem(item) && item.itypeId === 2;
    default:
        return false;
    }
};
Made a lot of progress. However the actual menu is missing.

Solved it, I was missing the x,y, width, and height. in one of the functions. Works now. :)
 
Last edited:

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,867
Reaction score
5,240
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,455
Members
137,821
Latest member
Capterson
Top