Is there some way of getting data on group.* contents? Which objects are in which group?
Is there some way of getting data on group.* contents? Which objects are in which group?
Are you talking about qualifiers?
I'm not aware of any direct support for something like that, but you could jury rig a kind of "tagging" system using alterable strings and string parser.
So like, you have some tagging events like this:
Flag 0 of Group.Enemy is OFF:
Set Alt. String A(Group.Enemy) to Alt. String A(Group.Enemy) + "Enemy,"
Set Flag 0 of Group.Enemy to ON
Flag 1 of Group.Bullet is OFF:
Set Alt. String A(Group.Enemy) to Alt. String A(Group.Enemy) + "Bullet,"
Set Flag 1 of Group.Bullet to ON
Etc for all the relevant qualifiers. Then when you want to test which qualifiers an object belongs to:
set$( "String Parser", Alterable String A ( >Some Object< )) + listFind( "String Parser", "Enemy", 1) > 0
This would check if the Enemy tag is in the string of Some Object and thus if Some Object is in Group.Enemy![]()
Yes, qualifiers - group.good [and how I wish I could rename them :]
Interesting idea gastrp0d. At first glance it looks like I have to test each object by name. Hmmm. If there are 100 objects (or more) I would need to auto build a list somehow. I will ponder. Thanks.
This method avoids any centralised management of group data. It builds the info ground up on a per-object basis. Essentially every object that belongs to any qualifier ends up with, say, alterable string A listing all the qualifiers that object is in. Ie their strings resemble something like this:
"Enemy,Bullet,PhysicalObject,"
"Door,ForegroundScenery,Neutral,"
etc
The first 2 events in my previous post were examples of events that help build these little lists. You would need such an event for each qualifier you need to consider. Each one would poll its own flag of the object. The flags track whether we have added that particular qualifier to the personal list of the object (flag 0 for Enemies, flag 1 for Bullets in the example).
String parser breaks these strings up based on where the commas are placed and treats them as lists. Then it iterates through that list and looks for the key you feed it (in the example in my previous post the key was "Enemy"). The neat thing is it does all of this in a single condition:
set( "String Parser", Alterable String A ( >Some Object< )) - This tells string parser to use Some Object's alterable string A as the string to parse. EDIT: Sorry there is a small error in my previous post, I wrote set$ instead of set. The different is set$ returns an empty string, set returns 0. The idea is you can put this in an expression and just add it to the rest of the expression and it has no effect on it - it's sole purpose is to update the source string of string parser INSIDE a condition.
listFind( "String Parser", "Enemy", 1) - This iterates through the given string and looks for the key "Enemy". If it finds the key it returns the position in the list of the key, so if we see if this value is greater than 0 it must mean the list contains the key SOMEWHERE in there, thus Enemy must be one of the qualifiers the object belongs to.
To reiterate, you are testing for the existence of "tags" - string keys in a list that is built for the object based on what qualifiers the object belongs to.
I hope I've explained that well enough.![]()
A very generous reply gastrop0d - thanks.
I will see if I can turn it into a working model.
Any chance that you already have one?