|
Post by ericzang on Jul 3, 2019 21:59:02 GMT
Anyone know how to use setexpression for a user created variable (green dot)?
for example: setexpression(obj,'??',1);
?? is usually 'x' or something, but the green dot variables have no such variable 'name', as far as I know. Is there something that can be inserted that place? Thanks!
|
|
|
Post by xPsycHoWasPx on Jul 14, 2019 7:28:52 GMT
setexpression() /getexpression() Is used when you need to set or get values dynamic, instead of static command
Value = 1 This can only target ’Value’, you can of course mix it with IF rules for switching between setting different Values.
But now we need dynamic set and get of values Inside an object:
setexpression(obj path, expression, value) If you are using the script inside an obj or next to it, lets say a ’Fader’ and we want to change X Then command will look like this:
setexpression(Fader,'x', 1.0)
variable must be a string ’x’ , but because of that you can now combine text with lets say an counter in a "for loop"
decl list = ['x','y','z']; decl a;
for(a=0;a<3;a++) setexpression(Fader,list[a], 1.0);
or if your object is full of X0,X1,X2,X3,X4 variables Then you can do:
decl a; decl Val;
for(a=0;a<5;a++) { Val = 'X' + a setexpression(Fader,Val, 1.0); } to take this a step further, lets combine the setexpression with findobject() command
findobject() works by converting a string into an obj command like: From 'Fader' to just Fader
lets say you want change x in 8 Faders, labeled: Fader0,Fader1,Fader2,Fader3 ect.
decl a; decl Val;
for(a=0;a<8;a++) { obj = findobject( 'Fader' + a) setexpression(obj,'x', 1.0); } if you have 64 faders, then just change a<8 to a<64
getexpression() works the same way.
but this is how you would use those commands in scripting.
Just write if you got more questions and I will reply when I have time. Just been busy last +3 months learning how to convert my lemur project into a real app and still are.
Peace PsycHoWasP
|
|
|
Post by ericzang on Jul 14, 2019 23:13:40 GMT
Wow, thanks so much, this is very helpful and a great reference! So as far as those user variables that don't exist as part of an object, I suppose set/get expression is not applicable.
Thanks again for creating this forum!
(btw, although the Liine forum has been back up, I can't find any button to make a new post!)
|
|
Marco
Full Member
Posts: 6
|
Post by Marco on Jul 16, 2019 12:57:32 GMT
(btw, although the Liine forum has been back up, I can't find any button to make a new post!) you need to enter one of the forum areas (e.g. General Discussion, Canvas, Modules...), after that you can start a new topic.
|
|