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


Joined: 06 Feb 2002
Posts: 2

PostPosted: Wed Feb 06, 2002 2:25 am   

Logical NOT in Triggers
 
I need help on understanding the usage of logical NOT within triggers.

I can use and understand OR, such as:
#TR {something|another} {reaction}

However, the help file says:
{^string} do not match the specified string

When using the above syntax, I can not make it work as I'd expect.

A simple example of this: If I wanted to trigger the text of "tells you" from everyone except Bob, I'd use something like

#tr {tells you|{^Bob tells you}} {#co red}

This however does not work for me.

Any suggestions? Is it even possible?

Thanks
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Feb 06, 2002 3:17 am   
 
I've always used that matching like:

#TRIGGER {{^Bob} tells you} {#CO red}
Matches everything but
*Bob tells you

so I unmatch where I don't want things.

TonDiening
Uses 6.16
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Feb 06, 2002 3:51 am   
 
You are confusing operators with pattern expressions. In patterns, you cannot use operators such as +, -, *, /, >=, <=, |, &, etc. and have it work as it does with expressions that evaluate to some value. Simalarly, in expression, you cannot use wildcards and pattern expressions such as %w, %d, %x, *, [range], etc. and have it work as it does with patterns.

So, you use operators in expressions like:
var1 = 5 + 2
var2 = 3 * 4 / 2 - 5
var3 = (3 < 4)
var4 = ((@var1 > 3) or (@var2 < 2))
var5 = ((!(@var3) & (@var2 >= 8)) | (@var4))

You use wildcards and pattern expressions in patterns like:
* tells you
{Zugg|Kjata} is here
%w give %w to %w
You receive %d coins

What you mentioned is a particular case that happens to do what you want but because of a reason different from what you thought. You are thinking about the logical OR operator and using it to tell zMUD to match one string or another by doing this:
{string1|string2}

This works, but not because you are using the OR operator, but because you are using the pattern expression of the form:
{stringlist}

which matches one of the strings of the stringlist (each item in a stringlist is separated by a |) Now, there is another pattern expression of the form:
{^string}

which means that where you place that, zMUD will match anything except the string you supplied. You cannot put this inside the pattern expression I discussed previously ({stringlist}) since it only accepts a stringlist which is composed of strings, not wildcards or pattern expressions.

If you want the trigger to fire everytime you see tells you but not if what is before it is Bob, then you do this:
#TR {{^Bob} tells you} {commands}
just like TonDiening said. What you are saying to zMUD here is to not match Bob (so instead it will match anything else) followed by the text "tells you".

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