15 July 2010

Do-It-Yourself Summer Haircuts

Today I drove the final debugging nail into the mannequin.npc coffin, or so I hope.  I believe that this script may be laid to rest and be considered Done!

I had overlooked a reported bug that described unusual mannequin behavior: one could bump a mannequin and don clothing that one should not normally be allowed to wear, such as a fighter wearing a healer's shirt.  I was able to duplicate the bug but could not understand how the bug was getting triggered.  Hours passed and I grew bald from tearing hair from my head.  How was the mannequin script allowing this to happen?

It turns out that the problem had nothing to do with the mannequin script, but it just so happened that the mechanics of the mannequin exposed the bug (when a player bumps a mannequin, then the contents of the mannequin are automatically equipped upon that player).  The problem instead lay within a remote clothing utility that manages how clothing is equipped and unequipped.  It was an amusing bug in hindsight: the utility would diligently check if a player was qualified to wear an article of clothing that was being equipped (like a fighter attempting to wear a healer's shirt), and if the player was unqualified to wear it, then the utility would order – nay, it would demand! – the player to re-equip the last article of clothing worn.  However the utility was not confirming that the last article of clothing worn was still in that player's inventory!  And because the last clothing worn was now resting on the mannequin, then it was impossible to equip it – so we are left wearing the article of clothing that we should not be able to wear.

All that to say that the bug case is now resolved and closed, and I now have less hair on my head.

No comments:

Post a Comment