Can I use a plugin or script to get many items easily?

ex) I want to get each item from number 1 to 9.

var i = 0;
for (var i = 1; i < 10; i++) {$gameParty.gainItem($dataItems,1);}

I think it's going to be worked by the upper command, but it's not working.
Should I have to set event one by one?
[ Change Items : "1" +1 ... Change Items : "9" +1
/ $gameParty.gainItem($dataItems[1],1); ... $gameParty.gainItem($dataItems[9],1); ]

Can I set a variable only in "Plugin Manager"?
What is the difference between "Plugin command" and "Script" on the event pages?
This is not really a question of Rpg Maker, but about Javascript.
I also did not understand your request well, try to format the topic better.
As far as I understand this is what you need:
JavaScript:
for (mvitem=1;mvitem<10;mvitem++){
   $gameParty.gainItem($dataItems[mvitem],1);
}
Okay...a number of things here...
I want to get each item from number 1 to 9.

Code:
var i = 0;
for (var i = 1; i < 10; i++) {$gameParty.gainItem($dataItems[i],1);}
You want to make sure you always put code inside of CODE tags, otherwise the forum will interpret array elements as formatting tags.

For one thing, you're double-declaring your i variable. Why? JavaScript will handle it without giving you an error, but there's certainly no point to the line that says var i = 0;

Aside from that...in what way is it not working? It looks correct. Are you getting some of the items? No items? Is there an error when you press F8 and click on Console? Where are you calling this script?
Can I set a variable only in "Plugin Manager"?
I'm sorry, I don't understand the question. Your plugin manager doesn't have variables or anything you can type into, it just lists your plugins.
What is the difference between "Plugin command" and "Script" on the event pages?
Script is for JavaScript, the programming language RPG Maker MV is coded with. Plugin commands are non-script commands you can call that will do specific things, with the programming for them inside the plugin.

Try this:
JavaScript:
for (mvitem=1;mvitem<10;mvitem++){
   $gameParty.gainItem($dataItems[mvitem],1);
}
That's the same thing he had, he just didn't put his code into CODE tags so it turned his [i] into italics.

Sorry for the accidental double post, the messages showed up out of order on my page.

I've moved this thread to Learning Javascript. Thank you.



@ATT_Turan I merged your posts for you.
didn't know you need a range rather than all, above are all working solutions 🙂
if used for single map 🙂

Original thread: https://forums.rpgmakerweb.com/threads/can-i-use-a-plugin-or-script-to-get-many-items-easily.135603/