radigast
20th June 2016, 03:36
I have a script I am working on that overlays video information onto screenshots. The function basically allows the user to input 2 unique lines of text and also asks for a color input for the text overlay. myFFInfo2("Text1","Text2","Color") I am running AviSynth 2.6.0.6.
The issue I am having is that I'm not sure how to change the text_color to the user input value (textcolor). Basically, I want the linereturn scriptclip("subtitle(fftempstring, lsp = 1, text_color=colorinput)", after_frame=true)to have text_color=color_input. As it stands, I currently receive an error that says Script error: the named argument "text_color" to subtitle had the wrong type ([ScriptClip], line1)Does anybody have any suggestions how to achieve this?
The entire code is as follows. I have verified that a user input of yellow for "colorinput" indeed gives color_yellow as the value in the script (which fits the proper formatting http://avisynth.nl/index.php/Color_presets), but the script errors when text_color=colorinput. Manually changing colorinput to color_yellow makes the text overlay yellow.
function myFFInfo2(clip c, string "bonusText", string "altText", string "colorinput") {
varprefix = FFVAR_PREFIX
bonusText = default(bonusText, "")
altText = default(altText, "")
colorinput = default(colorinput, "")
c.frameevaluate("""
fftempstring = ""
varprefix = """" + varprefix + """"
bonusText = """" + bonusText + """"
altText = """" + altText + """"
colorinput = """" + """color_""" + colorinput + """"""")
frameevaluate("""fftempstring = fftempstring + "Frame Number: " + string(current_frame) + " of " + string(framecount()) + "\n" """, after_frame=true)
frameevaluate("""fftempstring = fftempstring + "Type: " + chr(eval(varprefix + "FFPICT_TYPE")) + "\n" """, after_frame=true)
frameevaluate("""fftempstring = fftempstring + bonusText + "\n" """, after_frame=true)
frameevaluate("""fftempstring = fftempstring + altText """, after_frame=true)
return scriptclip("subtitle(fftempstring, lsp = 1, text_color=colorinput)", after_frame=true)
}
The issue I am having is that I'm not sure how to change the text_color to the user input value (textcolor). Basically, I want the linereturn scriptclip("subtitle(fftempstring, lsp = 1, text_color=colorinput)", after_frame=true)to have text_color=color_input. As it stands, I currently receive an error that says Script error: the named argument "text_color" to subtitle had the wrong type ([ScriptClip], line1)Does anybody have any suggestions how to achieve this?
The entire code is as follows. I have verified that a user input of yellow for "colorinput" indeed gives color_yellow as the value in the script (which fits the proper formatting http://avisynth.nl/index.php/Color_presets), but the script errors when text_color=colorinput. Manually changing colorinput to color_yellow makes the text overlay yellow.
function myFFInfo2(clip c, string "bonusText", string "altText", string "colorinput") {
varprefix = FFVAR_PREFIX
bonusText = default(bonusText, "")
altText = default(altText, "")
colorinput = default(colorinput, "")
c.frameevaluate("""
fftempstring = ""
varprefix = """" + varprefix + """"
bonusText = """" + bonusText + """"
altText = """" + altText + """"
colorinput = """" + """color_""" + colorinput + """"""")
frameevaluate("""fftempstring = fftempstring + "Frame Number: " + string(current_frame) + " of " + string(framecount()) + "\n" """, after_frame=true)
frameevaluate("""fftempstring = fftempstring + "Type: " + chr(eval(varprefix + "FFPICT_TYPE")) + "\n" """, after_frame=true)
frameevaluate("""fftempstring = fftempstring + bonusText + "\n" """, after_frame=true)
frameevaluate("""fftempstring = fftempstring + altText """, after_frame=true)
return scriptclip("subtitle(fftempstring, lsp = 1, text_color=colorinput)", after_frame=true)
}