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


Joined: 10 Jan 2002
Posts: 5
Location: USA

PostPosted: Thu Jan 10, 2002 10:20 pm   

Need help trigger and variable.
 
I need to match this string, but also keep it from being matched when the line begins with "you" while also saving the 1st word as a variable. Here is what I have:

^{^You} * you.$

I want to trip the trigger whenever someone does something to me. The syntax of the MUD makes it so it's almost always "Guy kicks you." or "Guy laughs at you." However, I *don't* want to trip it when I receive something like "You notice a guy sneaking by you." However, for my purposes I also need to capture the 1st word so %1="Guy". I tried

^({^You}) * you.$

but that produces a recursively smaller list of variables and it's impossible to know which one is the 1st word because lines can be any length.
(it outputs
%1Guy kicks you.
%2Guy kicks you
%3Guy kicks yo
%4Guy kicks y
etc...)

thanks.
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Thu Jan 10, 2002 10:23 pm   
 
Try this:

#trigger {^(%w) * you.} {#if (%1!=You) {#var enemy %1}}


Iljhar
Reply with quote
Penance
Newbie


Joined: 10 Jan 2002
Posts: 5
Location: USA

PostPosted: Thu Jan 10, 2002 10:58 pm   
 
awesome, I got it working. One more thing, is there a way to check %1 against more then 1 string? For example, could I check to make sure it's not equal to "you" or "a"?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Jan 11, 2002 12:18 am   
 
Yes, use the and operator:
#TRIGGER {^(%w) * you.} {#IF ((%1 != "You") and (%1 != "A")) {#VAR enemy %1}}

Kjata
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