Every once in a while i get the need to use logic functions in avs, and i can't figure out how to do it with if() above() equal() and below(). I'm sure there are ways to do it but i feel it would save a lot of time and speed if there was logic functions in avs. In case you don't know what logic funtions are, keep reading. I'm not sure if band() bor() bnot() is what i'm looking for but this is what i'm talking about:
The and(var1,var2) function equals 1 when var1 AND var 2 are nonzero, 0 otherwise.
The or(var1,var2) function equals 1 when either var1 OR var 2 are nonzero, 0 otherwise
And the not(var1) function returns 0 if var1 is nonzero and 1 if var1 equals 0.
I don't know why i'm suggesting this, avs isn't going anywhere.
Logic functions
9 posts
band, bor, bnot are what you are looking for 🙂
band(a,b) returns 1 if a AND b are not zero. Otherwise, it returns 0.
bor(a,b) returns 1 if a OR b are not equal to 0. Otherwise it returns 0.
bnot(a) returns 1 if a is equal to 0. Otherwise it returns 0.
Note: logical 1 in these cases is anything other than 0. so:
bnot(22) == 0
bor(0,-10) == 1
band (1234123,12341234) == 1
band(a,b) returns 1 if a AND b are not zero. Otherwise, it returns 0.
bor(a,b) returns 1 if a OR b are not equal to 0. Otherwise it returns 0.
bnot(a) returns 1 if a is equal to 0. Otherwise it returns 0.
Note: logical 1 in these cases is anything other than 0. so:
bnot(22) == 0
bor(0,-10) == 1
band (1234123,12341234) == 1
cool, thanks.
Err this is all explained the evallib help. Click "expression help" in any of the avs components with code.
yeah, but their explained as boolean functions, wtf is a boolean function?
'Boolean' is a word to describe something which can only have two states... typically 1 and 0 in the computer world (the only world you should care about.) By 'boolean function' it just means a function which will return a 1 or 0... so you can use it in if statements ect..
Originally posted by Mr_NudgeAnd the reason why it is called exactly boolean is because the person who invented the boole-algebra was called Boole 🙂
yeah, but their explained as boolean functions, wtf is a boolean function?
And i heard Boole played a lot of pool, which has only two statements: Either your balls are on the table or in the sack.
err... wtf?
err... wtf?
i get it now 🙂