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
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Tue Sep 28, 2010 9:38 pm   

[3.29b] dbvar pattern skipping values
 
I made these setting in a empty session:
Code:
<var name="numbers" type="Record" id="1">
    <value>one=1|two=2|three=3|four=4|five=5</value>
    <json>{"two":2,"one":1,"three":3,"four":4,"five":5}</json>
  </var>
  <trigger priority="20" repeat="true" id="2">
    <pattern>({@numbers})</pattern>
    <value><![CDATA[$num=%1;#SUB {<send '#SAY {$num equals @numbers.$num}|#NOOP' 'What was i?|Nothing'><color firebrick>@numbers.$num</color></send>}]]></value>
  </trigger>


For some reason this seems to be skipping some values. I entered the following commands:

#SAY {one}
#SAY {one two three four}
#SAY {'one' 'two' 'three' 'four'}
#SAY {'one' 'two' 'three' 'four' 'five'}

And got the following output:



I found this trying to reproduce the error in a more complicated script that is completely hanging CMUD.


P.S. Why is the json value in a different order then the normal value in the XML for the variable?
_________________
Discord: Shalimarwildcat
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Sep 29, 2010 5:40 pm   
 
Confirmed and added to bug list.

Quote:
P.S. Why is the json value in a different order then the normal value in the XML for the variable?

Because JSON stores values in order of it's hash algorithm and doesn't have any knowledge of the order the items were actually added to the list. Whereas the normal value of the variable tries to keep track of the creation order (at least within the session the variable was created). In general you should not rely upon the order of items in a database variable.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Sep 29, 2010 6:02 pm   
 
But you can still reference them via position (aka %isvalue() and %dbkey()) which definitely good to note.
_________________
Listen to my Guitar - If you like it, listen to more
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