Adding a character to a text attribute every time an actor is spawned

Guys. I have a text attribute and I want to add an extra character to it every time a certain object is spawned. However I have had no success in doing this.
For example. Let's say I have a text attribute game.text and every time actor A is spawned, change text attribute to "A" then if B is spawned after that, change it to "AB", then if C is spawned, change it to "ABC" and so on.
At the moment I set up actor A (and B,C...) like this:
Rule -> if attribute --- game.text --- contains --- A -> nothing -> otherwise change game.text -> game.text+A
But it always give me "invalid expression" for my game.text attribute when the object is spawned! I tried to but in the " or getting rid of + but nothing works. Anybody knows if I can add a character like that in my text attribute?
Thanks a lot, folks.
For example. Let's say I have a text attribute game.text and every time actor A is spawned, change text attribute to "A" then if B is spawned after that, change it to "AB", then if C is spawned, change it to "ABC" and so on.
At the moment I set up actor A (and B,C...) like this:
Rule -> if attribute --- game.text --- contains --- A -> nothing -> otherwise change game.text -> game.text+A
But it always give me "invalid expression" for my game.text attribute when the object is spawned! I tried to but in the " or getting rid of + but nothing works. Anybody knows if I can add a character like that in my text attribute?
Thanks a lot, folks.
Comments
If we had the option to add text to a text attribute we basically had some type of 'writable tables' and that would have made our life a lot easier in the past 2.5 years
BUT , writable tables are suppose to come soon , and i believe its just what you need .. so......
Roy.
You're getting invalid expression because you are using a mathematical expression with a text attribute (...game.text+A)
So instead, try this:
Rule -> if attribute --- game.text --- contains --- A -> nothing -> otherwise change game.text -> game.text.."A"
Edit: typing while Roy was typing; Roy, you can add text to a text attribute with the double dot syntax; but I'm sure you knew that really... :-)
----------------------------------------------------------------------------
iPad app: End of the Earth –•– http://davidgriffinapps.co.uk/
----------------------------------------------------------------------------
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
"you can add text to a text attribute with the double dot syntax; but I'm sure you knew that really.."
Yeah sure , i was referring that he can't use the '+' to add strings together
Cheers mate
Roy.
P.S I added 200 strings together the other day.... and made a rope. Ha!
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
the " .. " is lua's syntax of concatenating strings
think that might change when we have gone native ???
@};- MH
No @MH, just stringing you along! ;-) :-)
Interesting question re: ".." ; I hope it doesn't change, I've sort of got used to it... but I hope there'll be more text manipulation aspects, we can only hope... (deleting specific words from a large text chunk, for example; not sure that can be done at the moment....?)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps