using Boolexprs as code arguments

Romek

Super Moderator
Reaction score
963
No, it isn't.
You can evaluate them during the timer callback function though.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
is there a way to evaluate boolexprs without using a trigger to call the code?
like:
JASS:
function
    if b then
    endif
endfunction


using the same globals as last post
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
thanks that helps

one more question, if i use [ljass]TriggerAddCondition[/ljass] does it overwrite current conditions? or just add to a list of conditions?
 

Laiev

Hey Listen!!
Reaction score
188
Add to a list of conditions.

[ljass]TriggerClearConditions[/ljass] do what you want.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
i wanted to just confirm, i do want to add to a list of conditions rather than remove them
 

Bribe

vJass errors are legion
Reaction score
67
Yeah Adding condition adds to a list. Removing it removes it from the list while interrupting the evaluation if it is currently being evaluated. And like he said TriggerClearConditions notice that it is plural, because it clears all the conditions.

One shred of history for you is this: we used to be able to pseudo-store code into arrays:

JASS:
globals
    private integer array myCodeArray
endglobals

function I2C takes integer i returns code
    return i
    return null
endfunction

function C2I takes code c returns integer
    return c
    return 0
endfunction

function SaveCodeToIndex takes integer index, code c returns nothing
    set myCodeArray[index] = C2I(c)
endfunction

function RunCodeFromIndex takes integer index returns nothing
    call ForForce(bj_FORCE_PLAYER[0], I2C(myCodeArray[index]))
endfunction


Petition Blizzard if you want "code array" to be supported in JASS. [email protected]
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
how about use [ljass]GroupEnumUnitsInRange[/ljass] and using the filter there as an arguement
IE:
[ljass]call GroupEnumUnitsInRange(bj_lastCreatedGroup, GetUnitX(u), GetUnitY(u), 1.0, CodeVar[GetUnitId(u)])[/ljass]

then using [ljass]GetFilterUnit()[/ljass] to reference that unit, basically calling the code for that unit and using that unit as an argument

PS: ya i saw that, cool idea, but the fact that they removed it is wack
 

Romek

Super Moderator
Reaction score
963
That method's not at all better than using triggers to evaluate the filters.
Points for creativity, though it just causes more problems than it solves.
 

Bribe

vJass errors are legion
Reaction score
67
I was thinking of a [ljass]GroupEnumUnitsOfType(group, "custom_bxpr", boolexpr)[/ljass] with only one unit of that name on the map.

I don't know if that is gonna be faster than TriggerAddCondition/TriggerEvaluate/TriggerClearConditions. But in theory it sounds like it should be faster because you're not needing to generate the condition handle each time.

Trigger + boolexpr is suckage. I hate having to do that, and I hate that function interfaces makes copies of the code being evaluated. Triggers require a trigger per boolexpr, two arrays instead of one, double handles and worst of all, planning (ew).
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
Trigger + boolexpr is suckage. I hate having to do that, and I hate that function interfaces makes copies of the code being evaluated. Triggers require a trigger per boolexpr, two arrays instead of one, double handles and worst of all, planning (ew).

i know... iv been banging my head against the wall trying to figure out a better way to do it, how does [ljass]GroupEnumUnitsOfType[/ljass] work to use [ljass]GetFilterUnit()[/ljass] if you use [ljass]"custom_bxpr"[/ljass] as the unit, doesnt it just make that unit the filter unit?
 

Bribe

vJass errors are legion
Reaction score
67
You don't use GetFilterUnit, you simply use it to evaluate a boolexpr.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
oooh i see
has it been tested... can it work without using a real unit
and even if it hasnt cant you just make an import file with the unit for any system that will use it?
 

Bribe

vJass errors are legion
Reaction score
67
Well you must create a single unit with that raw code of course.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top