HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

boolexpr conversion

12-03-2007, 03:25 PM#1
chobibo
Can I convert a function that takes in an arguement (function takes blah x returns boolean) into a boolexpr? Thanks for anyone who answers!
12-03-2007, 03:37 PM#2
Troll-Brain
no a boolexpr can't take arguments, use globals
12-03-2007, 09:49 PM#3
Jazradel
Or the gamecache. But globals are far better.
12-03-2007, 09:55 PM#4
Vexorian
Quote:
Originally Posted by chobibo
Can I convert a function that takes in an arguement (function takes blah x returns boolean) into a boolexpr? Thanks for anyone who answers!
what do you want to use this for?
12-04-2007, 05:14 AM#5
chobibo
I needed it so i could include it to the GroupEnumUnitsInRange function, it requires a boolexpr but I cant supply the required function to give it because the filtering function I made requires 2 arguements( it takes 2 units), I made a workaround myself, just used the if statement to filter units and used null in GreoupEnumUnitsInRange function. I submitted the code I'll add a link if you would want to see it. Here is a piece of that code I needed it for.
Collapse JASS:
function HolyLightfilterenemy takes unit FilterUnit, unit FilterEnemyUnit returns boolean
    return IsUnitType( FilterEnemyUnit, UNIT_TYPE_STRUCTURE) == false and GetWidgetLife( FilterEnemyUnit) > 0.405 and IsUnitEnemy( FilterEnemyUnit, GetOwningPlayer( FilterUnit ))
endfunction
I used 2 GroupEnumUnitsInRange that's why I required the filter to take arguements. I made a workaround by not using a boolexpr, If it's not going to trouble you, can you give me a tip. Thanks.
Edit: I decided to include the link to the code I made so you can see it. Thanks again Click Here!
12-04-2007, 09:15 AM#6
Troll-Brain
use a if inside the function , no ?
12-04-2007, 09:32 AM#7
Malf
GetFilterUnit() is your friend. Actually, it's your best friend in filtering out units in GroupEnum calls.

You can just use globals to pass other things you need.

Translated into your/my native language by yours truly:

GetFilterUnit() ay ginagamit para sa GroupEnum, bale siya yung chinecheck kung ganito at ganyan. Kagaya ng ganito : return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO) I checheck kung hero yung GetFilterUnit() bago I add sa group mo.
12-04-2007, 09:42 AM#8
chobibo
@ Troll-Brain: That was what I did, I used if because I couldn't make a boolexpr.Anyway, thanks for the tip!
@Malf: The problem is there is already a filtered unit, I'll explain the code I made; group units within x range of the caster then heal them for x hitpoints, then "group" enemies within x range of the healed units. there are 2 filtered units, therefore I am unable to use GetFilterunit() function because it will be overwritten. I need to put the unit data into variables to precisely do action to them, I did use filtered units but it can only be used within the first loop.
Pinoy ka pala lols ahahah, sorry english yung reply ko kasi hindi maiintindihan nung iba eh. thanks for helping
12-04-2007, 09:58 AM#9
Malf
Use TWO groups.

One to heal allies, the latter to damage enemies. Voila.
12-04-2007, 10:08 AM#10
chobibo
Ok Malf I'll try your suggestion, good luck to me and thanks a lot to you idol!