## y variable?

### y variable?

is there some example with the "y" variable ? When I use it, I get an error message 'undefined symbol"...
skarabee

Posts: 106
Joined: Fri Aug 28, 2015 3:11 am

### Re: y variable?

Can you post a screenshot of that error?
Eric

Posts: 3053
Joined: Wed Apr 09, 2014 9:28 pm

### Re: y variable?

error.jpg (67.7 KiB) Viewed 373 times

Just typed the example expression, but maybe there is something i didn't catch..
skarabee

Posts: 106
Joined: Fri Aug 28, 2015 3:11 am

### Re: y variable?

All definitions are locally defined. If you have not specified what "y" is determined to be, then it will not know what you mean when you make an "if/else y" statement. May I ask what you want "Y" to be? You could create a global parameter called "Yvalue" for instance, and make your argument if(x<0.5,x,Yvalue)
sjdacruz

Posts: 31
Joined: Sat May 30, 2020 4:53 am

### Re: y variable?

In 2.31 the y variable is defined by default.

Are you sure you’re using 2.31 and not 2.3?
Eric

Posts: 3053
Joined: Wed Apr 09, 2014 9:28 pm

### Re: y variable?

That was the case. I did quit 2.31 and relaunched 2.30 using the wrong shortcut. Now the expression work as expected.
Anyway, some examples with the use of the new internal variable y could be fine. my skill with "expression" modifier is near from 0

Edit: I already managed to split the keyboard as Eric suggested (great tip by the way), but I was wondering about other way to use "y".
skarabee

Posts: 106
Joined: Fri Aug 28, 2015 3:11 am

### Re: y variable?

Well, a lot of the existing modifiers in Magic use the y variable internally. For example, if you do an expression with .1x+.9y, then you will get a very smooth response, like the Smooth modifier, because it combines 10% of the new value with 90% of the previous value.

Similarly, if you do if (x > y, x, .1x+.9y), then you get something like the Peak modifier, which uses the following algorithm: if the new value is greater than the previous, output the new one immediately, otherwise output the new one smoothed a bit (with the smoothing being what I described above).

Most users probably won't want to do things like that because the existing modifiers are simpler to use and also time-weighted (to account for changing frame rates, etc.). But I'm sure someone will come up with something interesting!
Eric