ID:167719
 
I was wondering how I could make it so that if I typed:
/me waves
it comes out as
JMT waves

I don't like the idea of making a seperate verb for this kinda thing though =\ can anyone help me out here? Pwease? ^_^
Uh, no idea what you're talking about not wanting to use a seperate verb.

Do it just like say.
In response to Artemio
So what you're saying is that you want to convert "/me" into the usr's name? Or do you want it to convert it to "JMT"?
In response to KirbyRules
copy the say proc, and name it me. if someone types /me the command line will do the me proc instead of say
By not making a seperate verb you mean you want to use say? If so, just use copytext to check the first few characters and then chop them off.
mob/verb/say(message as text)
var/prefix = copytext(message, 1, 5)
if(prefix == "/me ")
message = copytext(message, 5, 0)
world << "<b>[name]</b> [message]"
return
world << "<b>[name]: </b> [message]"
In response to Loduwijk
that is what i meant, thanks. i went with making a hidden verb called "me" though ^^;

sorry for the confusion everyone =\
In response to Loduwijk
copytext(msg,1,5) is gonna fail when the message is shorter than 4 characters. Best to find it like so:
if(findText(msg, "/me ", 1, 5) == 1)
...

Lummox JR
In response to Lummox JR
Lummox JR wrote:
copytext(msg,1,5) is gonna fail when the message is shorter than 4 characters.

It doesn't fail. Rather, it just returns the entire string passed to it without modification. Therefor, my example still works fine.

If it is less than 4 characters, then it is not "/me " with more text following and the 'prefix == "me"' part will be false and continue on to the normal version of say as appropriate.
In response to Loduwijk
I learned something with this:

I changed my say and world-say verbs:

mob/verb/

Say(msg as text)
set desc = "Talk to only the people on your screen."
if(usr.Jailed != 1)
if(findText(msg, "/emote ", 1, 5) == 1)
message = copytext(msg, 5, 0)
view() << "*<b>[name]</b> [message]*"
return
else
return
// ------------------------------------------------------------------------------------------
World_Say(msg as text)
set desc = "Talk to the entire world."
if(usr.Jailed != 1)
if(findText(msg, "/emote ", 1, 5) == 1)
message = copytext(msg, 5, 0)
world << "*<big>[usr.name] [message]*"
return
else
return


Now if I type "/emote a-splodes" it will print "*KirbyRules a-splodes*" instead of "KirbyRules says: a-splodes"