[CF-Devel] bug in magic ear/npc conversation code

Mark Wedel mwedel at scruz.net
Tue Feb 20 22:56:00 CST 2001


Andreas Vogl wrote:
>
     
     
     >
     
      When there is an "@match <text>" in a magic ear/npc,
     
     >
     
      the player must speak <text> to trigger the magic ear,
     
     >
     
      or get an answer from the npc.
     
     >
     
     
     >
     
      There is a bug: The last letter (/character) spoken does
     
     >
     
      NOT get compared with the @match-string.
     
     >
     
      Example: When a magic ear contains "@match yes", I already
     
     >
     
      get a match for speaking "ye".
     
     >
     
      For "@match no", speaking a single 'n' is already sufficient.
     
     >
     
      E.g. when I say "certainly", I would get a match for "@match no",
     
     >
     
      since there is an 'n' in "certaiNly".
     
     >
     
      A match for single characters is impossible: "@match x" gets
     
     >
     
      triggered by anything I say.
     
     >
     
     
     >
     
      Should be rather simple to fix *if* one is familiar with these
     
     >
     
      parts of the code.
     
     
 The bug is actually in the regular expression code (re-cmp.c file).  And in
fact, its not that the last character is getting discarded - the current
matching method seems to basically be if any letter if the what the player says
matches against the first letter of, we get a match.

 So saying 'ah' matches against 'hi'.  I've in fact tested that out.

 I've made a minor change, and it doesn't match quite so much.  ITs still not
100% accurate - 'ye' will mach against "yes" for example, but just "y" or "e"
will not.  But the match of certainly against no should not happen, as it does
have to match against the start of the line.

 I'm not sure how much time should be spent fixing it - we've discussed better
npc communication many times.  and I'm not really sure how much regex's are
needed/used for the current conversation.  I think post 1.0, we'll seriously
look at what we want npc talk to be like.

    
    


More information about the crossfire mailing list