ID:179121
 
Ok i have 2 questions. First one is how would i make it so when someone put something in chat that started with ! it does something, ive seen in done in TextMUD 2.0 with !roll 1d4 and stuff like that. How do i do that?

Seccond is, i used this code to check to see who is hosting and give them special verbs.

client/New()
if (!src.address || (src.address == world.address))
usr.verbs+= /mob/proc/note2
usr.verbs+= /mob/proc/DisableWarnings2
usr.verbs+= /mob/proc/EnableWarnings2
usr.verbs+= /mob/proc/ChangeServerName2
usr << "Welcome on [OP], thank you for hosting a server!"
OP = "[usr]"
..()
else
.=..()

I thought that would work, but it doesnt. what did i do wrong?
There are a probably few ways you could do the first question. My way, I'd check the first letter of the player's input (cut it out using copytext) and if the remaining letter equals "!", then run the special commands thing. Chop up the input into sections based on the spaces, so "Do something weird" would be "[Do][something][weird]" in a list format. Then check to see if list[1] = something, for example, if list[1] = "roll" then check to see what list[2] is and convert 2d6 or whatever into the dice roll you want (however you want to do that.)

It gets long and tends to be complicated, but generally that's how you do it :o)
Couple of things. Firstly, the client has no mob yet so there is no usr. The client is assigned a mob AFTER it's normal precedures so you'd have to put the ..() before EVERYTHING.

Then you should be using mob instead of usr like this:

mob.verbs += /mob/proc/blah