Page 1 of 1

y variable?

Posted: Sun Dec 13, 2020 3:01 pm
by skarabee
is there some example with the "y" variable ? When I use it, I get an error message 'undefined symbol"...

Re: y variable?

Posted: Sun Dec 13, 2020 4:01 pm
by Magic
Can you post a screenshot of that error?

Re: y variable?

Posted: Sun Dec 13, 2020 11:02 pm
by skarabee
error.jpg
error.jpg (67.7 KiB) Viewed 5564 times
Just typed the example expression, but maybe there is something i didn't catch..

Re: y variable?

Posted: Sun Dec 13, 2020 11:48 pm
by sjdacruz
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)

Re: y variable?

Posted: Mon Dec 14, 2020 12:36 am
by Magic
In 2.31 the y variable is defined by default.

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

Re: y variable?

Posted: Mon Dec 14, 2020 5:50 am
by skarabee
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".

Re: y variable?

Posted: Mon Dec 14, 2020 8:27 pm
by Magic
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!