HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How do boolexpr work?

04-09-2004, 09:48 PM#1
Narwanza
Is anybody willing to help me out here. I don't know how they work, how to define one, or how to use one. Could someone please help me?
04-09-2004, 11:04 PM#2
Grater
Boolexpr = Boolean Expression, basically a function that returns a boolean with some trimmings.

You can learn pretty much everything you need to know by converting a trigger to jass (including an action like "Units owned by player matching condition") and then looking in blizzard.j to see how the function uses the boolexpr, many blizzard.j functions use boolexpr.
04-10-2004, 02:03 AM#3
Narwanza
So on the TriggerRegisterUnitInRange() native, the boolexpr could be used as a condition of such?
Code:
function EXPR takes nothing returns boolexpr
    return (GetUnitId(GetFilterUnit()) != 'ugar')
endfunction

function setup takes nothing returns nothing
    local trigger joe = CreateTrigger()
    call TriggerRegisterUnitInRangeEvent(joe,udg_myUnit,100,EXPR)
endfunction

That wouldn't work though.
04-10-2004, 02:55 PM#4
jmoritz
You need to do:
Code:
call TriggerRegisterUnitInRangeEvent(joe,udg_myUnit, 100, Filter(function EXPR))

Filter is a native function that takes a function (takes nothing returns boolean) and returns a filterfunc. filterfunc extends boolexpr, so you can pass it to any function that requires a boolexpr. You should destroy the filter after use with DestroyFilter. In the case of a trigger, this is usually when your map exits, so there is no need to explicitely destroy it.

http://jass.sourceforge.net/doc/library.shtml has more information about filters.