| 01-19-2005, 11:55 PM | #1 |
I'm trying to add a new feature to Drag and Drop's Bag component. I'd like to allow you to define per bt (bag type) , a requirement function (obviously i'll include a fake always true). since you can't run a function which returns boolean directly I'll need a boolexpr, the question is how do I evulate a boolexpr? Also how would I go about parameters? I'm assuming you can just using TriggeringUnit() etc.? |
| 01-20-2005, 07:52 PM | #2 | |
Quote:
I find it severely hard to believe that NO ONE knows how to use boolexprs. |
| 01-20-2005, 08:34 PM | #3 |
Here is from the common.j: Code:
type boolexpr extends handle type conditionfunc extends boolexpr type filterfunc extends boolexpr //============================================================================ // Boolean Expr API ( for compositing trigger conditions and unit filter funcs...) //============================================================================ native And takes boolexpr operandA, boolexpr operandB returns boolexpr native Or takes boolexpr operandA, boolexpr operandB returns boolexpr native Not takes boolexpr operand returns boolexpr native Condition takes code func returns conditionfunc native DestroyCondition takes conditionfunc c returns nothing native Filter takes code func returns filterfunc native DestroyFilter takes filterfunc f returns nothing native DestroyBoolExpr takes boolexpr e returns nothing Here is a good example of how you would use a boolexpr. You know how you make a trigger event? Well did you know that those conditions are boolexpr? Code:
native TriggerAddCondition takes trigger whichTrigger, boolexpr condition returns triggercondition Do you understand how to use it now? |
| 01-20-2005, 09:41 PM | #4 |
That was worthless. Dude, thats not what I'm asking for, I'm asking how to evalute boolexprs. Why Don't you read I have common.j too. |
| 01-20-2005, 09:46 PM | #5 |
weeaaddar, I once made a function called evaluate boolexpr, it creates a trigger, adds the boolexpr as condition, uses evaluate trigger or whatever that function is called and saves it on a boolean variable which is the return value later. But I'd rather use ExecuteFunc and a dummy SetResult function that saves the boolean on the gamecache. |
| 01-21-2005, 10:10 AM | #6 | |
Quote:
function takes ... returns boolean endfunction |
| 01-21-2005, 02:16 PM | #7 |
I want to store on a variable a boolean returning function. There is no way to run vars of type code directly and get the output. Hence I need to use boolexprs. |
