• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Showing message string and variables

N

Nathan Matthews

Guest
I thought this code would have worked but it didn't, can someone please help me with the right way to do it.
Code:
show_message("Level Status: "+room_caption+"#Coins Remaining: " +instance_number(Coin)+"#Fuel" + health);
 

Jakylgamer

Member
when you string together non strings you need to do
Code:
"Level Status: " + string(variable) + "more text" + string(variable2)
 

DukeSoft

Member
What the parser thinks you're doing here is adding a number to another variable. But since the first variable there is a string, it can't add that number to the string, so you will have to cast your variable to being a string using that function.
 
Top