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
32
S
6
G
1
Posts: 353
Reputation: 2,821

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
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Thu Aug 17, 2017 2:36 pm

Wonderful, it works now!
Thank a lot @Magistross :)
B
32
S
6
G
1
Posts: 353
Reputation: 2,821


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests