• 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.

Boolean & Boolexpr Difference

Status
Not open for further replies.

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
Hi.

I've been trying to make a script but it uses the function GroupEnumUnitsInRect, and it takes a booleanexpr or boolexpr or whatever it is named. Problem is, I do not know the difference between those last two.
I've been using "false/true", and obviously it yells at me that it can't turn one into another.:hohum:

Help is appreciated.
~Thanks for your time. Do not be afraid to answer:smile:
 
Level 2
Joined
Feb 24, 2007
Messages
37
Boolexpr is in this case a filter. For example:

JASS:
function Explode takes nothing returns nothing
call ExplodeUnitBJ(GetEnumUnit())
endfunction
//
function DeadFilter takes nothing returns boolean
return GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) <= 0 
endfunction
//
function YourFunction takes nothing returns nothing
local boolexpr filter = Condition(function DeadFilter)
call GroupEnumUnitsInRect(YourGroup, YourRect, filter)
call ForGroup(YourGroup, function Explode)
call DestroyBoolexpr(filter)
endfunction


This will pick every dead unit in YourRect and makes it explode. If you want all units in a rect then just put null at the boolexpr.
 
  • Like
Reactions: Rui
Level 19
Joined
Aug 24, 2007
Messages
2,888
it wont compile as I know

local filterfunc filter = Filter(function DeadFilter) :/

(bah Im not sure)
 
Level 2
Joined
Feb 24, 2007
Messages
37
You can use both.

Condition:
JASS:
native Condition        takes code func returns conditionfunc

JASS:
type conditionfunc      extends     boolexpr


Filter:
JASS:
native Filter           takes code func returns filterfunc

JASS:
type filterfunc         extends     boolexpr
 
Status
Not open for further replies.
Top