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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sat Feb 05, 2011 7:00 am   

[333a] Variable with mismatched XML/JSON/Display values.
 
I keep finding this problem, I've tried to ignore it but it has become chronic, so here is the post:
Certain scripts are misbehaving even though the variable(s) they work with supposedly have the correct value.
As it turns out only the Text tab shows the "correct value.
Here is an example:
Variable name: qmzone
Text tab display: Ultima
However here is the XML
Code:

<var name="qmzone" id="460">
  <value>Fantasy Fields</value>
  <json>Fantasy Fields</json>
</var>

The JSON tab
Code:

"Fantasy Fields"

which also matches the compiled code.

Another example:

Variable name: qmroom
Display value: Sacrifice Street

Here is the XML
Code:

<var name="qmroom" id="860">
  <value>Faeriefog + GreyAsh</value>
  <json>Faeriefog + GreyAsh</json>
</var>

The JSON and Compile tabs follow the pattern above, that is they match the XML, but not the display tab.
The consistent thing is that the display values shown above resided in the variables some time in the past, but not the immediate past.
The script ran with those values, then it ran with other values for a while until it failed with the values as shown. The values are obtained
dynamically from the GMCP triggers and are delivered to the client when a quest is requested. Each time the request values come in
the above variables are re-initialized. The values are being stored (apparently, since the display tab shows the "correct" value) but since it is not
the compiled value, it has no use.
Now, this is my observation of the problem. I have no idea why it is happening or how it is happening. The scripts are as old as GMCP, meaning that they
executed successfully over 2000 times (2000+ quest requests serviced) with no problem. Suddenly this begins to happen.
To make it even more peculiar the value Fantasy Fields is from a request that came in on the previous mud session and Faeriefog + GrayAsh
was the first request of this session. There have been 7 requests since that one.
The routine that fills the variables with their current values is this one:
Code:

<alias name="qmstart" id="467">
  <value>qmmob    = $qdb.targ
qmroom   = $qdb.room
qmzone   = $qdb.area
qmtimer  = $qdb.timer
;;
qminit
;;
qmproc</value>
  <arglist>$qdb</arglist>
</alias>

The above routine is called by this one which in turned is called by the GCMP trigger handler.
Code:

<alias name="questman" id="448">
  <value>#WINDOW @gmcpwin {@cup( 34, 1)@eol}
;;
$qdb = %ref( questdb)
;;
#SWITCH ($qdb.action)
        ("start")   {qmstart  $qdb}
        ("fail")    {qmfail   $qdb}
        ("comp")    {qmcomp   $qdb}
        ("timeout") {qmtout   $qdb}
        ("killed")  {qmkilled $qdb}
        ("warning") {qmwarned $qdb}
        ("ready")   {qmready  $qdb}
        ("reset")   {qmreset  $qdb}
        ("status")  {qmstatus $qdb}
                    {qmunk    $qdb}</value>
</alias>

And finally, here is the data sent via GMCP. As you can see, the values therein match the display values of the variables.
Code:

<var name="questdb" type="Record" id="36">
  <value>action=comp|targ=a tinker|room=Sacrifice Street|area=Ultima|timer=45|time=42|pracs=0|completed=14099|trains=0|lucky=0|double=0|tp=0|qp=20|totqp=24|mccp=2|gold=3068|tierqp=2</value>
  <json>{"pracs":0,"completed":14099,"action":"comp","trains":0,"lucky":0,"double":0,"tp":0,"qp":20,"totqp":24,"timer":45,"time":42,"targ":"a tinker","room":"Sacrifice Street","mccp":2,"gold":3068,"area":"Ultima","tierqp":2}</json>
</var>

So there is no confusion, by display value I mean the value shown when the Text tab is clicked in the settings editor for the item.
One more thing: the variables are Auto Type
EDIT: This is the data from the quest request immediately following the error posted above:

Variable Name: qmmob
Display value: a playful kitten

The XML
Code:

<var name="qmmob" id="458">
  <value>a playful kitten</value>
  <json>a hasty noble</json>
</var>

Variable Name: qmroom
Display value: Feeding area

The XML
Code:

<var name="qmroom" id="860">
  <value>Feeding area</value>
  <json>Faeriefog + GreyAsh</json>
</var>


Variable name: qmzone
Display value: Sheila's Cat Sanctuary

The XML
Code:

<var name="qmzone" id="460">
  <value>Sheila's Cat Sanctuary</value>
  <json>Fantasy Fields</json>
</var>


The data from GMCP
Code:

<var name="questdb" type="Record" id="36">
  <value>action=start|targ=a playful kitten|room=Feeding area|area=Sheila's Cat Sanctuary|timer=51|time=42|pracs=0|completed=14099|trains=0|lucky=0|double=0|tp=0|qp=20|totqp=24|mccp=2|gold=3068|tierqp=2</value>
  <json>{"pracs":0,"completed":14099,"action":"start","trains":0,"lucky":0,"double":0,"tp":0,"qp":20,"totqp":24,"timer":51,"time":42,"targ":"a playful kitten","room":"Feeding area","mccp":2,"gold":3068,"area":"Sheila's Cat Sanctuary","tierqp":2}</json>
</var>

This gives less credence to a random happenstance.
_________________
Sic itur ad astra.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Feb 05, 2011 12:19 pm   
 
My guess is that you have two variables, and the one you're displaying here isn't the one getting updated. I'd check that before anything else.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sat Feb 05, 2011 2:22 pm   
 
No, that is not the case. When the problem of wrong value occurs that is the first thing I check since the duplication of variables is a familiar problem with CMUD. If you look at the XML for the variables, you will see that the values (those that will show up under the Text tab) and the JSON values (the ones that would show up under the Json tab) don't match. Even more so, sometimes the XML has no relation to what the variable is supposed to contain. If it were a duplication problem, then there would be two variables at distinct places, this post shows one variable seen in different aspects obtained by simply clicking on the Text, XML, Json and Compile tabs so even if it were the case that there were a duplicate variable, it wouldn't explain the aspects shown by the case variable. Also, it is not just one variable, the package is littered with variables where the aspects are mismatched. After I made this post, I kept watch on the given variables. The JSON value always lagged by one or two uses of the variable. As I said, this problem is not new, but I lived with some of the client's quirks before as long as they didn't interfere with the performance of the scripts. Now, however, this problem is causing the scripts to go astray.
_________________
Sic itur ad astra.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Sat Feb 05, 2011 6:56 pm   
 
It sounds to me like your package is corrupted.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Feb 05, 2011 7:12 pm   
 
Quote:

simply clicking on the Text, XML, Json and Compile tabs


If you:

1)click on the Compile tab
2)click on the JSON tab
3)click away to a different setting
4)click back to the variable you clicked away from in #3

You will see that the value of the variable has changed. What it changes to is totally random, but it seems to always be the contents of another variable (or in the case of stringlists/datarecords, only bits and pieces of the array instead of the entire contents.)

This has been reported before, and if I recall Zugg said it was something beyond his control in a third-party component he didn't have the source for (or, instead, didn't have the time to slog through it.) His advice at the time was to avoid the Compile and JSON tabs for variables.

Beyond such issues as this, you simply have data corruption somewhere and fixing that should fix your problem.
_________________
EDIT: I didn't like my old signature
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sat Feb 05, 2011 8:43 pm   
 
EDIT: Reply removed.
_________________
Sic itur ad astra.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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