If value, and then if another value
-
Hey guys! I'm having a hard time figuring something out. It's pretty basic, I've already went through the forum hoping to find an answer but didn't. I'm trying to do an if statement, but depending on two values, so like:
inline function onArticulationControl(number, value) { if (value == 1) { /// STUFF HAPPENS if (value of another button == 0) { //// SOME CHANGE } if (value of another button == 1) { //// SOME CHANGE } }}
So, i guess the answer is - can I do this and if so, how can I check the value of this button in a middle of the first if statement?
Does that make sense?
-
@tomekslesicki Yes you can do that. Use logical operators. Go watch my scripting 101 video if you haven't already.
-
Thanks! But how can I get the value of the button in the statement?
-
Because
if (value == 1 && Dirt.getValue() == 0)
doesn't work. I'm sure it has to be something obvious at this point but I'm lost!
-
@tomekslesicki post a snippet
-
I have a crazy amount of code there, I've tried to rebuild this in a simpler form so that the snipped would make sense to somebody else but now it doesn't work and I feel it would take me a while to figure out why...
Could you point me into a direction here on how to get the value of a button into the if statement? If the short bit of code I posted above correct (is it?), I'll go looking for problems in the other parts of my script.
-
@tomekslesicki The code you posted should work, but without context I can't say it's correct.
-
I figured it out, I needed to trigger .changed() on button press to refresh the articulation and reload the sample maps. Thanks, David!