Help me understand arrays better

Id love to get some quick schooling on this.

I already read up what i could find so far but the level of understanding i have so far is a bit low still.

Im a bit confused on how conflicts can occur, crashes or things not working out.

-Question1:
can i store 10 effects at Gvar,E at index 1,2,3-10,
Then instead of storing more effects at 11,12,13 etc i jump up to index 500, and store more stuff from there?
Trouble explaining, but if i have a huge empty gap in Gvar,E index, where i store effects at index 1-10, and then more effects at 500-510 for example.
Will this cause extra load, or other troubles?
Does the system look through every number 1 by 1 or does it instantly skip to the specified number if an request is done?

-Question2:
If i have a rule that sets many variables at vectors
To use, for example Gvar,E. 1-50.
At the same time i also have separete rules that look for players near these vectors or in radius.
How do i forexample disable Gvar,E,25 (vector)
When i dont need it anymore in game?
And if i did so, would it make the rule that is checking my distance to this vector, stop checking for it if the vector was removed?

-Question3:
Should value in arrays not needed anymore always be removed if it is a vector, effect or anything else?
Or is it not an impact on the server as long they are not being requested?

-Question4:
How does “filtered array work”?

-Question5:

Any tips, time saving, organizing, reducing load, being smart?

-Question6:
If i made a gamemode where soldier had to walk around the map and collect 10 orbs,
I would,
Set Global var A at index 1-10 where each index is the value vector for each orb.

Then i would have another rule with 10 effects where their position was Variable A at index 1-10
Which i just set as vector.

When 1 orb is picked up, how would i now treat the values i set in the array?
Ofc i would delete the orb effect.

But any example on how this should be done properly or in a best possible way?

-Question7:
Set variable at index / append to array?
How can i know where i got stuff stored?
I just use “set variable at index”, is it a bad idea?

Any other help on how to understand the bigger picture is appreciated.

I think you figured this out already. If not, Yes it does.

Depends on the action. If you just want to have the value at index its a direct access, so the array size doesnt matter. If you do something like “is true for any” or “sorted array”, the system indeed needs to address every value in the array onces - in the best case! If the array size is n, it takes n * log(n) steps to sort the array.

Remove it by setting the value to number(0).

No.

Might be faster for the server to fail the action that checks for the vector if you replace the vector with something that is not a vector (e.g. with just 0).

As the condition property I suggest to use the “compare()” action and the “current array element”.
Example: filtered array(all players(all teams), compare(player variable(current array element, A), <, 3))
This array contains all players whos variable A is smaller than 3.

No.

“Set variable at index” sets the value at a specific index into an array. This is useful if you use a static array, for example the list of vectors you use for the orbs. They are always 10. You can address them directly and imagine them as orb1, orb2, … , orb10.
“append to array” is meant for dynamic array usage. For example, you have an array of all the players in your mode. If a player joins, you append him to the array, if he leaves, you remove him. Note that the players dont have a set index. Their index in the array can change if a player gets removed from it. So this is better to use if you have a variating amount of things to store and dont need to address them directly.

wow! Thanks a TON!!!

and to clear up one last bottleneck, how can i completly disable a rule while playing?

I have a rule that uses Distance between, thats not needed anymore.
That rule also have a Variable condition, which later during game is supposed to be turned to “FALSE” to deactivate the actions, however as you said, even though it doesnt do actions anymore, it still there causing extra load.

Except for the condition that gets false I only have the idea to add the same condition to a “skip if” action and under that you put a wait(99999) action, cause this will prevent the rule from being executed again.