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


Joined: 07 Jan 2003
Posts: 23

PostPosted: Mon Mar 03, 2003 3:43 am   

Matching variables
 
In the pattern:
^You {step|kick|smash|circle kick|stomp|stomp-kick|spin-kick|lunge|attack|leg-twist|side-kick|thud|gouge|strike|bearhug|jump-kick|back-kick|SNAP-KICK|FLY-KICK}

How would I find out which variable matched?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Mar 03, 2003 3:52 am   
 
In the pattern:
^You ({step|kick|smash|circle kick|stomp|stomp-kick|spin-kick|lunge|attack|leg-twist|side-kick|thud|gouge|strike|bearhug|jump-kick|back-kick|SNAP-KICK|FLY-KICK})

Value:
#VAR Match {%1}

Ton Diening
Reply with quote
Gage
Beginner


Joined: 07 Jan 2003
Posts: 23

PostPosted: Mon Mar 03, 2003 4:50 am   
 
Hum, That doesn't seem to be working correctly.

This is what I have:

#CW white
@attack_match = %1
#IF ( @attack_match == "circle kick") {
say test
}

I have also had it VAR attack_match %1, but that did not work either.

I don't really care about the attack_match variable, I just want to be able to match which attach was detected with either an IF statement or a CASE statement if zmud supports those.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Mar 03, 2003 5:29 am   
 
#VAR attack_match {%1}

LightBulb
Advanced Member
Reply with quote
Gage
Beginner


Joined: 07 Jan 2003
Posts: 23

PostPosted: Sat Mar 29, 2003 10:52 am   
 
#VAR attack_match {%1} isn't capturing what I need either.

And I'm finding alot of uses for this....

Heres another example of what I would like to do:

Pattern:
^%1 {type1|type2|type3} {coin|coins}$

Action:

Get %2

OR

#VAR temp {%2}
get @temp

However, the value of the {type1|type2|type3} list doesn't seem to be saving in the %2 variable.

Any sugestions?
Reply with quote
Wrudyn
Novice


Joined: 24 Mar 2003
Posts: 44
Location: USA

PostPosted: Sat Mar 29, 2003 11:09 am   
 
^%1 ({type1|type2|type3}) {coin|coins}$

The parenthesis are important. And you really shouldn't use %1 in a trigger pattern. Use * if you need to match several things at once, but in your case you can take out the whole ^%1 and it won't make a difference.
Reply with quote
Gage
Beginner


Joined: 07 Jan 2003
Posts: 23

PostPosted: Sat Mar 29, 2003 12:00 pm   
 
Got it with this...

Pattern:
^(*) ({type1|type2|type3}) {coin|coins}$

Action:

get "%2"

Now I just have to do the same for the first one.

Thanks all who help,

Gage
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