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
glowack2
Newbie


Joined: 26 Oct 2002
Posts: 5
Location: USA

PostPosted: Tue Dec 09, 2003 4:46 am   

Trouble handling doublequote character
 
OK, I'm trying to work on a script that stores item names and stats in a database automatically. The problem is that some items have double-quotes in their names. Obviously " is a special character, but I can't seem to figure out the proper way to handle it in various situations: triggers, variables, the database, and echo.

With Zmud 6.66beta and #regex I can finally get the trigger to work and now " will show up in %1, and I'm able to assign them to a variable successfully. All good so far. Now we have

@ObjectName = Something "with quotes"

Then we try a few commands with the variable:

#echo @ObjectName
Outputs: Something with quotes

#addkey NewEQ Name {@ObjectName}
(or alternately without the {}, same thing happens)
@NewEQ now contains: Name = Something with quotes

Note that all the " are now missing... So how do I deal with this variable that has quotes? How do I get its contents into the database? Been pondering this one, reading the forum and help files, and there doesn't seem to be any information on it...

-ED
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Dec 09, 2003 6:44 am   
 
Use the #VARIABLE method to assign things?
#VAR ObjectName {Something "with quotes"}
Reply with quote
glowack2
Newbie


Joined: 26 Oct 2002
Posts: 5
Location: USA

PostPosted: Tue Dec 09, 2003 4:36 pm   
 
I got it into the variable OK, when I look at the variable's contents in the GUI it shows the correct version with the double-quotes. I guess I should have been more clear that that particular step works. Once it's in the variable, the #echo and #addkey are the ones that don't seem to work properly.

-ED
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Dec 09, 2003 6:07 pm   
 
Expand it with one level then.

#ADDKEY NewEQ Name %expand(@objectname,1)
Reply with quote
glowack2
Newbie


Joined: 26 Oct 2002
Posts: 5
Location: USA

PostPosted: Wed Dec 10, 2003 12:47 am   
 
OK, that seemed to work... Also had to do the same expand again when I do the call to #new to add the object to the database:

#new equipment_type %expand(@NewEQ,1)

All told, it looks like everything makes it properly all the way from the trigger into the database and back out again, so I think I'm all set... Thanks for the help! =)

-ED
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