Combine a text with a attribute?

daverennerdaverenner Member Posts: 133
edited November -1 in Working with GS (Mac)
I want to display a text followed by a value from an attribute. Like "Hello" + NameString. Or $hello.$name
I'm used to PHP, trying to figure GS out. I did try text..Attribute and got an :Invalid Expression" error.

Comments

  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    Be sure not to hand type the attribute name. You really have to select all attributes from the editor list...

    ".." (double period) is the concatenate operator.

    Example:
    `"Hello"..self.Name`

    Result:
    HelloActor 1
  • daverennerdaverenner Member Posts: 133
    Cool that works, sorta. I want 2 words then the expression, but for some reason i can't enter a space between the 2 words.
    So, using your example, i need "Hello Mister"..self.name
  • scorelessmusicscorelessmusic Member Posts: 565
    And I would highly recommend Photic's book too! Has excellent coverage on things like 'escapes' too.

    http://photics.com/books/gamesalad-textbook
  • scorelessmusicscorelessmusic Member Posts: 565
    When in the expression editor, to enter a space, use alt-space. This and more is covered in Photic's book, which is where I learnt that trick from. ^_^
  • victorkin11victorkin11 Member Posts: 251
    I have successed to use change attribute to add text,
    I have 3 text attribute in game a, b, c
    use change attribute game.c to game.a .. game.c
    then c = a+b

    but I didn't find any other operaction work for text.
Sign In or Register to comment.