Hi could anyone please point me to why the ‘udpoutOP’ local variable is fine when used as such in an Execute DAT but the ‘frameCounter’ variable gives me an uninitialized error?
# me - this DAT # # frame - the current frame # state - True if the timeline is paused # # Make sure the corresponding toggle is enabled in the Execute DAT. updoutOP = op('udpout') frameCounter = 0 def onStart(): frameCounter = 0 return def onCreate(): return def onExit(): return def onFrameStart(frame): numFrames = me.parent().par.Pulseinterval frameCounter += 1 if (frameCounter > numFrames and me.parent().par.Enable): updoutOP.send(me.parent().par.Messagestring) print("sending") frameCounter = 0 return ...
gives the error:
UnboundLocalError: local variable 'frameCounter' referenced before assignment
I am an experienced interactive software developer coming from C++, C#, Js and Python. I’m trying to navigate the TD flavour of Python which seems very idiomatic and full of ‘quirks’. Any help would be appreciated. Thanks