On-screen text

by Kidpaddle45
Want text slowly typed on the player's screen? This is what you need. (Uses 2 examples: maptext and output)
ID:1661139
 
V.1.0
Send a message to a player with text slowly being typed on-screen. (Like in Pokemon games)
Hold Z to make the text type faster.

Do you like my creations? Donate, it motivates me! =D










I've been experiencing runtime errors upon having a mob logout() during the creation or deletion of screen text.

This is the code I implemented to reduce the runtime errors from infinite to 4-5 and therefor preventing dream daemon from crashing. Still, the abundance of if(M.client) and return's are clients are unnecessary.

proc/Text(mob/M,var/Text="")
var/Blank = " "
for(var/HUD/Text/Te in M.client.screen)
Te.maptext = ""
del(Te)

var/HUD/Text/T = new;M.client.screen.Add(T)

T.maptext_width = length(Text) / length(Text)*300//300
T.maptext_height = length(Text) / length(Text)*100
while(length(Blank)-2<length(Text)+1)
if(M.client)
sleep(M.TxtSpd)
if(M.client)
Blank = addtext(Blank,"[getCharacter(Text,length(Blank))]")
T.maptext = "<font face=\"Power Red and Blue\"><U><font color = #FDD017><font size=4>[Blank]" // The name of the font is not its file's name.
spawn(30)
if(M.client)
M.client.screen.Remove(T)
else
return
else
return
else
return
I'm not longer experiencing run time errors with this code.
proc/Text(mob/M,var/Text="")
var/Blank = " "
for(var/HUD/Text/Te in M.client.screen)
if(M)
Te.maptext = ""
del(Te)

var/HUD/Text/T = new
if(M)
M.client.screen.Add(T)

T.maptext_width = length(Text) / length(Text)*300//300
T.maptext_height = length(Text) / length(Text)*100
while(length(Blank)-2<length(Text)+1)
if(M)//.client)
sleep(M.TxtSpd)
if(M)//.client)
Blank = addtext(Blank,"[getCharacter(Text,length(Blank))]")
T.maptext = "<font face=\"Power Red and Blue\"><U><font color = #FDD017><font size=4>[Blank]" // The name of the font is not its file's name.
spawn(30)
if(M)//.client)
M.client.screen.Remove(T)
else
return
else
return
else
return
Off here with the [url=http://www.e-six-sigma.net]http://e-six-sigma.net/[/url] basics, we have the object itself, audiohandler. This object should always be defined under the object tree for another object, such as a mob or client. To initialize the audio handler, pass the mob into the new() proc as such:
Any idea how to delete the text (as well as box text is within) after a certain period of time or due to a verb such as Continue()?
Also, I'd be curious to see how to make the text appear top to bottom and make the following lines occur under the previous.