Not understanding expressions

Hi

I can’t seem to make expressions work? I’m trying to use them with a filter for True or False. I have 2 mailboxes both producing the number 1 if a message is sent to them. Basically I want a True response if both mailboxes are active (so I’m trying to add the values of the mailboxes together and then send the value to a filter which gives True if the input is 2, False if not). I can’t seem to use an expression to do that though. Firstly it just doesn’t seem to want to add up or the numbers don’t add up to what I’m expecting and secondly if no messages are sent to it I’m worried that it won’t produce anything (which would give the expression nothing to add up and therefore neither a True or False output from the filter?)

Thanks

Z_O_L

Maybe its easier if I use switches? Although one of the switches at times will have both an on and an off command going to it. Is there anyway to supersede the On if there is also an off?

Expressions are basic math equations that can be used to subtract and or add values, for example, if A=10 and B= 1 and the operator is A-B, then the output will be 9

Thank you. So I sort of guessed that was how it was supposed to work however, how does it work when there is an input to A and B? It doesn’t seem to add unless I have something going to eval, if there’s no input to eval the A+B inputs wont add up? Is this supposed to happen?

I also have another problem

Example:

I have a mailbox which either outputs 1 or nothing to A
I have a filter which either outputs 1 or nothing to B
I have a once trigger to eval
The expression out= A+B
A is manually set to 0
B is manually set to 0

It does not seem to add up the inputs to A and B?

A test shows:

When A = Nothing
When B = 1
Output = 2 ???
Incorrect maths

When A = 1
When B = Nothing
Output = 2 ???
Incorrect maths

When A = Nothing
When B = Nothing
Output = 2 ???
Incorrect maths

When A = 1
When B = 1
Output = 2
Correct maths (although this could be coincidence as it always outputs 2)

I must be doing something wrong :smiley:

Thanks

Z_O_L

When something goes to A/B in an expression, the number changes

So if 4 goes to A, A now is 4

Make sure you have A+B or A-B in that box under the A/B blanks

Yea but that’s how I’ve got it though? A and B are both set to 0 and the box under the A+B blanks is set to A+B. But no matter what the input numbers are to A and B, the output is always 2?

Here’s another example. There is no input to A as the filter above wasn’t correct (so no number is going to A). B has a 1 going to it. A+B (0+1) seems to equal 0?

http://i64.tinypic.com/10z1xc6.png

Same here. This one has no input to A or B and shows that A+B=1 (0+0=1)

http://i65.tinypic.com/2cofviw.png

I see what happened, you need to take the once from eval, and replace it with a timer of 1/10 of a second, else the expression doesn’t read it in time.

Ok that makes sense (and is something I would never have thought of) I will give that a try thank you

Ok still not showing the correct answers. I just remove the once, replace it with a timer and leave the timer set to 10 (which I assume is 1 second) and that should be it? Do I leave the repeat forever off to?

Can Expressions definitely read the numbers mailboxes and filters output?

Correct, 10 is one second, and no you do not need repeat forever

It can read numbers or any input with a value.
And outputs the answer

Notice most triggers give a one- with the exception of proximity and a few others- i think…

Logic and math output usually something 1+ or if you want, 0, the exception here is switches, they output exactly what inputs into them, but can also be turned off.

This can be helpful for expressions…

Oh thanks, but its still not adding up correctly. Even with the timer set to 1 tenth of a second it still wont add up correctly. If there’s no message to the mailbox then nothing goes to B and if the filter to A is false then nothing goes to A but it still gives a number greater than 0… Surely if nothing goes to A and nothing goes to B how can the expression (which is A+B) give anything other than 0?

I just did a test

1st run 0+0=0
2nd run 0+1=1
3rd run 0+0=1
4th run 0+0=1
5th run 1+1=2
6th run 0+1=2
7th run 1+0=2

Every trial after that the answer is always 2 no matter what the A and B inputs are.

Any other reasons why it would do this?

Any number stays until another one takes its place

Ok just done some more tests. I think the mailbox is the problem. I refreshed the game and it gives the correct answer when nothing goes to A and B or when the filter gives a number to A. But as soon as the mailbox gives an output to the B in the expression, from then on the answers are wrong. The expressions goes weird until the web browser is refreshed… :neutral:

Make sure the output doesnt come back to A/B

If you look at this screenshot. 1 is going to A, nothing is going to B yet the answer to 1+0 is somehow 2?

http://i64.tinypic.com/k36vci.png

I’m just wondering if you have to have a number being output to both A and B? The problem seems to occur when there is either nothing going to A and B or there is only a number going to one of the letters. It seems like if there is either no output to A or B then it counts nothing as a 1?

E.g

1+0=2
0=1=2
0=0=2
1=1=2

I’ve tried it with some other inputs to A and B

3+0=4
2+0=3

Maybe that’s the problem? Do expressions only work correctly when there is a physical number going to A and B?

Thanks again for taking the time to help