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
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 11:17 am   

Suggestion: Direct to Variables
 
Maybe make something for the CMUD pattern syntax that attaches a variable to a value right there in the pattern? maybe something like...

#trigger (or regex) trigger {^ you gain \d+:@exp: experience!}

So...

you gain 234 experience!

would set exp to 234
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Fri May 09, 2008 11:29 am   Re: Suggestion: Direct to Variables
 
Try as standard trigger pattern to use &exp instead of @exp and see what happens Very Happy.

Edit: I usually don't use the regex, but in the manual it is mentioned that in regex you can use (?Varname:exp) to do the same, where exp is a regex for the pattern to match the variable. See #REG.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 11:44 am   
 
using &variablename in a trigger pattern or (?varname:\w+) catch variable names in the pattern?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Fri May 09, 2008 11:50 am   
 
chamenas wrote:
using &variablename in a trigger pattern or (?varname:\w+) catch variable names in the pattern?

Yes so the matched data would then be stored in @variablename.
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Fri May 09, 2008 11:53 am   
 
Yes.

http://forums.zuggsoft.com/modules/mx_kb/kb.php?page=3&mode=doc&k=2684

One of a few of the most useful of the help pages. Towards the bottom it explains &var
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Fri May 09, 2008 12:11 pm   
 
You can also use local variables with ($localvar:something) in both regex and normal triggers, where "something" is whatever you want it to capture.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Fri May 09, 2008 12:13 pm   
 
Fang Xianfu wrote:
You can also use local variables with ($localvar:something) in both regex and normal triggers, where "something" is whatever you want it to capture.

I think you can set database variables as well e.g &dbvarname.membername. Is it possible to have a local variable be a database variable? So you could capture $localvar.member?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Fri May 09, 2008 12:20 pm   
 
I believe so, but I've never tried it. Have a go.
_________________
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