View Single Post
Old 30th June 2011, 10:25   #7  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by johnmeyer View Post
However, as I modified things, some of my attempts involved using outside variables inside the conditional which, as you know, requires them to be declared as global.
Not if you use GRunT.
GRunT will also allow you to replace things like
YDifferenceFromPrevious(selectevery(source, 1, -2))
by YDifferenceFromPrevious(-2) and, as I said, 'source' is unnecessary even without GRunT.
Quote:
I have some vague understanding that "global = bad", but I'm not quite sure what calamity awaits me if I do that.
It's not really a problem here, since your globals are effectively constants and your functions are specific to this particular script. But in more general functions (especially in conjunction with ScriptClip, etc), it can lead to bugs such as the function not working if called more than once. And generally speaking, it's easier to test and understand functions that act as 'black boxes' (the modularity principle).
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote