Game Development Community

Torque Scripting question about Strings

by Ronald J Nelson · in Torque Game Engine · 11/28/2005 (9:37 am) · 4 replies

I have read the documentation and have seen the multitude of other things you can do to strings with TorqueScript but I haven't seen this and want to know if it is possible and if so how to do it.

Adding scripts together.

Example:

String1 = "Beer"
String2 = "Can"

String1 + String2 = String3

String3 = "BeerCan"

#1
11/28/2005 (9:51 am)
Torquescript uses the @ symbol for string concatenation.

String3=String1@String2;

make sure you're writing your variable before the string operation.
#2
11/28/2005 (9:59 am)
Sean has it correct. Its explained in a few places in the docs. Chapter 6, section 4 in the part Special String Operators has a few that may help clear things up. (I just happened to have that page open :P)
#3
11/28/2005 (9:59 am)
Hi guys,

Just to expand on what Sean said, here's an example from Ken Finney's first book.

%aboutMe = "My name is " @ %myFullName @ " and I am " @ %myAge @ " years old.";

If you don't have the 3D Game Programming All In One yet, I highly recommend it. It's been a real lifesaver for me :)

Aaron E.
#4
02/04/2007 (10:57 am)
That book is my course book for my Torque course at Westwood College. It is a very good book and there is a second edition out now.