ID:154694
 
I'm looking for a resource that shows me how to require players to use the say command to talk to a nearby NPC. The NPC then uses the findtext proc (I think it was findtext) to find "Hi There, ." or another greeting in the player's message. If the message contains it the NPC responds back to the player. I've searched the resources section up and down, but if you happen to stumble upon please link to it. Otherwise could you help me recreate it?
mob
npc
Civilan
icon = 'npcs.dmi'
if(findtextEx([player.msg],"Hello, Civilian.")==1)
usr << "Hello, [player]."
Hey there, it seems as if you need to look at some tutorials to get to know the basics of the language. I recommend trying out Step BYOND and taking a look at the awesome articles on Dream Makers.

As for your say proc, I would personally do it somewhat like this:

mob
proc/hear( who, thing ) // Called whenever a mob hears something.
// 'who' is whoever said 'thing'.
src << "<b>[who]:</b> [thing]."

verb/say(t as text) // Here we define the verb.

t = copytext( t, 1, 301 ) // We cutdown what is being said,
// making sure it is no longer than 300 letters.

for( var/mob/m in viewers() ) // We loop through each mob (person)
// that is able to see us.

m.hear(src,t) // We make them hear what we have to say.


npc // an extenstion of mob, /mob/npc

hear(who, thing) // we override the default hear() procedure for npcs.

if( findtext(ckey(thing),"hello[name]") ) // ckey() cuts out all of the
// symbols and spaces from the text that
// is passed to it, so it gives us a bit more
// flexibility with how we can greet the npc.
who << "Hello, [who]!"