# EE: channels locking/unlocking each other?

**URL:** https://forum.highend3d.com/t/ee-channels-locking-unlocking-each-other/785
**Category:** Maya
**Tags:** mel
**Created:** [February 8, 2010, 9:53pm UTC](https://forum.highend3d.com/t/ee-channels-locking-unlocking-each-other/785 "2010-02-08T21:53:53Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mark-heutink](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/m/b487fb/32.png) [@mark-heutink](https://forum.highend3d.com/u/mark-heutink)
#### Post date: [February 8, 2010, 9:53pm UTC](https://forum.highend3d.com/t/ee-channels-locking-unlocking-each-other/785/1 "2010-02-08T21:53:53Z")

</div>

Hi there,

I have a question;   
is it possible to create an expression which ensures that when the value of a certain channel is \< then X a different channel will stay locked.

For example, I have these 2 channels;  
&nbsp;&nbsp;&nbsp; If the 1st channel, called "eyes\_digits" (Float: min val 0, max val 10), \< 10,   
&nbsp;&nbsp;&nbsp; the second channel called "eyes\_expressions" (Enum: 6 possibilities) is locked.

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Else, if channel "eyes\_digits" = 10, (or == 10??)  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; channel "eyes\_expressions" is unlocked.

- I am working in the Expression Editor because I want it to constantly check the 'if statement'. 

- I want to use this because the 2nd channel should not be keyable while animating if channel1 is has a lesser value then 10.

My current expression looks like this... It doesn`t update (constantly check) and only works once after 'editing'...   
I am a nooby at scripting, it was just an attempt:) here it is;

//Expression Editor Script Example

if (cc\_expression01.eyes\_digits \< 10) {  
&nbsp;&nbsp; &nbsp;setAttr -lock true cc\_expression01.eyes\_expressions;  
}else{  
&nbsp;&nbsp; &nbsp;setAttr -lock false cc\_expression01.eyes\_expressions;  
}

If anyone could help me out I would really appreciate it!🙂

Thanks in forward,

Mark

---

<div class="post-metadata">

### Author: ![thnkr](https://forum.highend3d.com/user_avatar/forum.highend3d.com/thnkr/32/115_2.png) [@thnkr](https://forum.highend3d.com/u/thnkr)
#### Post date: [February 9, 2010, 3:52am UTC](https://forum.highend3d.com/t/ee-channels-locking-unlocking-each-other/785/2 "2010-02-09T03:52:16Z")

</div>

Expressions only evaluate when the time changes, or when you edit them. You need to use a scriptJob that triggers when an attribute changes.

global proc myProc() {  
&nbsp;&nbsp; &nbsp;if (`getAttr pCube1.translateX` \> 10) {  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;setAttr -lock true pCube1.scaleX;  
&nbsp;&nbsp; &nbsp;}  
&nbsp;&nbsp; &nbsp;else {  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;setAttr -lock false pCube1.scaleX;  
&nbsp;&nbsp; &nbsp;}  
}

scriptJob -ac pCube1.translateX myProc;
