The maximum can't always be calculated. You can have no maximum, where items can always successfully acquire a slot. You can also have the maximum depend on the items that appear. For example, supposed you limit slots by their available volume, and you put randomly-sized items in the rack. You could probably calculate a range for the maximum in that case. There are many other situations that make calculating a true maximum impossible.
If you want to count slots, here are two ways to do it:
Storage.system.querySlots("").length
or
int count = 0;
var objects = Storage.system.storageObjects;
for (int o = 1; o < objects.length; o++) {
var bays = objects[0].bays;
for (int b = 1; b <= bays.length; b++) {
var levels = bays.levels;
for (int v = 1; v <= levels.length; v++) {
var slots = levels.slots;
for (int s = 1; s <= slots.length; s++) {
var slot = slots;
if (slot.isStorable) {
// You may need to increment the count based
// on slot labels or something
count++;
}
}
}
}
}
// for a script window:
// return count;
.
Jordan Johnson
Principal Software Engineer
>