Log in

View Full Version : confirmation of how to set defaults in user-defined functions


Katie Boundary
24th May 2020, 22:26
(Stainless's inbox is full so I have to post this openly)

So let's say I wanted to create a function, "KTFM", which is basically TFM, but with my preferred cthresh, mthresh, MI, blockx, and micmatching values. Let's also say that I wanted KTFM to allow the user to override my preferred settings for the first four of these, but always match from the non-dominant field, and lock the user out of micmatching and all other TFM parameters. If I understand correctly, it would look something like this?

function ktfm(clip c, int "peanut", int "butter", int "jelly", int "time")

{
c

underpants = (GetParity) ? 0 : 1

peanut = Default(peanut,1)
butter = Default(butter,20)
jelly = Default(jelly,4)
time = Default(time,2)

tfm(field=underpants, cthresh=peanut, MI=butter, blockx=jelly, mthresh=time, micmatching=0)

StainlessS
24th May 2020, 23:07
Looks about right, although you missed off at least the last brace, end of function.

Best place to start is the wiki:- http://avisynth.nl/index.php/Main_Page
Read ALL entries after "Your first script", we all have had to do it.
(Also, every now and then not a bad idea to go back and re-read the lot again, see if anything has been added).

Katie Boundary
24th May 2020, 23:59
"After" is meaningless when the pages aren't in any kind of order or organizational structure.

StainlessS
25th May 2020, 00:16
I meant all headings under that, but,
See MediaFire under this post, DATA folder, AvisynthEngHelp+SDK26_FINAL-2015-05-31.zip.
Is compressed help file (CHM), also has a table with entries for all the component HTML parts that make up the CHM.
So you can visit each page, and know for sure that you've read the lot (instead of going around and around following links).

Here part of the table:
https://i.postimg.cc/HVZ7dFmb/Untitled-01.jpg (https://postimg.cc/HVZ7dFmb)

Above for v2.60 std, but that is enough to get you going.