• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

I want some explaination :)

Status
Not open for further replies.
Level 3
Joined
Apr 21, 2012
Messages
33
Well, I just got a little bit confuse about boolexpr. I don't understand this thing, so may I ask someone of you to explain it to me? Thanks
 
Level 18
Joined
May 11, 2012
Messages
2,103
BoolExprs are objects that store a function or more and are meant to return a boolean value through these functions. They are used in GroupEnum-functions for example to filter out unwanted units. They are a way of dynamically passing/calling code.

Here is an API for them. And, Not and Or create new boolexprs from other ones and you can also take a look into the children types conditionfunc and filterfunc (which are practically the same). They also have constructors but do not produce a new instance each time, only one per function, so that recycles.

Widget is the parent type of destructable, item and unit, virtually these are interactive objects in the 3d environment with life. There are some functions for them.

I do not get your second question. You want to know what the parameters mean in various functions? Well, I doubt you will find a complete list but most is obvious from name and context, else ask for the specific.
 
Level 3
Joined
Apr 21, 2012
Messages
33
Hmmm.... I have only 1 question, what is boolexpr?? I don't know that.
And I still don't get this, can you explain it a little more detailed? May be add some code example ??

Thanks foe help anyway.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Means you create a condition function that returns a boolean and you call it as a boolexr
JASS:
function ConditionBoolExpr takes nothing returns boolean
    return IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)
// Credits to Adiktuz for remembering me it was GetFilterUnit() instead of GetMatchingUnit()
// Credits to Luorax for clarifying that the function has to be inside a Filter()
endfunction

function Action takes nothing returns nothing
    call GroupEnumUnitsInRange(g, radius, x, y, Filter(function ConditionBoolExpr))
endfunction

That would Enum Units in Range that matches that condition (UNIT_TYPE_DEAD) and exclude the others. It's the equivalent to "Pick every unit in region MATCHING CONDITION". That MATCHING CONDITION is the boolexpr function.

You can also set the boolexpr as "null" and exclude the units inside the loop with an if/then/else

<< EDIT >>

Thanks to Adiktuz for the tip. It's "GetFilterUnit()" :) Here
Thanks to Luorax for clarifying that code can't be turned to boolexpr directly. Here
 
Last edited:
Level 16
Joined
Aug 7, 2009
Messages
1,403
Means you create a condition function that returns a boolean and you call it as a boolexr
JASS:
function ConditionBoolExpr takes nothing returns boolean
    return IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)
// Credits to Adiktuz for remembering me it was GetFilterUnit() instead of GetMatchingUnit()
endfunction

function Action takes nothing returns nothing
    call GroupEnumUnitsInRange(g, radius, x, y, function ConditionBoolExpr)
endfunction

That would Enum Units in Range that matches that condition (UNIT_TYPE_DEAD) and exclude the others. It's the equivalent to "Pick every unit in region MATCHING CONDITION". That MATCHING CONDITION is the boolexpr function.

You can also set the boolexpr as "null" and exclude the units inside the loop with an if/then/else

<< EDIT >>

Thanks to Adiktuz for the tip. It's "GetFilterUnit()" :)

It's actually:

JASS:
function Action takes nothing returns nothing
    call GroupEnumUnitsInRange(g, radius, x, y, Filter(function ConditionBoolExpr))
endfunction

You can't just pass a code type variable and use it as a boolexpr - you have to use the proper native to convert it.
 
Status
Not open for further replies.
Top