|
LynchEM Newbie
Joined: 14 May 2005 Posts: 1
|
Posted: Wed Mar 18, 2009 2:05 am
Database retrieval? |
Is there a way to use a database to retrieve a fixed response? Instead of setting hundreds of triggers I would like one trigger to recognize text from the mud, then send an appropriate response.
i.e:
Field 1 Field 2
says "hello" say hello
says "goodbye" say goodbye
says "sanc" cast sanc %
etc...
Someone says goodbye, the trigger would search the database and say goodbye. Is this possible? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Mar 18, 2009 5:03 am |
Don't bother with a database, just use a data record variable:
#addkey Stuff hello "say hello"
#addkey Stuff goodbye "say goodbye"
#addkey Stuff sanc "cast sanc @tar"
#trig {^(%w) says, "(*)"} {tar=%1;#if %db(@Stuff,%2) {#exec %db(@Stuff,%2)}} |
|
|
|
|
|