|
Thandril Adept
Joined: 03 Dec 2000 Posts: 260
|
Posted: 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. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: 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 |
|
|
|
|
|