ID:54958
 
People who are new to programming on BYOND don't seem to realize that there is a built in proc that handles HTML from text and separates it and shows it as a solid line rather than customizing text. So those of you who own a NBOTLS or WOTS rip that have something like:
var/list/filtered_words = list(">","<")
mob/verb/OOC(msg as text)
for(var/v in filtered_words)
if(findtext(msg,v))
src<<"U KANT USE HTML CUZ I HAV SUPA FILTUR"
return
world<<"[src]: [msg]


Please just get rid of your messy code and useless filters that are just pointless to have and replace it with:
mob/verb/OOC(msg as text)
world<<"[src]: [html_encode(msg)]

And also since i'm on the topic of filters there is another built in proc that limits characters and can be used to filter html just do this:
mob/verb/OOC(msg as text)
world<<"[src]: [html_encode(copytext(msg,1,500))]

This will copy the first 500 characters a person speaks and just stop them at the 500th character. If they didn't type in 500 characters then the message will remain the same unless html is inputted.
Make a new one of these posts every year, huh?
Super Saiyan X wrote:
Make a new one of these posts every year, huh?

People complain how a person changed the background of a game and how they should be banned from BYOND :\
Mind if I make a correction?

It should be copytext( msg, 1, 501 ) if you want to copy the first 500 characters.
Metamorphman wrote:
Mind if I make a correction?

It should be copytext( msg, 1, 501 ) if you want to copy the first 500 characters.

Yeah you're right, but anything over 500 characters is a bit too much lol