I did a poor job explaining what the issue I'm having is but if you just look at the video you can see the behavior I'm trying to avoid.
Basically its that anytime a maptext reaches a new line instead of expanding downwards it pushes all the text up instead.
How can I get around this behavior?
I don't think there is any maptext variable or functions or events I can trigger off so I have no idea when its gonna jump to a new line because then I'd just push down the y by another 32pixels or so.
Code at the request of Zasif
#define TEXT_SPEED world.tick_lag
#define NAME_FONT "<span style='font-weight:bold;font-size:small;width:100%;font-color:yellow'>"
#define CHAT_FONT "<span style='font-size:x-small;width:100%;font-color:white;text-justify:inter-word'>"
client/New()
..()
spawn(10)new/script(src,"Grandpa","Today is the day you inherit the clan. The responsibility to establish and maintain our clans LEGACY falls solely on you!")
script
New(client/c,name,chat)
//DYNAMIC creates an object that sets its variables to the arguments
var/obj/black=DYNAMIC("icon"='turfs.dmi',"icon_state"="black","alpha"=200,"screen_loc"="WEST+2,SOUTH+5 to EAST-2,SOUTH+3","layer"=FLY_LAYER)
var/obj/txt=DYNAMIC("maptext_x"=128,"maptext_y"=-16,"maptext_width"=320,"maptext_height"=96,"screen_loc"="WEST+2,SOUTH+5","layer"=FLY_LAYER+1)
c.screen+=list(black,text)
sleep(5)
txt.maptext="[NAME_FONT][name]:</span><br>[CHAT_FONT]"
sleep(5)
var/list/L=split(chat," ")//Returns a list of words in a string
spawn for(var/v in L)
for(var/j=1 to length(v))
sleep(TEXT_SPEED)
txt.maptext+="[copytext(v,j,j+1)]"
sleep(TEXT_SPEED*3)
txt.maptext+=" "