Hi all,
In DATs Text, can I write a expression in run?
For exmaple:
op(‘text1’).text = ‘abc’
run(op(‘text1’).text = ‘abc’, delayFrames = 300)
It will make an error with
Hi all,
In DATs Text, can I write a expression in run?
For exmaple:
op(‘text1’).text = ‘abc’
run(op(‘text1’).text = ‘abc’, delayFrames = 300)
It will make an error with
the runs
object expects a string or a DAT. For example:
Passing a string to be evaluated:
delayScript = "print('abc')"
run(delayScript, delayFrames=10)
You could also point to a whole operator that you’d like to use:
op('text2').run(delayFrames=10)
The runs
object can also accept arguments:
delayScript = "print(args[0])"
run(delayScript, "hello World", delayFrames=10)
In another DAT:
op('text2').run("hello World", delayFrames=10)
If you wanted to change the text in another DAT, you’d do something like:
delayScript = "op('text2').text = 'TouchDesigner'"
run(delayScript, delayFrames= 10)
Thank you reganmd!
how about I want to change the text with a variable?
m = ‘something’
delayScript = "op(‘text2’).text = " + m
run(delayScript, delayFrames= 10)
I will get the error with nameError: name something is not define
in this case you want to pass an arg to your delay script:
delayScript = "op('text2').text = args[0]"
something = 'TouchDesigner'
run(delayScript, something, delayFrames= 10)
I see,
Big Thanks!!! it works