Conditionally moving a text object on and off screen

Hi
I’m trying to move a text object on and off screen with the following logic -
$(floor(#Dm#/10))=1?165:$$(floor(#Dm#/10))=2?150:10$
The above is a shortened expression but it doesn’t produce the result i expected, or, maybe it is simply not possible to move an object conditionally this way - any help and or guidance will be gratefully received

1 Like

Yeah that is a bit of a jumble. But well done for where you have got to . The syntax is all correct . the structure is not classic . I will look at it as a test .

This for me is the classic structure of an Advanced Conditional . So it is asking if One condition && ( AND ) a Second are True ? ( correct ) the go do the first Number / Text otherwise : do the other .

Soon we can talk about || ( OR ) which is useful if you numbers are either side of Zero .

I have not sent the Text completely off screen so you can see what is happening . A favourite off screen position is 999 so we can instantly see what is intended .
.
.
.

$(floor(#Dm#/10))>=1&&(floor(#Dm#/10))<=2?160:320$
.
.
.

1 Like

Yes, sometime better to split things and hide things with opacity as well, instead of trying to cramp everything into one statement. It may work in Creator, but not on all watches. That makes it difficult to publish without knowing the outcome.

1 Like

I’m up quite late and maybe I’m seeing things, but, the syntax seems to actually be the problem, because of how Facer’s nested conditionals are messy and illogical.

The way the original formula is, if the first conditional is true (=1?) then the result returned is actually 16510 instead of just 165, because the rest of the formula continues to get evaluated after the first conditional, then it passes over the second conditional (because it’s not true in this case) and then it lands on the “else” at the end, returning 10 as well, so you get 16510 (at least that’s what I get in Creator).

If I add a third conditional to test for (floor(#Dm#/10)) to be neither 1 or 2 (!=1&&!=2) then the resulting outcome seems to work right and I get 165 for =1, or 150 for =2, or 10 for all else.

$(floor(#Dm#/10))=1?165:$$(floor(#Dm#/10))=2?150:$$(floor(#Dm#/10))!=1&&(floor(#Dm#/10))!=2?10:$

The way I’ve understood this fine mess is that for a basic conditional, I have $Condition1?Action1:DefaultElse$ which works fine as an if-then-else. But if I’m nesting, I avoid having an “else” situation so I do this $Condition1?Action1:$$Condition2?Action2:$$Condition3?action3:$ instead.

3 Likes