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

[JASS] Or/And functions bugging out

Status
Not open for further replies.
Level 12
Joined
Aug 20, 2007
Messages
866
I created this extremely simple boolean expression in JASS to check for the Y position of a specific knight:

JASS:
function IsUnitInBlock2 takes nothing returns boolean
    local real Y = GetUnitY(gg_unit_hkni_0001)
    if And(Y <= 11650, Y > 13430) then
      return true
    endif
    return false
endfunction


But for some reason, it just refuses to f*cking work
I checked with the JassCraft, and it says the And() function looks like

JASS:
function And takes boolexpr operandA, boolexpr operandB returns boolexpr

....

Same situation with the 'Or' function

Could somebody help me out? (btw, the code worked fine before I added the 'And')
 
Level 12
Joined
Aug 20, 2007
Messages
866
Hmmm

Really?

Damn, hold on lemme go try that out...


AWW FFS!!!
It worked, but I still feel like a schmuck :sad:

Thnx for the help, btw I knew what boolexpr ment :pal:

+rep :thumbs_up:
 
Level 6
Joined
Jun 30, 2006
Messages
230
And() and Or() actually leak as well, Vexorian and some other guy discovered. Well, technically the boolexprs they use leak, but if you avoid And()/Or() it is no problem. It isn't that important because as of now there is no reason to use them. Doing it the way mentioned here works better because there are no function calls.
 
Level 12
Joined
Aug 20, 2007
Messages
866
Yeah

I was playing around with JASs a bit (makin a foots map) and I noticed the boolexpr is all over the place, it makes alot of sense, except for this part

DestroyBoolexpr()

Which makes no sense to me whatsoever (at the same time I can't get the boolexprs to work anyways, so for now I will stick to If/Thens)

Btw/OffTopic. The function that I tried using was a trigger that keeps the unit who builds the town hall within a defined rect/region, the boolexpr was to check that the unit leaving was in fact a builder, but for some reason the return values were incorrect, so I just used the TriggerAddCondition()
 
Status
Not open for further replies.
Top