Adding text and a variable to a text behaviour.
etheridge
Member Posts: 12
Hi again folks!
Okay it's time for me ti ask yet another question...
How can I add text and a var to a text behaviour? Basically I'm trying to dump on the screen "Score: + VAR".
I know it's going to be something really simple but I am actually brain dead tonight!
Argh, I'm actually a developer by trade and do this for a hobby, so asking this is grating me :-)
Good job you folks are all uber coolio.
Jase.
Okay it's time for me ti ask yet another question...
How can I add text and a var to a text behaviour? Basically I'm trying to dump on the screen "Score: + VAR".
I know it's going to be something really simple but I am actually brain dead tonight!
Argh, I'm actually a developer by trade and do this for a hobby, so asking this is grating me :-)
Good job you folks are all uber coolio.
Jase.
Comments
or whatever your attribute is :P the ".." is required.
alt+space for a space I think
And the text needs to be in quotes.
So:
Display Text: "Hi, my name is "..game.myName..". It is nice to meet you."
Cool that worked perfectly!
One other small question, do you know how to put spaces in? For example "Score:"..game.Blah
But after the Score: it won't let me put a space in?
Jase.
However, I am not sure if those work on the device as well. You need to test it.
I'm sure the line breaks are messed up as the text is still centered.
If you want to be totally safe, I would make a global text attribute called 'space'. And make it a single space character: " ". (without the quotes)
And use it like this:
Display Text: "Score:"..game.space..game.score
Using .. to add text and variables together is called concatenation.
A much more powerful use of this technique is to use it for setting the Image of an actor, like this:
Change Attribute: self.Image To: "image_"..self.myImage..".png"
Hopefully they will add this ability throughout the engine. However, it can cause issues if you try and access something that isn't there...
Has anyone else been having issues with text alignment? I'm click the left, centre and right and that text is staying in the same place. Doh!
Jase.