Game Development Community

Quick Question about strings

by Michigan State University (#0021 · in Torque Game Engine · 06/13/2006 (11:48 am) · 4 replies

Is there a quick way to change a string, say %string = "I'm a variable" to a tagged string?

Or, alternatively, is there a way to have a console function return a tagged string instead of a regular string?

#1
06/13/2006 (12:52 pm)
What do you mean a "Tagged" string?
#2
06/13/2006 (12:57 pm)
Try using single quotes.
#3
06/13/2006 (2:31 pm)
Ben's advice to try single quotes is best, if it works for you.

if your situation is such that the string is a regular string stored in a variable,
things are a little trickier.

i ended up writing the following script function to convert a string that's stored in a variable into a tagged string.
function makeTaggedString(%plainText)
{
   %cmd = "%ret = '" @ expandEscape(%plainText) @ "';";
   eval(%cmd);
   return %ret;
}

if there's a more straight-forward way to do this in script, i'd love to hear it.
#4
06/14/2006 (6:55 am)
That last was what I was looking for. Thank you much.