Log in

View Full Version : Defined array for variable ?


lisztfr9
27th May 2014, 23:32
I would like to assign different values to variable T, inside a clip :


function toogle(float T) {

return (T<10) ? 30 : (T>20) ? 100 : 15
}

S = ScriptClip(S, "Subtitle(String(toogle(current_frame)))")



This works well, but seems limited to a few changes, isn't there a easier way to proceed ? A dedicated one ? i'm certainly missing something obvious.

Thanks a lot,

L

StainlessS
27th May 2014, 23:47
I assume that your final usage would not be to display toogle() via subtitle, the guys could possibly give better
assistance if they knew what you want to do with the result.
Anyway, take a peek at ConditionalReader().

EDIT: Here: http://avisynth.nl/index.php/ConditionalReader

lisztfr9
28th May 2014, 08:47
Thanks StainlessS, also GScript comes in mind :

if ( condition ) {
statements
}
else if ( condition ) {
statements
}
else if (...) { ... }
...
else {
statements
}

Yes ConditionalReader i will give it a try

L