FIXED: td.run method isn't accepting args

I was extremely happy to find the td.run() method today. I’m not sure how long it’s existed but it will definitely be cleaner that using always using DAT.run() to delay commands. Bonus!

Seems though it won’t take arguments as described by the wiki. This works:

script = \ ''' print('Hello') print('This is a Delayed Script,') print('executed by the td.run method') print('Goodbye') ''' run(script, delayFrames = 60)

but this returns td.error: Invalid or type of arguments :

[code]hello = ‘Hello’
goodbye = ‘Goodbye’

script =
‘’’
print(args[0])
print(‘This is a Delayed Script,’)
print(‘executed by the td.run method’)
print(args[1])
‘’’
run(script, hello, goodbye, delayFrames = 60)[/code]

maybe I have something wrong?
thanks
Keith

Hi Keith.
The args are only defined in the context of a DAT run, not the td.run() function unfortunately.
Since its only running one self contained script, why not do something like:

script =
‘’’
args = [‘Hello’, ‘Goodbye’]
print(args[0])
print(‘This is a Delayed Script,’)
print(‘executed by the td.run method’)
print(args[1])
‘’’

Actually on further thought, you’re using the function as advertised.
Turns out it was a minor change, and will be fixed in the next build.

Cheers
Rob.

Awesome thanks Rob. Yeah that was the reason I posted it here…

It’s actually a super useful function. Last I was even able to nest scripts within scripts and delay the children.

thanks!