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
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Sat Aug 27, 2005 5:13 pm   

inconsistent behavior in an #IF
 
Using
Code:
#TRIGGER {^test (%x)} {#SHOW |%pos( bc~), "%1")| |%pos( bc, "%1")| |%pos( bc~), %1)| |%pos( bc, %1)|;#IF (%pos( bc~), "%1")>0) {#SHOW true with paren with quote};#IF (%pos( bc, "%1")>0) {#SHOW true without paren with quote};#IF (%pos( bc~), %1)>0) {#SHOW true with paren without quote};#IF (%pos( bc, %1)>0) {#SHOW true without paren without quote}}

and then saying "#SHOW test 1,(abc)", I get the output:
Code:
test 1,(abc)
|5| |5| |0| |0|
true without paren with quote
true with paren without quote

I would have expected both of the first two 'if's to be triggered but neither of the last two (but only because of the rather non-intuitive behavior of parsing for argument separators inside of replaced strings).
Reply with quote
Private
Adept


Joined: 10 Jan 2002
Posts: 264
Location: USA

PostPosted: Sun Aug 28, 2005 12:03 pm   
 
Code:

#SHOW %pos( "~)", "%1")
#IF (%pos( "~)", "%1")>0) {#SHOW true with paren with quote} {#SHOW false}
#SHOW %pos( bc, "%1")
#IF (%pos( bc, "%1")>0) {#SHOW true without paren with quote} {#SHOW false}
#SHOW %pos( "bc~)", %1)
#IF (%pos( "bc~)", %1)>0) {#SHOW true with paren without quote} {#SHOW false}
#SHOW %pos( "bc", %1)
#IF (%pos( "bc", %1)>0) {#SHOW true without paren without quote} {#SHOW false}


quotes make a difference.
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