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
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Fri Jun 11, 2010 4:04 am   

[3.19] BUG: List doesn't import from 3.17 properly.
 
This string list doesn't get converted correctly. The two items with the %if functions in them lose information.

3.17:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <var name="tree_affs" type="StringList" copy="yes">asthma|impatience|earthrot|dizziness|masochism|relapsing|itching|dementia|generosity|madness|blurry_vision|shyness|crippled_throat|vomiting|stupidity|addiction|plodding|confusion|anorexia|justice|stuttering|idiocy|hallucinations|deadening|vertigo|haemophilia|aeon|darkshade|epilepsy|shivering|agoraphobia|claustrophobia|weakness|clumsiness|ablaze|frozen|hatred|loneliness|%if( (%db( @afflictions, broken_arm) == 2 and %db(@afflictions, damaged_left_arm) and %db(@afflictions, damaged_right_arm)) or (%db( @afflictions, broken_arm) == 1 and (%db(@afflictions, damaged_left_arm) or %db(@afflictions, damaged_right_arm))),%null,broken_arm)|lethargy|hellsight|dissonance|hypochondria|sensitivity|paranoia|body_odor|disloyalty|slickness|hypersomnia|blood_aff|recklessness|%if( (%db( @afflictions, broken_leg) == 2 and %db( @afflictions, damaged_left_leg) and %db( @afflictions, damaged_right_leg)) or (%db( @afflictions, broken_leg) == 1 and (%db( @afflictions, damaged_left_leg) or %db( @afflictions, damaged_right_leg))), %null, broken_leg)|broken_limb|unknown_focus|unknown</var>
</cmud>


3.19 alpha:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <var name="tree_affs" type="StringList" copy="yes">
    <value>asthma|impatience|earthrot|dizziness|masochism|relapsing|itching|dementia|generosity|madness|blurry_vision|shyness|crippled_throat|vomiting|stupidity|addiction|plodding|confusion|anorexia|justice|stuttering|idiocy|hallucinations|deadening|vertigo|haemophilia|aeon|darkshade|epilepsy|shivering|agoraphobia|claustrophobia|weakness|clumsiness|ablaze|frozen|hatred|loneliness|%if( (%db( @afflictions, broken_arm) |lethargy|hellsight|dissonance|hypochondria|sensitivity|paranoia|body_odor|disloyalty|slickness|hypersomnia|blood_aff|recklessness|%if( (%db( @afflictions, broken_leg) |broken_limb|unknown_focus|unknown</value>
    <json>["asthma","impatience","earthrot","dizziness","masochism","relapsing","itching","dementia","generosity","madness","blurry_vision","shyness","crippled_throat","vomiting","stupidity","addiction","plodding","confusion","anorexia","justice","stuttering","idiocy","hallucinations","deadening","vertigo","haemophilia","aeon","darkshade","epilepsy","shivering","agoraphobia","claustrophobia","weakness","clumsiness","ablaze","frozen","hatred","loneliness",{"%if( (%db( @afflictions, broken_arm) ":{}},"lethargy","hellsight","dissonance","hypochondria","sensitivity","paranoia","body_odor","disloyalty","slickness","hypersomnia","blood_aff","recklessness",{"%if( (%db( @afflictions, broken_leg) ":{}},"broken_limb","unknown_focus","unknown"]</json>
  </var>
</cmud>
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Jun 11, 2010 1:46 pm   
 
You have a string list that contains functions? How odd. How do you use it?
Reply with quote
Zugg
MASTER


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

PostPosted: Fri Jun 11, 2010 6:05 pm   
 
The problem is the == in those items. That is making CMUD think that this is a database variable instead of a string list.

In the newer versions of CMUD, it tries to create a nested table. So when importing this string list, when it gets to the item with the ==, it gets treated as a "key=value" nested database variable.

If you do a #VAR tree_affs you will see the json table that is created and will see those keys.

Unfortunately, this is one of those cases where the old string list syntax does not properly represent the true variable structure.
With the new json table, you should be able to recreate this variable by putting quotes around the function call so that CMUD treats it as a literal string and not as a nested db variable.
But I'm not sure I see any way to properly import this list and still properly handle normal nested database variables that other people might have.
It's a case where you were pushing what could be done in the old system and it just doesn't convert properly into the new system and will require you to edit it.
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Fri Jun 11, 2010 6:39 pm   
 
That's along the lines of what I was thinking, Zugg.. Also rehab, I use %expand when referencing the variable.
Reply with quote
Zugg
MASTER


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

PostPosted: Fri Jun 11, 2010 7:27 pm   
 
OK, I found a way to deal with this specific case. The actual problem was that your function item has a format like this:

key1=key2=value...

this was causing CMUD to try and create sub-tables within sub-tables. Since this syntax for nested tables was never supported, I modified CMUD to not allow this.
The correct syntax that CMUD generates for nested sub-tables is:

key1="key2=value"

So I fixed it to only created nested tables when the "" are properly placed around the sublist. Since your %if functions don't have the " after the =, they get imported correctly now.
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