If I create a group in labels.ini, say group ID 5, that group will be available to all scripts.
Groups created at runtime are usually private to the script that creates them, how is the conflict between a shared labels.ini group #5 and a private script group #5 handled?
Example: What if a script then adds some droids to group 5? Does it get it's own group 5 created, meaning it can no longer access the labels.ini group of same number? Are the groups defined in labels.ini listed in groupSizes[] array?
P.S. Sorry for asking so many dumb questions
Groups - labels.ini vs. script ids
Groups - labels.ini vs. script ids
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: Groups - labels.ini vs. script ids
Also, is groupAddArea() still limited to droids owned by the calling script player?
BTW: I'm sure groupAddArea() used to filter out commanders and transports, but looking at the code that doesn't appear to be the case any more?
BTW: I'm sure groupAddArea() used to filter out commanders and transports, but looking at the code that doesn't appear to be the case any more?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: Groups - labels.ini vs. script ids
Label created groups get negative group IDs, and therefore should not conflict with private script groups, which should be using positive integers. Label groups are copied into each instance, so adding and removing members of these groups is fine. You will find them in the groupSizes[] array (yes, even though they have negative indices! javascript is so flexible).
groupAddArea() is still limited to owned droids. For some reason I'm unsure of, the wzscript limitation against commanders and transports is not there.
groupAddArea() is still limited to owned droids. For some reason I'm unsure of, the wzscript limitation against commanders and transports is not there.
Re: Groups - labels.ini vs. script ids
I hope no one will use for (var x; x<array.length; x++) or Array.map for this array.Per wrote:You will find them in the groupSizes[] array (yes, even though they have negative indices! javascript is so flexible).
http://addons.wz2100.net/ developer
Re: Groups - labels.ini vs. script ids
If someone wanted to get all the group ids, including negative ones, the easiest way would be:
In any case, I think having label-based IDs being negative is a good idea, normally you will only want to access them via labels. It also means that groups from labels.ini don't start appearing in normal iterations of groupSizes array. So I think the way Per has implemented it works really well.
Code: Select all
var groupIDs = [];
Object.keys(groupSizes).forEach( function isGroup(key) {
if (typeof key== "number") groupIDs.push(key);
} );
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO