• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] ForGroup and the Enum Functions

Status
Not open for further replies.
Level 12
Joined
Aug 31, 2008
Messages
1,121
You know, I've benn Jassing for over a six months now.
And there is one thing that is seems like I am never using, and when I do use it, it seems as if I am doing it wrong.
These things are the ForGroup, and more often the Enum functions.
I always see them in scripts, and I have a ok guess at what they do. Can someone clear up my last doubts by shedding a few examples?
 
JASS:
function EnumFunc takes nothing returns nothing
   call BJDebugMsg(GetUnitName(GetEnumUnit())) // Dispalys the picked unit.
endfunction

function main takes nothing returns nothing
    local group g = CreateGroup() // It's better to re-use a global group
                                 // but for the sake of simplicity, I shall do this.
    call GroupEnumUnitsInRange(g, 0, 0, 500, null) // Picks all units withing 500 of Location(0,0)
    call ForGroup(g, function EnumFunc) // Do something with the group.
endfunction
 
Level 12
Joined
Aug 31, 2008
Messages
1,121
Okay, I get the Forgroup part.
What is the first parameter for the GroupEnumUnitsInRange for? Is is storing it to that variable? Is is picking units only in that group for the enumeration? I'm a bit confused there.
Btw, the null part is for a filter, right?
 
Status
Not open for further replies.
Top