Page 1 of 1
Code question
Posted: Sat Apr 02, 2011 9:55 am
by The Midi Thief
I wonder if there is a way to stop an incoming keyword from being executed? I attempted to do a lock layer module but if I try to force ctrl_layer_position_x to a certain value every time a locked layer is moved Modul8 crashes.
Posted: Sat Apr 02, 2011 11:08 pm
by Lupin
if i understand your kung fu, of course it crashes
when you set modify a keyword inside the KeywordEvent block, you create a deadly endless loop that drains you toward a developper Black hole hehe.
you'd rather force to reposition your media within the elapsed block with a xlock variable for instance though its not really elegant.
remember, do Never scope and change the same keyword in the Keyword event block or if you do that to prevent from crashing, use the Try/except python statement:
have a look at
http://www.java2s.com/Code/Python/Langu ... cs/Try.htm
or
http://docs.python.org/tutorial/errors.html
good luck
Posted: Sun Apr 03, 2011 11:38 am
by The Midi Thief
Ah, your kunfu style will defeat mine! Of course, I never attempted to do something this foolish before. Or... oh well I have but lets not talk about that now. I have to dig in to that module again. I agree about doing the movement in the periodical block not being very elegant but it's the only way to go as far as I know. Thanks for the tips!
Posted: Sat Jul 02, 2011 3:06 am
by ghostofelvis100
Init:
Keywordlock = True
-——-—
Keyword:
if keyword == 'ctrl_layer_position_x' and Keywordlock:
Keywordlock = False
modul8.setValue('ctrl_layer_position_x',0,0)
Keywordlock = True
No need to invoke elapsed.