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
30
S
6
G
1
Posts: 350
Reputation: 2,756

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
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Thu Aug 17, 2017 2:36 pm

Wonderful, it works now!
Thank a lot @Magistross :)
B
30
S
6
G
1
Posts: 350
Reputation: 2,756


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests