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
mortie
Wanderer


Joined: 26 Sep 2002
Posts: 73
Location: United Kingdom

PostPosted: Wed Nov 03, 2004 11:33 pm   

data record problem
 
Hi,

I have an equipment db which i add to using a data record.

syntax in triggers that i use is


#addkey recordname keyword %trim(%1)
and so on

Ive noticed that if i have the following item (and similar) to add to the db


keyword pole arm
Name ----Pete's Polearm-----)>
weight 18

etc


the data record gets entered as follows

recordname:

data record view

keyword |pole arm - as it should
Name |----Pete's Polearm-----)>weight|type|level|etc|etc - incorrect


instead of

recordname:

keyword |pole arm
Name |----Pete's Polearm-----)>
weight |18

etc

I know its to do with the meta characters. How do i prevent this from happening?


Thanks


Mortie
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Nov 05, 2004 8:32 am   
 
Use %subchar to get rid of them before adding it to the record. The biggest one to cause a problem is parenthesis "()". They are used internally to preform nesting of lists and records within lists and records.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
mortie
Wanderer


Joined: 26 Sep 2002
Posts: 73
Location: United Kingdom

PostPosted: Sat Nov 06, 2004 1:29 pm   
 
Thanks for the reply.

I thought about using %subchar but this posses a problem for adding certain items to my db from the mud

E.g one item is this:-

:::[======-

or lets say it was

:::([======-

another item

.=very large club=.

or

+->sword>-+

For the ones with words i could remove all the symbols and still have something to put into the db.However, with
the first example i would have a blank entry. Do i use %subchar to get rid of the big problem causers like paranthesis as you mentioned and hope the others dont mess the script up?
Reply with quote
mortie
Wanderer


Joined: 26 Sep 2002
Posts: 73
Location: United Kingdom

PostPosted: Thu Nov 11, 2004 10:09 am   
 
Hi,

Has anyone got any ideas on this? Would some sort of translation be a solution? i.e :::[======- convert to some other characters before updating to the DB?
Or is there a way to encapsulate the meta characters so that it can be entered into the datarecord correctly?

Mortie
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Tue Nov 16, 2004 5:34 pm   
 
Regarding your problem. You don't have to replace every char, only parentheses, and "" symbols. Parentheses because as Vijilante said they're used internally for nesting and grouping. Similarly, "" symbols are used to group parameters supplied to commands.
Any item containing only these will of course be a problem, but its doubtful you'd have very many. A record named :::[======- shouldn't cause a problem. You wouldn't need to replace any of the characters. So long as you're careful to group each field to be added to the database with "" or {}.
Reply with quote
mortie
Wanderer


Joined: 26 Sep 2002
Posts: 73
Location: United Kingdom

PostPosted: Tue Nov 16, 2004 6:42 pm   
 
Thanks Danlo. Tested it with a few variations and it works.
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