To find out the size (what I presume you mean by 'maximum') of an array, use the
arraylen(var) function. This will return the number of individual slots inside the array itself. So to do something when a variable reaches the length of your array:
NPC Code:
if (yourvariable=arraylen(yourarray)){
// do stuff
}