• 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] silly noob question

Status
Not open for further replies.
Level 13
Joined
Nov 22, 2006
Messages
1,260
JASS:
function Conditions takes nothing returns boolean
    local unit u = GetTriggerUnit()
    if (IsUnitType(u, UNIT_TYPE_HERO) and IsUnitEnemy(u, Player(0)) and IsUnitAlly(u, Player(1)).......) then
        call DoSomething
    endif
    set u = null
endfunction
?


I don't understand, what's wrong with your method? What is it that you don't understand? Just connect booleans with and or or.
 
Level 3
Joined
Aug 15, 2007
Messages
37
I am using JassCraft and when I typed 'and' it didn't color the text. So I thought there was a unique JASS method for it. But I soon realized (using JassCraft anyway) that 'And' was the correct syntax and it is a function (And(boolexp,boolexp)) that returns a boolexp.
Thanks for your reply.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Avoid using And() and Or(), because those functions generate a boolexpr that leaks. The reasong JassCraft didn't highlight it is because it just doesn't have that in it's highlight list (whatever it's called). Better use and and or, it's much simpler to use anyways.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
and/or/not = boolean operators. Compare/change booleans, producing new ones.

And()/Or()/Not() = boolexpr functions. Compare/change boolexprs, producing new ones.

Since you should be working with booleans as much as possible, use and/or/not.

NOTE: They're not functions, they're just... erm, keywords? They're kind've in the same category as 'if' and such. (they're not functions, not variables, parsed by the language, etc, etc)
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
HappyTauren said:
well, all jass scripting programs highlight them same way as if,loop,function,struct etc.

Not every jass scripting program highlights them like that, or at all.

PurplePoot said:
NOTE: They're not functions, they're just... erm, keywords? They're kind've in the same category as 'if' and such. (they're not functions, not variables, parsed by the language, etc, etc)

Of course and/or/not are not functions, I think everyone who isn't a complete jass noob knows that.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Well, he was confusing them with And()/Or()/Not() >_>

Anyways, I don't think the default JassCraft template highlights them at all.

Also, just because they're highlighted the same way doesn't mean they're the same. I mean, programs like JassCraft highlight natives and custom functions the same way ;)
 
Status
Not open for further replies.
Top