What's wrong with the conditional?

I put this in the opacity slot

$((wakeRand(1, 22))=1)?100:0$

I looks like I have it formatted correctly. The value displayed over the opacity section says $true?100:0$ rather than just 100. That is, the condition is being calculated and renders true, but the expected result of opacity 100 is not the final value.

What am I missing here?

I checked one of my watch faces, the syntax is almost the same: $(wakeRand(1,6))==2?100:0$?

I would remove the blank before the “22” and the brackets before the “$” and after the “1”. I also use “==”, but that may not be relevant.

1 Like

All decent suggestions. I swear I tried without the extra parenthesis and it wasn’t yielding a true, but I’ll try again.

I did not notice the extra space before 22 so that’s worth checking. It did yield a true so I didn’t suspect that part too much. Certainly worth trying.

“=” and “==” are supposed to be interchangeable according to the reference, but that does make a difference in Javascript so I may or may not have tried that as well. I’ll have another look.

Your sample worked properly of course so I started there.

Extra parenthesis were not the issue nor was the one or two equal signs.

It was indeed the space I did not notice before the 22.

Thanks.

I tried to open some past designs for samples of my own that worked, but the couple I tried would not load for whatever reason.

3 Likes