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
Neuro
Beginner


Joined: 22 Feb 2007
Posts: 19

PostPosted: Thu Feb 21, 2008 5:28 am   

Capturing a number in a VAR..
 
(Glowing) a Solstice Potion (17)
(Glowing) a glowing violet potion (258)
a dispel magic potion (22)

Say I wanted to capture the quantity of my violet potions in a variable, when I examine the container.

Just doing, #trigger {(glowing) a glowing violet potion ((%w))} isn't doing anything, and is that because of the (( ))?

I'm not even sure how to word this question, heh. Hopefully someone just knows what I mean.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu Feb 21, 2008 6:08 am   
 
Try
Code:
 #TRIGGER {~(Glowing~) a glowing violet potion (~(%d~))}
That might work better IMHO.
Even better use a regex pattern...
Code:
#TRIGGER {(\(Glowing\) a glowing violet potion (\(\d+\))}
which is probably faster.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Feb 21, 2008 6:25 am   
 
%w captures a word, %d captures a number. You can look at Pattern Matching for more info.
_________________
Asati di tempari!
Reply with quote
Neuro
Beginner


Joined: 22 Feb 2007
Posts: 19

PostPosted: Thu Feb 21, 2008 7:03 am   
 
IGNORE THIS, got it. thanks. (had another question here but figured it out)
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Feb 21, 2008 11:19 am   
 
Anaristos wrote:
use a regex pattern... which is probably faster.

A regex will only be about 0.000001s faster, and only the first time a trigger fires for that session. The only difference between a CMUD pattern and a regex is that CMUD patterns need to be converted into regexes before they're compiled. Once that happens, there's no speed benefit to using a regex.
_________________
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