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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Fri Aug 01, 2008 12:51 pm   

triggering off a database record?
 
I've been collecting a MILLION repop messages for the various area's in the game, and the slew of triggers is becoming quite difficult to work with. So I'm thinking that I could reduce it all into a single database variable, and trigger off of that. Right? Seems easy to me, however I can't quite get it right. The jist of what I'm thinking is below. Basically, triggering off of the %key and posting the area that it is in via the %val. Right? TIA! =]

Code:
  <var name="repop_msg" type="Record" id="1414">This is an example of one repop message.=one|This is the last example of a repop message.=three|This is another example of a repop messsage.=two</var>
  <trigger priority="14150" id="1415">
    <pattern>^{%%database(@repop_msg)}$</pattern>
    <value>#say ~[ Area: %val ~] has just repopulated!</value>
  </trigger>
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Fri Aug 01, 2008 12:56 pm   
 
I don't use CMud (yet!), but as much I've followed new commands and info related, shouldn't the pattern read

%%dbkeys(@repop_msg)

And then, to get the correct variable, you'd treat above as "%1" and do

%db(@repop_msg,"%1")


As I said, I'm not actively scripting in CMud by any means so I might be completely off course.


Prog
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Fri Aug 01, 2008 1:17 pm   
 
Ah... Was triggering wrong, thank you. =] However, the correct %val isn't being displayed. When I do a #say ~[ Area: %dbvalues(@repop_msg) ~] has just repopulated! it gives me ALL the values... Maybe a way to just sort out what is exactly being triggered? I'm still playing with it. Thanks again!
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Aug 01, 2008 1:36 pm   
 
I don't think you actually need the %%dbkeys here. It used to be necessary in some older versions, but @repop_msg should work.

What you should do is put parentheses around the trigger pattern to capture the matching string.
To display the right value, do: @repop_msg.%1
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Fri Aug 01, 2008 1:58 pm   
 
Yes, you only need to use %%dbkeys() if your %key's will contain wildcards. Otherwise your pattern would be
Code:

#TR {^{@repop_msg}$} {#VAR area_name %db(@repop_msg, %trigger)}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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