28 June 2010

One Less Bug (Or Two)

I had been banging my head against the proverbial wall as I tried to understand what was wrong with the huntmaster.npc script.  I had added an Iron Man mode on a whim, which made the challenge end upon the player's fall.  The problem, as reported on the Sentinel, was that this mode was now getting applied to all hunts.

Today I debugged the script.  I thought that there was one bug, but it turns out that there were two separate bugs.  The two bugs were not related – only in that both were careless typos.

The first bug was causing the server to log a high volume of errors; this happened when a person on a challenge bumped a non-monster, like an NPC or even another player (I imagine).  This was a stupid error on my part, as I had typed

if ( ! target.thingType == kThingMonster ) continue;

instead of

if ( target.thingType != kThingMonster ) continue;

So yeah, that was filling the server log with errors.  Whoops!  The second bug was the way that I had parsed the Iron Man mode.  This took me a little while to understand (as at this time I was still convinced that there was one bug, not two separate bugs), but after putting in a couple of lines of debugging code I saw what I had done wrong – a silly mistake, really – and fixed it right away.

What a relief.  Now I may return to the mannequin bug.  I think I will need to reread the script, as I have forgotten the problem!

No comments:

Post a Comment