HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to pass variables to filterfunc or callback?

04-26-2008, 07:35 PM#1
EnderA
I am trying to do something to a specific subset of units. I would like to pass variables on to the filterfunc or the callback code, is there any way to do so besides using global variables?

More specifically, I am trying to execute code on units that fulfill all of 3 conditions: 1) in an aoe of a (passed) location, 2) owned by a (passed) player, and 3) of a (passed) unitid.
04-26-2008, 07:59 PM#2
Deaod
you could use gamecache. Dont do it. Use globals instead.
04-26-2008, 09:40 PM#3
darkwulfv
Structs, handlevars, globals. 3 of your quickest solutions.
04-26-2008, 10:02 PM#4
Captain Griffen
Temporary globals are the best way for stuff like ForGroup, etc.
04-27-2008, 12:53 AM#5
EnderA
I decided to instead use CS_EnumUnitsInAOE to get a group of units, then cycle through them with:

Collapse JASS:
local group lNearUnits
//CS_EnumUnitsInAOE to add the units to lNearUnits
local unit lUnit = null
loop
    set lUnit = FirstOfGroup(lNearUnits, lUnit)
    exitwhen lUnit == null
    call GroupRemoveUnit(lUnit)
    //code to execute
endloop

I was stuck on how to execute code on each of the units in a group. This lets me do so, while circumventing the restrictions of ForGroup.
04-27-2008, 01:47 AM#6
grim001
You can do that with GroupEnumUnitsInRange/Rect etc, doesn't need Caster System
04-27-2008, 01:51 AM#7
Vexorian
Unless ... you'd like it to consider collision size