Problem with logical expressions in a "set text" action

Get help using Construct 2

Post » Thu Aug 17, 2017 1:58 pm

Hi everyone,

Is it normal that I can't use logical expressions in conjunction with other expressions in a "set text" action?
For example, in the code below, the event 2 is working perfectly fine (when deactivating event 3), while event 3 is not working at all (when deactivating event 2). event 3 is always displaying "Paul" whatever the variable value is. I really don't see why...

Image

Is it a bug, or am I missing something? The same problem occurs in C3.
(useful link if you aren't familiar with logical expression)
B
38
S
9
G
1
Posts: 364
Reputation: 3,313

Post » Thu Aug 17, 2017 2:13 pm

Off the top of my head I'd say it's probably related to the order of operations. Try encasing the ternary operator in parenthesis.
Code: Select all
"Hello" & newline & (Variable1 = "Paul" ? "Paul" : "Not Paul")
B
80
S
33
G
27
Posts: 1,027
Reputation: 21,114

Post » Thu Aug 17, 2017 2:36 pm

Wonderful, it works now!
Thank a lot @Magistross :)
B
38
S
9
G
1
Posts: 364
Reputation: 3,313


Return to How do I....?

Who is online

Users browsing this forum: bramblepants and 24 guests