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
Fraust
Newbie


Joined: 24 Aug 2007
Posts: 1

PostPosted: Fri Aug 24, 2007 1:06 am   

A Newbie Question
 
I've been reading the documentation portion of the Cmud website. I'm trying to populate a couple of variables but can't seem to get it working. Here is what I have so far...

Hp: 1010(1010) Gp: 1025(1025) Xp: 1617129(33000000) is the mud output...

#TRIGGER {Hp: &{HPvar}(1010) Gp: &{GPvar}(1025) Xp: &{XPvar}(33000000)} is how I have it defined..

I use #SHOW @HPvar and I get nothing...

I'm sure it's something silly. Any help?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Fri Aug 24, 2007 1:19 am   
 
The problem is that the trigger pattern doesn't match the text. The brackets () are special characters in CMUD pattern syntax - you need to tell CMUD that you don't intend for them to be used as special characters - you do this by putting a tilde ~ in front of them. This pattern matches your text:

Hp: &{HPvar}~(1010~) Gp: &{GPvar}~(1025~) Xp: &{XPvar}~(33000000~)

However, if the numbers in brackets ever change, you'll have to manually recreate the trigger. You can circumvent this by using real wildcards in the pattern rather than the variable-capture syntax. %d will match those numbers, so something like:

Hp: &{HPvar}~(%d~) Gp: &{GPvar}~(%d~) Xp: &{XPvar}~(%d~)

might work better.

In CMUD 2 it'll be much easier to check this sort of problem - triggers will have a new "Test Pattern" tab, where you can paste the text you think should fire the trigger and CMUD will tell you whether or not the trigger matches the text.
_________________
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 » 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