Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Sep 13, 2010 5:15 pm   

[3.26] Bug with #ADDKEY, commas, and database variable values
 
I discovered this in 3.25, it still happens in 3.26, I imagine it's been around since all of the similar bugs with #ADDKEY cropped up. Here's an alias to replicate the error:
Code:

<alias name="test_db" id="1645">
  <value>#LOCAL $testdb $time

#LOOP 10 {#ADDKEY $time %concat("Time", %i) %secs}

#ADDKEY $testdb %params $time.Time9

#show %dbkeys($testdb)": "%db($testdb, %params)</value>
</alias>


Type in: test_db This is a test

That should work just fine: "This is a test: 1267103" (number will likely be different)

Type in: test_db This is, a test

This will fail and you will get: "This is: "

The problem is the comma. I tried replicating this using #ADDKEY with a static value, but it worked, similarly with just a normal variable. This bug is only reproduced if you try to use a comma for the key when the value is given via another database variable. This may seem a small issue, but I ran into it because it causes problems with my equipment script, which uses equipment short descriptions as keys for whether or not an object is blessed, and gives the time for the object being blessed from a database variable which holds several values depending on the character.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Sep 13, 2010 6:21 pm   
 
Confirmed and added to bug list. Looks like the json parser I'm using doesn't like commas in the key string.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Mon Sep 13, 2010 6:25 pm   
 
I'd have to run some test scripts but I'm pretty sure that's not allowed. In your second example, your basically creating a variable with punctuation in the name. You might be able to get away with if you quote (using the curly braces) the $time local variable.

(Edit: Never mind, again. Embarassed Maybe I just need to step away from the PC for a little bit.)
_________________
Asati di tempari!
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Sep 13, 2010 6:33 pm   
 
Zugg wrote:
Confirmed and added to bug list. Looks like the json parser I'm using doesn't like commas in the key string.


I figured something like this was the issue, though, by the sounds of it, you seem fine with commas in the key string I hope Very Happy
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Sep 16, 2010 4:47 pm   
 
OK, this is a weird one. The problem isn't actually with the comma directly. If you just do this in your script:
Code:
#ADDKEY $testdb %params %secs

then it works fine. It's something about the $time.9 in combination with the commas in %params. I'm still working on this.
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Sep 16, 2010 4:57 pm   
 
Nevermind, I found it. It *was* an issue in the json parser dealing with commas in a certain situation. Fixed for the next version.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu Sep 16, 2010 6:18 pm   
 
Thanks, Zugg. I didn't notice a ton of bugs reported for 3.26, feeling close to a release possibly? :D
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Sep 16, 2010 7:34 pm   
 
Hopefully a "soft release" this weekend. Still have a few more bugs and documentation to work on.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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