ID:170777
 
Is it possible to keep on adding more information to text variables?

For example lets say var/a = "Haha", is it possible to later ADD(not literally change)"it sucks to be you"? So later when I refer to that variable it'd have the information "Haha it sucks to be you".

To make it more clear:

var/thevar = "Haha"

mob/verb/Sucks()
thevar += "it sucks to be you" //i'm pretty sure you can't do this...
usr << "[thevar]" //this should output "Haha it sucks to be you"


I was thinking of a list approach...

var/list/ha = list("Haha")

mob/verb/Sucks()
var/thing
ha += "it sucks to be you"
for(var/a in ha)
thing = a
usr << "[thing]"


This outputs the last thing in the list not everything.
Yep.

mob/verb/Sucks()
var/haha = "Haha!"
var/thing = "Sucks to be you!"
thing = addtext(haha,thing)
usr << "[thing]"


Outputs:

Haha!Sucks to be you!
In response to Igmolicious
Thanks.
In response to Igmolicious
The addtext() instruction exists primarily for backwards compatibility. Here's another couple of ways of doing that:
var/text1 = "Hello"
var/text2 = "World"

text1 += " " + text2
// This means text1 = text1 + "" + text2

var/text3 = "Hello"
var/text4 = "World"
text3 = "[text3] [text4]"

var/k = "435435Hahaitsuckstobeyou2342"


Is it possible to be able to extract(and use) certain parts of the variable(lets say the Haha it sucks to be you phrase) and also be able to remove that phrase from the variable k?
In response to DeathAwaitsU
lol, i bet u learned C++, cuz it sure looks like it :).

(learning C++ a lill myself)

cout<<"DM is easier!";
In response to ShakerDeath
Nope.
In response to DeathAwaitsU
Very much so, with findtext and copytext.