VideoHelp Forum
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    In AVIsynth, what is the equiv of for/next or repeat/until or do/while or whatever

    I need run several selectevery() but based on a value or else a condition--switch to diff select, etc. It should be simple, i hope.

    i.e.


    REPEAT

    a = select(1)
    b = select(2)
    int counter = 0

    inc(counter); if counter>1 then counter=0
    if counter=0 then do a else b

    UNTIL last_frame_found


    ..throughout the entire clip..

    I searched, but http://avisynth.org/mediawiki/Special:Search?search=repeat&go=Go
    seems to leave me beleaving there is no function or can not be done, so there must be some technique not yet discovered/used, I don't know.

    I may turn it into a function, just not sure at this point, mainly debugging different ideas .. thanks for any leads.

    -vhelp 5369
    Last edited by vhelp; 30th Apr 2010 at 00:15.
    Quote Quote  
  2. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    In standard Avisynth, there is no looping in the script language - you have to do it using recursive functions.
    The GScript plugin provides while/for loops as language extensions (also if/then/else blocks).

    Note however that explicitly looping over all frames in the script is probably a bad idea, for performance reasons. For doing frame-dependent processing, it is better to use the ScriptClip function, which allows arbitrary script code to be run at each frame during rendering.
    Quote Quote  
  3. Member
    Join Date
    Nov 2009
    Location
    United States
    Search Comp PM
    Can't you just combine each selectevery into 1 selectevery?

    if selectevery(a) is selectevery(5,0,3) and selectevery(b) is selectevery(4,1,3), just combine them to selectevery(9,0,3,6,8).
    Quote Quote  
  4. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    update -- I know its been a while since i first posted the question, but .. unfortunately, gscript doesn't work on my system. "not an avisynth 2 C" error. Anyway, it must be a version problem, i'm running v2.57 so i'll assume that's the cause.

    I found these twp pages on this plugin but didn't see this error reported there.

    http://forum.doom9.org/showthread.php?t=147846
    http://forum.doom9.org/showthread.php?t=147846&page=2

    ah, found v2.5.8, downloading now..

    file: http://www.afterdawn.com/software/general/download.cfm/avisynth?mirror_id=0&version_id...oftware_id=476

    edit: turns out i used the loadplugin incorrectly..anyway, now have v2.5.8 running w/ GScript but can't seem to get it to do what I was trying to-to simulate the above first post--just yet.

    -vhelp 5373
    Last edited by vhelp; 8th May 2010 at 00:32.
    Quote Quote  
  5. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by vhelp View Post
    now have v2.5.8 running w/ GScript but can't seem to get it to do what I was trying to-to simulate the above first post--just yet.
    Post your script and I will take a look.

    Actually, there is a logical error in your earlier pseudo-code:
    REPEAT

    a = select(1)
    b = select(2)
    int counter = 0

    inc(counter); if counter>1 then counter=0
    if counter=0 then do a else b

    UNTIL last_frame_found
    counter is always reset to 0 inside the loop.
    Could this be the problem?
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!