( Diese Seite in
Deutsch )
A variable name can be up to 50 characters long (actually more than 4000 characters in Avisynth 2.56) and can contain letters, digits, and underscores (_), but no other characters. The name cannot start with a digit. A variable's placement in an expression is determined by the ScriptGrammar.
The following types of variables can be used:
clip: a video clip containing video and / or audio. At least one variable for a clip must be used and returned by the script.
string: a sequence of characters representing text. Strings are surrounded either by "quotation marks" or by """three quotes""". A text string can contain any character except the terminating quotation mark or double-apostrophe. The manual used to mention ``TeX-style quotes'', but it has been confirmed that AVISynth doesn't work this way since v1.03. If you need to put a quotation mark inside a string, you need to use [Python-style] three quotes. For example: Subtitle("""AVISynth is as they say "l33t".""") Alternately, you can use Windows extended-ASCII curly-quotes instead of straight quotes to get around this limitation.
int: integers are entered as a sequence of digits, optionally with a + or - at the beginning. Integers can be given in hexadecimal by preceding them with a $. For example, $FF is equivalent to 255.
float: floating-point numbers are entered as a sequence of digits with a decimal point (.) somewhere in it and an optional + or -. For example, +1. is treated as a floating-point number.
val: a generic type; used for function parameters that can be of type int, float, bool, string, or clip.
bool: boolean values must be either true or false.
global: declares a global variable which can be used by all user-defined functions and the main script also.
To declare a variable, simply type the variable name, followed by '=' (an equals sign), followed by its initial value. The type should not be declared; it is inferred by the value assigned to it. Global variables should be prefixed by the keyword "global."
Examples:
b = false # this declares a variable named 'b' of type 'bool' and initializes it to 'false'
x = $100 # type int (initial value is in hexadecimal)
y = 256 # type int (initial value is in decimal)
global f = 0.0 # type float declared globally