👋 I think this is what you're seeking:
JavaScript:
$gameParty.numItems($dataItems[5]);
Just replace 5 with the ID of your Skill Point item.
😮💨
Since this is in Learning JavaScript...note that with event commands, you can get the inventory count of a given item using
Control Variables > Game Data > Item, e.g.
Code:
◆Control Variables:#0001 Count = The number of Potion
◆Text:None, Window, Bottom
: :You have \v[1] potions!
You might think that's irrelevant here because you need a script. However, the game interprets all event commands as scripted functions! If you open up
rpg_objects.js and search for "Control Variables" you'll find yourself looking at something like this:
Spoiler: Game_Interpreter excerpt
JavaScript:
// Control Variables
Game_Interpreter.prototype.command122 = function() {
var value = 0;
switch (this._params[3]) { // Operand
case 0: // Constant
value = this._params[4];
break;
case 1: // Variable
value = $gameVariables.value(this._params[4]);
break;
case 2: // Random
value = this._params[5] - this._params[4] + 1;
for (var i = this._params[0]; i <= this._params[1]; i++) {
this.operateVariable(i, this._params[2], this._params[4] + Math.randomInt(value));
}
return true;
break;
case 3: // Game Data
value = this.gameDataOperand(this._params[4], this._params[5], this._params[6]);
break;
case 4: // Script
value = eval(this._params[4]);
break;
}
for (var i = this._params[0]; i <= this._params[1]; i++) {
this.operateVariable(i, this._params[2], value);
}
return true;
};
Game_Interpreter.prototype.gameDataOperand = function(type, param1, param2) {
switch (type) {
case 0: // Item
return $gameParty.numItems($dataItems[param1]);
// ~ snip ~ //
Here we can see that the "Game Data" branch of
command122 leads to
gameDataOperand, the first branch of which is for item count. And there's the script call you were after!
😤
(Not all commands convert so easily to script, but in most cases it's worth checking out~)