I plan to use it in a proc
mob/proc/NameCombine(mob/M in view(1))
src.random = rand(1,2)
if(src.random ==1)
src.namecombine1 = "(this is where the code I'm looking for would be added)"
src.namecombine2 = "(same story only taking M.name)"
src.name = "[src.namecombine1][src.namecombine2]"
else
M.namecombine1 = "(same story taking M.name)"
M.namecombine2 = "(same story taking src.name)"
M.name = "[M.namecombine1][M.namecombine2]"
This code is to be used for "combining 2 players, and making the person in control be chosen by random chance"
Thanks ahead!
In the future, please use DM tags for any code you are going to post to the forums. It will help you quite a lot. Nobody reads code that isn't in DM tags.
As for how to copy half of a string:
The length() function returns the length of either a string or a list. The round() function will round a numeric value down to the first whole number below the current decimal value. When supplied with 1 as the second argument, it will round it up.
Finally, copytext() allows you to copy a certain portion of a string from the specified offsets. Supplying 0 as the second argument equates to the end of the list.
String concatenation, on the other hand can be done in two ways: