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
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sun Nov 18, 2007 12:02 am   

Problem processing strings which include parentheses.
 
When searching room names, I sometimes have to create a string that contains a "(G)" in room names.. Example: "The Dark Altar (G) [** PK **]".
No matter what I do, I cannot find the entry for that room, or any room with the "(G)" included. I've tried using %concat(%char(40), "G",%char(41)), and still it fails. I know that the cMUD parser treats parentheses as special even if they are within a string. I've had to put quotes around strings that contains them.
So the question is... How do I get around this problem? One would think that using %char(40) and %char(41) would have solved the problems, after all, that is the one of the purposes of %char(), to escape special characters.
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Tue Nov 27, 2007 4:14 am   
 
Untested however; How about trying something using %expand?
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Zugg
MASTER


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

PostPosted: Tue Nov 27, 2007 5:58 am   
 
Maybe this is something that is fixed in the beta version already, but in v2.13 you can just do this:

RoomName = "The Dark Altar (G) [** PK **]"

and it works fine. So you need to give us more details on exactly how you are trying to set a variable to a string value, or exactly how you are searching.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Tue Nov 27, 2007 3:37 pm   
 
Are you talking about using %mapquery?

RoomName = "The Dark Altar (G) [** PK **]"

If so then you can do this.

RoomName = %subchar(@RoomName, ")(", "%%")

#show %mapquery(%concat("Name LIKE '%",@RoomName,"%'"))

You will also need to replace things like ? and ' for some of your queries to work correctly.

Apologies if this doesn't apply to your problem but you were a little vague about your question.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
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