 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Jun 04, 2010 11:02 pm
[3.18d]BUG: Variables not firing properly unless used with %list() |
In at least 3.18a (maybe later versions, not 100% sure), doing:
| Code: |
| #SAY {%item(%db(@PData, %db(@PortalData, "Held Portal")),1)} |
would display:
| Code: |
| amulet aardwolf (294217) |
properly. Now, it displays nothing at all.
Variables are as below:
| Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<var name="Pdata" type="Record" json="true" copy="yes">{"ImmortalHomes":"amulet aardwolf (294217)|1|bag1|1|0|1|13299"}</var>
<var name="PortalData" type="Record" json="true" copy="yes">{"Held Portal":"ImmortalHomes"}</var>
</cmud>
|
Charneus |
|
Last edited by charneus on Sat Jun 05, 2010 12:13 am; edited 1 time in total |
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sat Jun 05, 2010 12:06 am |
As an update, I've determined that surrounding it with %list makes it work again. While this is a workaround, to do this for the 300+ db variables I have in all the scripts I have would be absurd.
Charneus |
|
|
|
 |
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Sat Jun 05, 2010 1:47 am |
Okay, I've been editing this post over and over, because I keep on thinking I've figured it out.
If you import the xml, edit the variables and change them back, then it appears to work. |
|
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sat Jun 05, 2010 2:30 am |
Edit them how, though? Remove the json=true, etc? Even so, that's a LOT of variables I need to change in that matter...
Charneus |
|
|
|
 |
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Sat Jun 05, 2010 2:36 am |
Do anything that enables the save button, revert the change, and then save.
Though, if you cut/paste them again after that, they stop working.
I can't see any difference in the XML or JSON table after doing so. |
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Sat Jun 05, 2010 5:13 pm |
I'll take a look at this. Even if the variables don't get converted to json on input, they should still get converted to json "on the fly" when you start using the various db functions. In other words, the %item function is supposed to take the string of "(294217)|1|bag1|1|0|1|13299" and convert it to a json list anyway, even if the json table hasn't already been constructed from the original nested item.
So this is still a bug and something I'll try to fix.
How does the Pdata variable get created initially? I'm curious why the nested string list is just created as a string and not a list. Are you not using #ADDITEM to create the nested list? |
|
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sat Jun 05, 2010 5:32 pm |
Not using #ADDITEM, but rather doing #ADDKEY PData {Key} {Item1|Item2|Item3|Item4}.
If I should be using #ADDITEM, I can start changing scripts for it, but I figured it'd work either way, since for years it's worked as #ADDKEY DBVar Key ItemList.
Charneus |
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jun 07, 2010 4:56 pm |
See, that's odd. Because when I do:
| Code: |
| #ADDKEY PData {Key} {Item1|Item2|Item3|Item4} |
in a blank session and then go look at the XML for the PData variable, I get this:
| Code: |
| <var name="PData" type="Record" json="true" id="1">{"Key":["Item1","Item2","Item3","Item4"]}</var> |
which shows the proper json format rather than the old stringlist format.
So are you *sure* you are using the above method to create your variable? Or was the variable imported from a previous version (and thus getting the bug dealing with reading in old variables)? |
|
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Mon Jun 07, 2010 5:10 pm |
Well, you asked how it gets created initially. It was imported from a previous version, not created in this version. However, as I stated, it worked in 3.18a, but stopped working in 3.18d (at least, could have been b or c, too). Either way, I think the root cause had been identified in the couple other threads regarding variables. :P
Charneus |
|
|
|
 |
|
|
|