TLO question

Norrathian

Lifetime Member
Joined
Jun 7, 2007
Messages
238
Reaction score
52
Points
28
Location
The hills of Tennessee
I've looked over the TLO builder and 2 days looking over macros and info sites and I can't find an answer to this:

1) How can I check if the group has multiple of a particular class?

2a) if I'm in a raid

2b) how can I find how many of a particular class are in a raid?
 
Raid TLO:
TLO:Raid - MacroQuest Wiki

You'll likely need a custom function to return what you're asking for in regards to multiple of a particular class. You could create a function that accepts the class as input and it will return true/false if there are more than 1 of that class in the group/raid. Additionally, you could pass in a class and it will return an integer value representing the number of that class present in the group/raid.

I am 99% sure this will need to be a custom function done in macro (or added to an existing TLO).

Sometimes folks here can offer a better solution/suggestion than what you're asking for. If you can provide us more information on what you're intending on doing with the information you are asking for, we may be able to provide an alternative route if that makes sense.

Here is a rough cut, I didn't test this at all but this should get the point across:

Code:
Sub ClassCount(pClass)
	/declare i int local 0
	/declare counter int local 0
	/declare size int local 0
	/varcalc size ${Group.GroupSize}-1

	/for i 0 to ${size} {
		/if ( ${Group.Member[${i}].ID} && ${Group.Member[${i}].Class.ShortName.Equal[${pClass}]}) {
			/varcalc counter ${counter}+1
		}			
	}
	/next i
/return ${counter}

Some side notes:
Sanitize input, toLowerCase etc for equality etc
This considers players in the group period, but may not be in the zone, etc
Raid would be the same, just use the Raid TLO instead of Group etc
 
Last edited:
The first thing I wanna do is NOT use the Alliance line in mq2melee if there's only 1 of that class - it'd just be wasted endurance/mana.

I know it could be done for zerkers by ${SpawnCount[berserker PC radius 100 zradius 50]}, but I figured there were a better way to do it.
 
The first thing I wanna do is NOT use the Alliance line in mq2melee if there's only 1 of that class - it'd just be wasted endurance/mana.

I know it could be done for zerkers by ${SpawnCount[berserker PC radius 100 zradius 50]}, but I figured there were a better way to do it.

TLO:SpawnCount - MacroQuest Wiki

Spawn Search - MacroQuest Wiki

You could try guildname assuming your raid is limited to a single guild.

you could specify group

Also consider the use of multiline ;

Multiline - MacroQuest Wiki

I'm not sure of how the specifics of how alliance work. But if you're searching for group members you should be able to search ${SpawnCount[berserker group} as opposed to searching for a pc in a radius zradius. If it is a member of the group an you don't want mercenaries considered I suppose you could readd the check for it being a pc. I'm not in game and have uninstalled EQ until I can get around to moving it to my secondary drive as my m.2 is more power than I need to run EQ and also limited on space, however my Hybrid drive has plenty of space lol. But you'll likely want them within range of casting the spell/ability mentioned so the original method likely would be better than checking the entire zone.

If using it for a specific class you can use your previous line but changing out the radius and pc with a group option. However SpawnCount to my knowledge is limited to the zone. You holyshit is going to accept a single if command, but with the use of multiline you could do holyshit0=/if (${Group}) /multiline ; /if (${SpawnCount[berserker group} > 1) /dothethingiwanted ; /if (${SpawnCount[anotherclass group} > 1) /dothethingiwanted ;


etc until you've got each class listed as needed for this particular spell. Basically the holyshit will use some base case to check if it should run the multiline checks at all. IE: I never want to use this if I'm not in a group so I only want to check for group to not equal null or 0, but if it returns something other than null or 0 then try all these lines of code. Obviously this multiline is inherantly flawwed as if there is more than 2 berserker it will fire the command and then immediately check the next class for multiples and if that is also true it will try to fire it again. Worst case scenario would likely be it will attempt to fire something twice that may or may not be ready and tell you a 1 or 2 times that it isn't ready yet. Also, it will always fire it for the class that you list first if it returns true so you would have to prioritize the order you place them in that multiline setup. So if it is more important that the berserker get the buff then they would be listed first, and the second most important one be listed second etc. this would of course assume you're doing it with a holyshit.

Additional checks can be added to each one of course by putting more conditions in the checks with &&, also consider adding the && to check if the skill/ability/item/aa is ready as part of your base case, IE: If I'm in a group and the ability in question is ready then check all these classes for multiples.

For a check on each class you would probably want to know if they already have the buff or not. This would mean targeting them first unless you're using netbots (which I'm unfamilar with). This is clearly a complicated thing to do in a single holyshit and something this technical would require a macro to be effective. Which bring me to my next point. If you don't typically have a macro running at all times then consider making a macro that is fired by this holyshit that will in fact count the members of the group and check them for the buff and target and fire the buff if needed. The macro wouldn't run in a loop and thus just go to a /end once it reaches the end of the sub main()

There's honestly so many ways to handle things like this that sometimes it is hard to know the best way to do things. But as with most things with programming it all depends on individual circumstances and how it would best be handled for you.
 
Last edited: