|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Mon Jun 23, 2008 4:34 pm
[2.28] bug: %null and #IF |
This trigger does not compile:
Code: |
<trigger priority="1920" regex="true" id="192">
<pattern>te(s)t</pattern>
<value>#IF (%1 != %null | %1 != "s")
{
#SAY wtf
}</value>
</trigger> |
However, if I change the order of subexpressions it works:
Code: |
<trigger priority="1920" regex="true" id="192">
<pattern>te(s)t</pattern>
<value>#IF (%1 != "s" | %1 != %null)
{
#SAY wtf
}</value>
</trigger>
|
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jun 23, 2008 5:10 pm |
The correct "OR" operator is || and not just |
But also, I think your logic is wrong for that test. I think you probably want an && for AND instead of doing an OR. Finally, you can also use the %isnull(%1) to test if a variable is really null, or just compare it to the empty string "" |
|
|
|
Dwoggurd Wanderer
Joined: 29 Jan 2008 Posts: 63
|
Posted: Mon Jun 23, 2008 5:15 pm |
Thanks for clarification.
I don't care about logic, this is just a test trigger. I wondered why it did not compile.
Still, what does "|" operator mean and why it does not compile in the first case but works fine in the second? |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jun 23, 2008 5:22 pm |
The | character is used for string lists these days. It used to be used for the OR operation in zMUD and there is some compatibility code that tries to parse it as the OR operator in some cases, but it is very parser dependent. It's listed as one of the Changes for zMUD users here: AND OR operators changed
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Mon Jun 23, 2008 8:14 pm |
It will also show up in the Compatibility Report as a problem in most cases.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
|
|