MV How to use parameter arrays

Hello, I'm new to js and I'm trying to figure out parameters and using arrays inside them.
The idea is that the plugin hides sealed skill types from the user during a battle. I got the basic functionality working but I decided to try to extend it by checking if the skill type ID is contained within an array modified by the exposed parameter.

When trying to edit the paramter in the visual mode it says that the parameter is "malformed" too.


JavaScript:
/*
*@plugindesc Hides sealed skill types during battle.
*@author SirRule     
*@param SkillTypeIDs
*@desc Only these skill types with these IDs will be affected. Leave blank for all.
*@type number[]
*@default 3,0

*/

(function () {
    var parameters = PluginManager.parameters('HideSealedActions');
    var paramArray = parameters['SkillTypeIDs'].split(',');


    var _Window_ActorCommand_BuildSkillCommandWindow = Window_ActorCommand.prototype.addSkillCommands;
    var _WIndow_ActorCommand_ModifyAttackCommand = Window_ActorCommand.prototype.addAttackCommand;

    Window_ActorCommand.prototype.addSkillCommands = function () {
        var skillTypes = this._actor.addedSkillTypes().filter(function (stypeId) {

            if (!paramArray.includes(stypeId)) { return true; }
            return !this._actor.isSkillTypeSealed(stypeId);
        }, this);


        skillTypes.sort(function (a, b) {
            return a - b;
        });
        skillTypes.forEach(function (stypeId) {
            var name = $dataSystem.skillTypes[stypeId];
            this.addCommand(name, 'skill', true, stypeId);
        }, this);
    };

What am I doing wrong?


EDIT:
I have won a victory today against this silly language.

So the problem I was having is that the skill types are stored as numbers and despite the parameters taking in what look like numbers, they were actually "Arrays of elements" that the computer assumed were letters. This meant that when I was comparing the skilltypes against the parameters that I was actually searching an array of characters looking for a number. So I looked online and found a way of converting the letters into numbers.
Then there may have been a problem with array.include which may be comparing against the position in memory instead of the value so that came out and was replaced with array.indexOf. Not too sure about that one, whatever this works now.

The number[] typing became string[] typing:
JavaScript:
*@type string[]
*@default ["4"]

Converting the strings to numbers:
JavaScript:
var parameters = PluginManager.parameters('HideSealedActions');
var paramArray = JSON.parse(parameters['SkillTypeIDs']);
var numArray = [];
paramArray.forEach(ele => numArray.push(+ele));

Searching the array:
JavaScript:
var skillTypes = this._actor.addedSkillTypes().filter(function (stypeId) {
    if (numArray.indexOf(stypeId) != -1) {
        return !this._actor.isSkillTypeSealed(stypeId);
    }
    return true;
   
}, this);

Thanks for the help.
Remove the "@type number[]" part and just treat it as a regular string.
Because "number[]" doesn't seem to be supported by the RPG Maker MZ Plugin System.
type number[] might not work as your default is 3,0
but should output [3,2].

I don't think you need to split the array with a comma when using an array.

arrays are mostly read when you use JSON.parse (same for booleans)

so in your case, remove "type number[]" and use
JSON.parse(parameters['SkillTypeIDs']);

so your default can be [1,3,4,5,6,7,8] to be readed.
I'm pretty sure number[] is also valid in MZ.
Also if you are not sure how to input default value, just input using the editor and copy the text.
1739200887275.png


Actually it will be converted to a string array. But you can use number input to edit it.
1739200998554.png
I removed the type and am using JSON.parse but still not having any luck.

I've noticed that if I changed the value in the editor to be only one, it throws an error that paramArray does not have an include function. I'm used to c# where if you want something to be a list or an array you declare it as such. Is there a way to force JS to see it as an array even if it only has one item in it?

JavaScript:
 var parameters = PluginManager.parameters('HideSealedActions');
 var paramArray = JSON.parse(parameters['SkillTypeIDs']);
Sorry about the double post but this issue is solved now.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-use-parameter-arrays.175325/