How can I tell in script how many party members there are

I have a script that crashes my game because it tries to use party member 2 even when there is no party member 2 in the party so how can I say "do this if there are 2 party members).

Also is there anything like that tell me all of these script things?
$gameParty.size() gives you the number of people in the party. So assuming you want to run your code if there are at least two people in the party, you can use
Code:
if ($gameParty.size() >= 2) {
  // run your code here
}

You can find the list of script calls here:
https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-mz-script-call-list.46456/
$gameParty.size() gives you the number of people in the party. So assuming you want to run your code if there are at least two people in the party, you can use
Code:
if ($gameParty.size() >= 2) {
  // run your code here
}

You can find the list of script calls here:
https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-mz-script-call-list.46456/
thank you, hopefully I won't need to ask for so much help now that I have a list of things
Welcome to the forum!

The Script Call List is extremely helpful.

Good luck on your projects!

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-tell-in-script-how-many-party-members-there-are.181239/