PCs in Zone

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

NotSoCSharp
a ghoul
a ghoul
Posts: 85
Joined: Sat Oct 25, 2003 10:48 am

PCs in Zone

Post by NotSoCSharp » Wed Dec 03, 2003 9:03 am

Is there anyway to count the number of PCs in the zone. I have this requirement for a macro I am working on.

Thanks!

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Thu Dec 04, 2003 7:54 pm

Don't know if there's a better way but you could always loop through $searchspawn(pc)..

Something like this (just to give you an idea, not tested):

Code: Select all

/declare pccounter local
/declare currentpcid local
/declare lastpcid local
/varset currentpcid 0
/varset pccounter 0

:pcloop
/varset lastpcid @currentpcid
/varset currentpcid $searchspawn(pc,next,id:@lastpcid)
/varadd pccounter 1
/if @currentpcid!=@lastpcid /goto :pcloop

NotSoCSharp
a ghoul
a ghoul
Posts: 85
Joined: Sat Oct 25, 2003 10:48 am

Post by NotSoCSharp » Fri Dec 05, 2003 8:08 am

Thanks a ton! I will give it a try.