# Translator with 2 rules

Hello, I want to set 2 ‘SHIFT’ buttons on my stream deck in toggle mode
the first shift button controls the state of the global variable ge
the second shift button controls the state of the global variable gf

so far so good, I have a working translator for that

But now, I want to assign one of my stream deck button 4 differents action, depending on the combination of the ON/OFF state of the SHIFT Button
I can make translator works with one condition

‘if ge==0 then exit rules, skip Outgoing Action’

But I do not know how to handle 2 conditions

Thanks

See this post which has several examples of the strange but effective way you can handle more complex Boolean logic. If you need and example for your case, put it in the form of the logic you would normally follow for a different programming language and I can probably work it out for you.

Steve Caldwell
Bome Customer Care

Also available for paid consulting services: bome@sniz.biz

(if ge ==0 AND gf ==0) THEN send CC37

(if ge ==1 AND gf ==0) THEN send CC81

(if ge ==1 AND gf ==1) THEN send CC86

(if ge ==0 AND gf ==1) THEN send CC76

I checked the link, but I am too dumb aha I never programmed anything

much appreciated

Try this (untested but should work). I also usually leave the the original logic commented out as shown below. We are assuming that pp is the CC you want and qq is the value and on MIDI CH 1

``````// (if ge ==0 AND gf ==0) THEN send CC37
if ge!=0 then skip next 2 rules
if gf==0 then pp=37
if gf==0 then exit rules, execute outgoing action

//(if ge ==1 AND gf ==0) THEN send CC81
if ge!=1 then skip next 2 rules
if gf==0 then pp=81
if gf==0 then exit rules, execute outgoing action

// (if ge ==1 AND gf ==1) THEN send CC86
if ge!=0 then skip next 2 rules
if gf==1 then pp=86
if gf==1 then exit rules, execute outgoing action

// (if ge ==0 AND gf ==1) THEN send CC76
if ge!=0 then skip next 2 rules
if gf==1 then pp=76
if gf==1 then exit rules, executute outgoing action

Outgoing action   CC # pp on MIDI Channel 1 with value qq
``````

Steve Caldwell
Bome Customer Care

Also available for paid consulting services: bome@sniz.biz

Hey

I have this syntaxe error on the last phrase

Should I set the outgoing action in the outgoing panel to cc=pp also ?

The last line should not be in the rules, it should be added as an outgoing action.

Steve Caldwell
Bome Customer Care

Also available for paid consulting services: bome@sniz.biz
1 Like

So it works for CC37, CC81

instead of CC76 , I have a weird pp for value

basically the two first rules are working.

when gf=1 and ge=0, the translator send the cc of rule 3 instead of rule 4

Upload the project. file and I’ll see if I can fix it. Remember I hadn’t tested it when I sent it to you.

Steve Caldwell
Bome Customer Care

Also available for paid consulting services: bome@sniz.biz

This was wrong

``````// (if ge ==1 AND gf ==1) THEN send CC86
if ge!=0 then skip next 2 rules
if gf==1 then pp=86
if gf==1 then exit rules, execute outgoing action
``````

And should have been this:

``````// (if ge ==1 AND gf ==1) THEN send CC86
if ge!=1 then skip next 2 rules
if gf==1 then pp=86
if gf==1 then exit rules, execute outgoing action
``````

``````exit rules, skip outgoing action
``````

That way any rules not following the conditions will not send anything.

1 Like

you are the GOAT Steve !

It works !!

2 Likes