Hello,
I'm trying to create a window that displays a list of the party's inventory, similar to the normal inventory list, but for a different purpose.
Creating the windows and getting a list of the items is not the problem, I also managed to get the items to display. However, I can't move the cursor up and down to select them - it stays at the first position and doesn't seem to react to the input. I assume there's a boolean or something that I need to set, but I can't find it. Can anyone tell me what I'm doing wrong?
Here's what I have so far:
I'm trying to create a window that displays a list of the party's inventory, similar to the normal inventory list, but for a different purpose.
Creating the windows and getting a list of the items is not the problem, I also managed to get the items to display. However, I can't move the cursor up and down to select them - it stays at the first position and doesn't seem to react to the input. I assume there's a boolean or something that I need to set, but I can't find it. Can anyone tell me what I'm doing wrong?
Here's what I have so far:
JavaScript:
Window_InventoryList.prototype.initialize = function(){
Window_Selectable.prototype.initialize.call(this, 0, 0, Graphics.boxWidth/2, Graphics.boxHeight);
this.refresh();
this.setTopRow(0);
this.select(0);
this.activate();
}
Window_InventoryList.prototype.refresh = function(){
this.contents.clear();
var i, item;
this.itemsInInventory = $gameParty.allItems();
this._list = [];
for(i = 0; i < this.itemsInInventory.length; i++){
item = this.itemsInInventory[i];
this._list.push(item);
this.drawItem(i);
}
}
Window_InventoryList.prototype.drawItem = function(index) {
var item = this._list[index];
var rect = this.itemRect(index);
var width = rect.width - this.textPadding();
this.drawItemName(item, rect.x, rect.y, width);
};