I'm betting this has a simple answer, but this is my first step into advanced scripting and I don't really know what I'm doing. And generic apologies over putting this here, it crosses a few topics and I wasn't entirely sure where to put it.

So I captured some game footage in 1080i since that is the highest my capture device supported. As it turns out though movement only happens every full frame and not in every field, so by weaving I can produce a 1080p frame. Awesome. The only issue is then that the game doesn't keep track of keeping it all the same. For example given, 0a 0b 1a 1b and so on; the fields to be weaved might end up like this (0a 0b) 1a (1b 2a) (2b 3a). So I opted for use of the ConditionalFilter like so.
Code:
vid = DirectShowSource("D:\recording\Capture\vid.m2ts").AssumeTFF().SeparateFields().DoubleWeave()
vide = vid.SelectEven()
vido = vid.SelectOdd()
ConditionalFilter(vide, vido, vide, "IsCombed()", "equals", "true", show=true)
Which was close, but I got a lot of double true and double false results, so I needed something more in depth than just changing the threshold on IsCombed.
Code:
vid = DirectShowSource("D:\recording\Capture\vid.m2ts").AssumeTFF().SeparateFields().DoubleWeave()
global vide = vid.SelectEven()
global vido = vid.SelectOdd()
ConditionalFilter(vide, vido, vide, "CombedLess(vide, vido, 0)", "equals", "true", show=true)

function CombedLess(clip a, clip b, int pass)
{
    global c = false #create test variables
    global d = false
    ScriptClip(a,"c = IsCombed(a,pass)") #is each frame combed? 
    ScriptClip(b,"d = IsCombed(b,pass)")
    rv = ((c&&d)&&(pass<255)) ? CombedLess(a, b, pass+1) : c
    return rv #if both are combed and the pass is in bounds, run again with higher threshold, else return bool of first clip combing
}
Not pretty and it abuses globals, but I don't mind for personal use. But this just returns false every single time, meaning that it is bottoming out and being caught by the pass limit (further evidenced by the whole thing crashing if I remove that). I'm thinking that means I'm using ScriptClip or IsCombed wrong within my function, probably in feeding it a whole clip instead of a frame, but I don't know how to fix that. Any suggestions?