Previous topicNext topic

y variable?

Questions, comments, feedback, etc.
Post Reply
skarabee
Posts: 130
Joined: Fri Aug 28, 2015 3:11 am

y variable?

Post by skarabee »

is there some example with the "y" variable ? When I use it, I get an error message 'undefined symbol"...
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: y variable?

Post by Magic »

Can you post a screenshot of that error?
skarabee
Posts: 130
Joined: Fri Aug 28, 2015 3:11 am

Re: y variable?

Post by skarabee »

error.jpg
error.jpg (67.7 KiB) Viewed 4960 times
Just typed the example expression, but maybe there is something i didn't catch..
sjdacruz
Posts: 37
Joined: Sat May 30, 2020 4:53 am

Re: y variable?

Post 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)
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: y variable?

Post by Magic »

In 2.31 the y variable is defined by default.

Are you sure you’re using 2.31 and not 2.3?
skarabee
Posts: 130
Joined: Fri Aug 28, 2015 3:11 am

Re: y variable?

Post 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".
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: y variable?

Post 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!
Post Reply