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


Joined: 18 Dec 2005
Posts: 246

PostPosted: Sun Dec 24, 2006 3:12 am   

Matching a a multi word variable to a multi word list
 
I have a variable called newname which may contain a multi word value (i.e. huge bone helmet.txt) and the @directlist value is a string list of multi word values (i.e. huge bastard sword).
Code:
%ismember(%lower(@newname),@directlist)

However when I run this bit of code, it appears to match only the first word, so If I run this with huge bone helmet as the value for @newname, but it is not in the @directlist string list, it still returns true... I tried to place quotes around %lower(@newname) but that didnt work... any suggestions on how to match this?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Dec 24, 2006 3:38 am   
 
Quotes will turn stuff within them into literal strings that don't get parsed at all. If you want the parsing, use curly braces.
_________________
EDIT: I didn't like my old signature
Reply with quote
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Sun Dec 24, 2006 4:06 am   
 
{%lower(@newname)} did it... Although I don't understand why... hehe. Thanks!
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Dec 24, 2006 6:36 am   
 
It's because of how CMud parses things by using whitespace as a boundary. Without the {} CMud gets confused and doesn't always count correctly, or figures out what the correct number should be and ignores anything else. The braces tell CMud that the stuff within is considered one entity.
_________________
EDIT: I didn't like my old signature
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