Log in

View Full Version : simple boolean check doesn't work


may24
7th August 2015, 07:54
Hi folks,

I'm writing a small script. Due function declaration I define a variable as: bool "bgBlur"
Now later on in the script I'm checking if bgBlur is true or false:

...
# if bgBlur true
item = (bgBlur == true) ? {
bb_left = pic.Crop(0,0,100,0)
bb_right = pic.Crop((pic_x + 100),0,0,0)
StackVertical(bb_left,pic,bb_right)
} : {
Overlay(bg_img,pic,padding,0,mode="Blend",opacity=1)
}
...


But Avisynth complains with a syntax error right after the "(bgBlur == true)" ...
But I can't see an error here ...
Block statements should be possible (http://avisynth.nl/index.php/Block_statements) !

Gavino
7th August 2015, 08:41
If you read that link, you will see that the standard Avisynth syntax does not support block statements in that way.

You need to use either Avisynth+ or the GScript plugin.

However, even then, you would have to write it this way:
if (bgBlur == true) {
bb_left = pic.Crop(0,0,100,0)
bb_right = pic.Crop((pic_x + 100),0,0,0)
item = StackVertical(bb_left,pic,bb_right)
} else {
item = Overlay(bg_img,pic,padding,0,mode="Blend",opacity=1)
}
as a block statement is not an expression.

may24
7th August 2015, 08:59
ya ... I overread this part ...
I solved the problem by creating two additional functions that I can mutually call

Thanks anyway :)