
#AVISYNTH PORTABLE SERIES#
Instead of making an ugly series of successive conditional assignments using the conditional (ternary) operator, ?:, as in Example 1 below (items in brackets are not needed if you use the implicit last variable to hold the result):Įxample 1 cond ? filter1_1 : filter2_1Ĭond ? filter1_2 : filter2_2Ĭond ? filter1_n : filter2_n They are also useful in Avisynth scripts.Īssume, for example, that after an initial processing of your input video file, you want to further process your input differently (for example, apply a different series of filters or apply the same set of filters with different order) based on a certain condition calculated during the initial processing, which is coded at the value of Boolean variable cond. Indeed, in most programming and scripting languages, block statements are very useful tools for grouping together a set of operations that should be applied together under certain conditions. However, there are specific features of the language allowing the construction of block statements that have remained unaltered to date and probably will remain so in the future since block statements are very useful in extending the capabilities of the script language. 3.3 The do.while and do.until block statementsĪ first glance at Avisynth documentation leaves the impression that aside from function definitions, block statements are not possible in Avisynth script.3.1 The if.else and if.elif.else block statements.2.4 The do.while and do.until block statements.2.3.2 For.Next loop without access to variables in local scope.2.3.1 For.Next loop with access to variables in local scope.2.2.3 Using functions (one function for each block).2.2.2 Using separate scripts as blocks and the Import() function.2.2.1 Using Eval() and three-double-quotes quoted strings.2.1.3 Using functions (one function for each block).2.1.2 Using separate scripts as blocks and the Import() function.2.1.1 Using Eval() and three-double-quotes quoted strings.1.1 Features enabling construction of block statements.
