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


Joined: 04 Oct 2005
Posts: 20

PostPosted: Thu Nov 03, 2005 11:42 pm   

Really tough one..
 
I want to capture these...


[Spells Memorized]
1: ( 3)create food ( 2)create water ( 4)cure light
( 1)know alignment
2: ( 1)bless ( 1)detect invisibility ( 1)infravision
( 3)cure serious ( 1)protection from good
3: ( 4)cure critic ( 1)summon ( 1)sense life
( 1)aid

[Spells Being Memorized]
2: ( 1h)protection from evil
5: ( 1h)magic vestment ( 1h)sanctuary

And put them into variables, preferably I would capture what I really care about is memed, not what is being memed... any ideas how i can capture this... and put the ( 3) into a varable.. like @create_food_count
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Thu Nov 03, 2005 11:57 pm   
 
well.. if you got a small amount of things that you need to capture..
#trigger {~( (%n)~)create food} {#var createFoodCount {%1}
#trigger {~( (%n)~)create water} {#var createWaterCount {%1}
etc etc...
or...
#var spellList {createfood|createwater|curelight}
#trigger {~( (%n)~)(*){$|~(}} {#forall {@spelllist} {#if (%replace(%2," ", "") = %i) {#var %replace(%2," ", "")count {%1}} } }
that second one may need some tweaking... but I just noticed the clock hit 8.. and that means I am outta work.. I might work on it some more later
Reply with quote
cxs410
Beginner


Joined: 04 Oct 2005
Posts: 20

PostPosted: Fri Nov 04, 2005 12:22 am   
 
ok the first way works, but what needs to change if the variable is (10)create food that seems to not work..
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Fri Nov 04, 2005 2:44 am   
 
#trigger {~({ (%n)|(%n)}~)create food} {etc}
Reply with quote
cxs410
Beginner


Joined: 04 Oct 2005
Posts: 20

PostPosted: Fri Nov 04, 2005 3:41 am   
 
That doesn't seem to work...

(10)cure light hrmm.
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Fri Nov 04, 2005 7:03 am   
 
guess you gotta go two seperate triggers... since if it's only 1 digit.. it's tossing a space in there
#trigger {~((%n)~)create food} {etc}
and
#trigger {~( (%n)~)create food} {etc}
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Fri Nov 04, 2005 1:34 pm   
 
rather than %n just use %d
_________________
http://www.Aardwolf.com
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Fri Nov 04, 2005 3:53 pm   
 
Just a question, what's the major difference? the only difference I know is that %n will capture commas... does %d do variable spaces around it?
Reply with quote
Tech
GURU


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

PostPosted: Fri Nov 04, 2005 4:30 pm   
 
You can see here for more information on pattern matching..

Quote:

%d match any number of digits (0-9)

%n match a number that starts with a + or - sign
_________________
Asati di tempari!
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Nov 04, 2005 8:56 pm   
 
And actully this can be accomplished with 1 trigger using Fixed-Width matching


#TRIGGER {~((&2))~)create food} {#SAY %trim("%1")}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Sat Nov 05, 2005 3:20 am   
 
Can I ask where Fixed-Width matching is listed in helps any chance?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Nov 05, 2005 3:43 am   
 
Pattern Matching &nn matches exactly nn characters (fixed width pattern)
_________________
Zmud Support Library
Zmud Knowledge Base
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