Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Dwoggurd
Wanderer


Joined: 29 Jan 2008
Posts: 63

PostPosted: 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>
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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 ""
Reply with quote
Dwoggurd
Wanderer


Joined: 29 Jan 2008
Posts: 63

PostPosted: 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?
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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