Created
October 13, 2013 19:41
-
-
Save rgooler/6966576 to your computer and use it in GitHub Desktop.
LSL population counter within distance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
integer calcPopulation(){ | |
// Setup variables | |
integer population = 0; | |
list avatars = llGetAgentList(AGENT_LIST_PARCEL,[]); | |
// See who is within range of the target | |
integer i = 0; | |
integer total = llGetListLength(avatars); | |
for(i;i < total; ++i){ | |
key avatar = llList2Key(avatars,i); | |
string tmp = (string)llGetObjectDetails(llList2Key(avatars,i), [OBJECT_POS]); | |
vector avatar_at = (vector)tmp; | |
// See how many avatars are near the destination | |
if(llVecDist(DESTINATION, avatar_at) <= DESTINATION_SIZE){ | |
++population; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment