Here's the setup: I have a block of states (called "starsigns") that are meant to be applied as passives to actors and enemies. In a plugin I'm trying to set up a menu that the player can choose a starsign from for each actor. I want the menu to be able to change dynamically based on the size and content of the block of states, with me only needing to change a couple of parameters ("firstSign" and "lastSign") to tell the plugin where the block begins and ends.
To do this I'm using a for loop to create the menu options and I want to use the "ext" argument (of the addCommand function) to pass the index of the state each option refers to. Everything else is working as expected, but the ext value always ends up being null.
Here's the relevant bit of code:
The alerts are there for testing purposes and ALWAYS say "null" no matter what I feed into the addCommand function. Can someone tell me how to get the ext value?
EDIT: Okay, part of my problem is that I shouldn't be using "Window_Command.prototype.currentExt()" like that. But replacing it with "this.currentExt()" isn't working either. I'm still getting "null" for everything.
To do this I'm using a for loop to create the menu options and I want to use the "ext" argument (of the addCommand function) to pass the index of the state each option refers to. Everything else is working as expected, but the ext value always ends up being null.
Here's the relevant bit of code:
Code:
function starsignMenu() {
var window = Object.create(Window_Command.prototype);
window.makeCommandList = function () {
for (i = firstSign; i <= lastSign; i++) {
window.addCommand($dataStates[i].name, "starsign" , true, i);
alert(Window_Command.prototype.currentExt());
}
};
window.initialize(0, 0);
window.setHandler("starsign", function () {
alert(Window_Command.prototype.currentExt());
});
return window;
};
The alerts are there for testing purposes and ALWAYS say "null" no matter what I feed into the addCommand function. Can someone tell me how to get the ext value?
EDIT: Okay, part of my problem is that I shouldn't be using "Window_Command.prototype.currentExt()" like that. But replacing it with "this.currentExt()" isn't working either. I'm still getting "null" for everything.