How do I put multiple variables in text?

Get help using Construct 2

Post » Sun Feb 15, 2015 12:40 am

Hey,

I'm making a platform game where the player must perform several actions before they complete the level. I have a trigger at the end of the level that says "You still have X trees and Y flowers to fix before you can finish!"

X and Y are variables, and I'm having trouble using an event to set the text to include them.

In my mind the action should read:
Code: Select all
"You still have "&trees" trees and "&flowers" flowers to fix"
however, if I try to ok this, I get an error that reads "Syntax error! The expression appears to end before here - are you missing something before it?" with the section " trees and " highlighted.

Basically, I don't know what I'm missing or what I'm doing wrong here :/
B
13
S
2
Posts: 15
Reputation: 1,625

Post » Sun Feb 15, 2015 12:45 am

You're missing the ampersands after your variables. Expression should read

Code: Select all
"You still have " & trees & " trees and " & flowers & " flowers to fix"
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,126

Post » Sun Feb 15, 2015 12:51 am

Ahh awesome, thanks very much! I knew it would be something ridiculously simple >.>
B
13
S
2
Posts: 15
Reputation: 1,625


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], draiza, kizlengames and 6 guests