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: Sun Sep 26, 2010 11:17 pm   

[3.29] (BUG) Adding a Key to a Record Variable breaks Nested Lists
 
This is a really odd bug, but I've finally found it. I'm going to try and reproduce it with a simpler test script soon so that you guys can try and get it to reproduce soon.

These settings:
Code:

<class name="Affects Window Settings" id="56">
  <var name="afw_set" type="Record" id="59">
    <value>history=0|top=0|spl=2|col_inc=15|col_exp=12|col_maled=12|max_len=18|col_long=10|num_len=3|col_short=14|blink=1</value>
    <json>{"history":0,"top":0,"spl":2,"col_inc":15,"col_exp":12,"col_maled":12,"max_len":18,"col_long":10,"num_len":3,"col_short":14,"blink":1}</json>
  </var>
  <var name="afw_list" type="Record" id="168">
    <value>req="Armor|Shield|Stone Skin|Frenzy|Prayer|Enhanced Recovery|Protection|Sanctuary|Holy Presence|Haste"|hid="Detect Invis|Detect Hidden|Detect Good"|acc_maled="Eye Rake=0|Blindness=0|Weaken=0|Wing Stall=0|Black Curse=0|Ankle Smash=0|Eye Gouge=0|Flash Bomb=0|Leprosy=0|Poison=0|Slow=0|Spook=0|Dirt Kick=0|Death Illness=0|Curse=0|choke=0|Plague=0"|maled|spell_order="Sanctuary|Enhanced Recovery|Holy Presence|Prayer|Shield|Haste|Bless|Frenzy|Armor|Water Breathing|Favor of the Gods|Protection Evil|Protection Neutral|Protection Good|Song of War|Enchanting Touch|We Come, We Come|Detect Hidden|Detect Invis|Detect Good|spell Protection Neutral|Pass Door|Protection|Shield of Words|Stone Skin|Endurance"|maled_order="Weaken|Blindness|Eye Gouge|Dirt Kick|Flash Bomb|Plague|Eye Rake|Spook|Leprosy|Ankle Smash|Wing Stall|Death Illness|Slow|Poison|Curse|choke|Black Curse"|acc_spell="Song of War=0|Armor=0|Pass Door=0|Detect Invis=0|Endurance=0|Stone Skin=0|Favor of the Gods=0|Enhanced Recovery=0|Shield=0|Sanctuary=0|Shield of Words=0|We Come, We Come=0|Protection Good=0|Protection Evil=0|Holy Presence=0|Enchanting Touch=0|Prayer=0|Haste=0|Detect Good=0|Frenzy=0|Detect Hidden=0|spell Protection Neutral=0|Protection Neutral=0|Water Breathing=0|Bless=0"|fade="You feel less sick=Poison|You can see again=Blindness|You feel stronger=Weaken|The white aura around your body fades=Sanctuary|Your protection disappears=Protection Evil|You feel the divine strength leave your body=Endurance|You feel yourself slowing down=Haste"|echo="You choke and gag=Poison|Your skin turns to stone=Stone Skin|You feel blessed with a vitalizing aura=Enhanced Recovery|You feel a holy presence protecting you=Holy Presence|You feel a holy endurance run through your veins=Endurance|You feel someone protecting you=Armor|You feel unclean=Curse|You are blinded=Blindness|throws something on the ground and it explodes with a brilliant flash=Flash Bomb|You feel your strength slipping away=Weaken|You feel righteous=Bless|A feeling of divinity overtakes your presence=Prayer|You turn translucent=Pass Door|You are surrounded by a force shield=Shield|You are surrounded by a white aura=Sanctuary|You are filled with holy wrath=Frenzy|You are protected from neutral people=Protection Neutral"|spell="Armor=0|Detect Invis=17|Stone Skin=26|Enhanced Recovery=9|Shield=43|Sanctuary=9|Holy Presence=7|Enchanting Touch=23|Prayer=4|Haste=0|Detect Good=26|Frenzy=9|Detect Hidden=17|Protection=0|Bless=37"</value>
    <json>{"req":["Armor","Shield","Stone Skin","Frenzy","Prayer","Enhanced Recovery","Protection","Sanctuary","Holy Presence","Haste"],"hid":["Detect Invis","Detect Hidden","Detect Good"],"acc_maled":{"Eye Rake":0,"Blindness":0,"Weaken":0,"Wing Stall":0,"Black Curse":0,"Ankle Smash":0,"Eye Gouge":0,"Flash Bomb":0,"Leprosy":0,"Poison":0,"Slow":0,"Spook":0,"Dirt Kick":0,"Death Illness":0,"Curse":0,"choke":0,"Plague":0},"maled":{},"spell_order":["Sanctuary","Enhanced Recovery","Holy Presence","Prayer","Shield","Haste","Bless","Frenzy","Armor","Water Breathing","Favor of the Gods","Protection Evil","Protection Neutral","Protection Good","Song of War","Enchanting Touch","We Come, We Come","Detect Hidden","Detect Invis","Detect Good","spell Protection Neutral","Pass Door","Protection","Shield of Words","Stone Skin","Endurance"],"maled_order":["Weaken","Blindness","Eye Gouge","Dirt Kick","Flash Bomb","Plague","Eye Rake","Spook","Leprosy","Ankle Smash","Wing Stall","Death Illness","Slow","Poison","Curse","choke","Black Curse"],"acc_spell":{"Song of War":0,"Armor":0,"Pass Door":0,"Detect Invis":0,"Endurance":0,"Stone Skin":0,"Favor of the Gods":0,"Enhanced Recovery":0,"Shield":0,"Sanctuary":0,"Shield of Words":0,"We Come, We Come":0,"Protection Good":0,"Protection Evil":0,"Holy Presence":0,"Enchanting Touch":0,"Prayer":0,"Haste":0,"Detect Good":0,"Frenzy":0,"Detect Hidden":0,"spell Protection Neutral":0,"Protection Neutral":0,"Water Breathing":0,"Bless":0},"fade":{"You feel less sick":"Poison","You can see again":"Blindness","You feel stronger":"Weaken","The white aura around your body fades":"Sanctuary","Your protection disappears":"Protection Evil","You feel the divine strength leave your body":"Endurance","You feel yourself slowing down":"Haste"},"echo":{"You choke and gag":"Poison","Your skin turns to stone":"Stone Skin","You feel blessed with a vitalizing aura":"Enhanced Recovery","You feel a holy presence protecting you":"Holy Presence","You feel a holy endurance run through your veins":"Endurance","You feel someone protecting you":"Armor","You feel unclean":"Curse","You are blinded":"Blindness","throws something on the ground and it explodes with a brilliant flash":"Flash Bomb","You feel your strength slipping away":"Weaken","You feel righteous":"Bless","A feeling of divinity overtakes your presence":"Prayer","You turn translucent":"Pass Door","You are surrounded by a force shield":"Shield","You are surrounded by a white aura":"Sanctuary","You are filled with holy wrath":"Frenzy","You are protected from neutral people":"Protection Neutral"},"spell":{"Armor":0,"Detect Invis":17,"Stone Skin":26,"Enhanced Recovery":9,"Shield":43,"Sanctuary":9,"Holy Presence":7,"Enchanting Touch":23,"Prayer":4,"Haste":0,"Detect Good":26,"Frenzy":9,"Detect Hidden":17,"Protection":0,"Bless":37}}</json>
  </var>
</class>


Work fine with this trigger:
Code:

<trigger name="check-echo" priority="13740" regex="true" id="1492">
  <pattern>^(@afw_list.echo)</pattern>
  <value>affects gather</value>
</trigger>


Specifically the echo: You are surrounded by a white aura.

If you send that echo and have your own echoes turned on, you should see the script send "affects gather" in response. Now, go to the variable @afw_list and click on the blank key, type in "alias" (though likely anything will work) and leave the value field blank. Now if you send the echo "You are surrounded by a white aura." it shouldn't fire "affects gather" anymore, even though it's supposed to. Anyways, really odd, but I'll try to have a better script to reproduce it with soon.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Sep 27, 2010 5:11 pm   
 
Running:
#show %dbkeys( afw_list)

gives me:
spell|maled

Something is really wrong here. However, if it's corruption, it doesn't explain why it happens on even new instances of the settings (aka deleting them, using a working settings and modifying from there).

This baffles me completely.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Sep 27, 2010 7:25 pm   
 
I'm having difficulty getting a "fresh" db variable with a different name to break in the same manner. But I'm unsure of what would be specifically a problem with the db variable posted (afw_list) which would cause it to break when a new key is added.
_________________
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 27, 2010 7:38 pm   
 
You don't even need to add a new key like "alias". Just editing anything in the @afw_list variable will cause the problem. The Variable Editor was not really intended to handle nested elements like this and I'm not exactly sure what is messing it up, but I will try to look into this so the editor will not screw up the variable.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Sep 27, 2010 8:05 pm   
 
Any idea why it's happening to this variable and not others?

I've always been a fan of being able to use nested elements for consolidation of variables. I spent probably 5 or 6 hours on Friday (or Saturday, forget which) redoing the entire script so that it could use those two variables in the package. I didn't have to change @afw_set really, but afw_list is entirely new, and essentially every key in that variable was its own standalone variable before. I favor such an approach over having 20 variables, personally, but perhaps nested records are not really meant to be used as such?
_________________
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 27, 2010 8:18 pm   
 
It's just related to the exact structure of the nested data within the variable. I haven't found the exact problem yet, so I don't really know for sure.

Your use of the database records is just fine. It's just that the Variable Editor was never meant to handle nested variables. This wasn't a problem with CMUD itself didn't handle nested variables. With the improvement to using nested variables, the Variable Editor really needs a complete rewrite to be more of a tree-based hierarchical view, but that's not getting done in time for this public version.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Sep 27, 2010 8:23 pm   
 
Well, I thank you for looking into this, and it will certainly be interesting to see what you can add when you move on to the next version (beyond the public release). Of course the key is knowing that the way I've used them is fine. Even though it may not be how others will setup their variables, it's how some might, and how I've been progressing in my scripting and I certainly should know if that's going to be a negative way to progress. Let me know if I can help isolate this issue for you at all, it's been something which has been awfully difficult for me to replicate, which is why I haven't yet posted a simplified script to reproduce it.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Sep 27, 2010 8:38 pm   
 
If it is the Variable Editor that is the problem, you should be able to edit your variable using code instead.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Sep 27, 2010 8:47 pm   
 
Nope, updating it via #ADDKEY still breaks the variable. You can test it if you want Confused

Edit: Odd, now it works...

Edit2: Well, adding it via script works. Adding it through the editor still doesn't, but at least I can add it via script.
_________________
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