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


Joined: 03 Dec 2000
Posts: 260

PostPosted: Sat Aug 14, 2004 10:46 pm   

Is this the correct way compare?
 
Hi all, I have the following as part of a trigger. I'm getting bad results I didn't get with previous versions of zMud. You can set up an alias to run this code. The sample is:

Code:

#var itemlist "a 1|a 1|b|c |d 2"
#var singlist "a 1|b|c |d 2"
#FORALL @singlist {
  #VAR count 0
  #VAR check {%i}
  #FORALL @itemlist {
    #IF (%j = @check) {
      #echo %j " matches " @check
      #ADD count 1
      #VAR itemlist %delitem( @check, @itemlist)
      }
    }
  #SHOW @count x @check
  }

The output shows "d 2" as matching everything. If I 'quote' %j and @check inside curly braces then the code works much better but does not match the "c " section. Is there a way to match this too? Fortunately that example of a space following the text doesn't happen as far as I can tell but it's still strange. Should I be using a different quoting mechanism or some other way to compare the results?

Thanks for any advice, gurus.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Aug 15, 2004 1:35 am   
 
The only change I would suggest is add quotes around the %j here:
#IF ("%j" = @check) {
_________________
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 » 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