Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
LynchEM
Newbie


Joined: 14 May 2005
Posts: 1

PostPosted: 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?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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)}}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net