Jump to content

Whats wrong with this expression?


Recommended Posts

So I have a switch node I want to direct based on what another switch node's channel is set to. AFAIK || is the "OR" nomenclature but going back to H13 I have not been able to get this to work. Basically if the first switch is set to 3, 5 or 6  set the second switch to 1.. if its not 3,5 or 6 flip it the other way.

This is the expression that I have, but it seems to result in in any value being true (1). What am I doing wrong? it doesn't error :)

if(ch("../switch_GLV/input")==3 || 5 || 6, 1,0)

Link to comment
Share on other sites

if(ch("../switch_GLV/input") == 3 || ch("../switch_GLV/input") == 5 || ch("../switch_GLV/input") == 6, 1, 0) 

It is unnecessary to wrap it if you need to return true if true and false if false. Unless you type it for testing puproses, you may simplify it to this:

ch("../switch_GLV/input") == 3 || ch("../switch_GLV/input") == 5 || ch("../switch_GLV/input") == 6

Multi-line style using variable.

{
	float input = ch("../switch_GLV/input");
	return input == 3 || input == 5 || input == 6;
}

 

If you switch to Python, you may use:

ch("../switch_GLV/input") in (3, 5, 6)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...