ID:145266
 
Code:
mob/verb/Say(msg as text)
view(9)<<"<b><font color=green><font size=1>-[usr.name] says, '[msg]'"


Problem description:

This isnt so much a problem as it is a how-to question. What I really want to do is make sure that [msg] is limited to a certain amount of characters, (lets just say 50) and to remove html from msg. I looked in the BYOND reference and tried the html_decode() proc, but I must be using it wrong, heres what I did "view(9) << "html_decode(msg)" basically. Thanks in advance for help, cya.

Look up the functions length and copytext. Also, you might want to rethink that limit of 50, since that is not enough to get a simple sentence out; the one I am typing right now would not fit in the 50 character limit.

Also, I never bother with the html encode/decode functions, but if I remember correctly I think html_encode was the one you want, not decode.
mob/verb/Say(msg as text)
if(lentext(msg) > 50)
alert("Your message can not be greater then 50 characters.")
msg=copytext(msg,1,50)

view(9)<<"<b><font color=green><font size=1>-[usr.name] says, '[html_encode(msg)]'"
In response to Kore2
Why the hell would you tell them the message can't be greater than **? They'll notice.
In response to Mysame
Not always. I've been in games where I've exceeded their character limits on talking and not noticed that the last few words were cut off. Sometimes when this happens, key words have come up missing and people don't know what I'm talking about. That's quite annoying when that happens.
In response to Kore2
A 50-character limit is ridiculous. If your limit is anything lower than 400 it'll cause you trouble.

Lummox JR
Just FYI, you can combine those two <font> tags. Don't forget to close your HTML tags either.

Lummox JR
In response to Loduwijk
I normally spit the message back at them when I cut it off, mainly because I want them to still have what was cutoff. I know when I get in a lengthy message and it gets cut, I get mad because I might have already forgot my wording, thowing off the whole thing(Kinda like when you make a post, hit the post button, and something happens and you lose it. Angering).