This is a spin-off idea from SENTInce. I won't be doing anything practical about it until SENTInce is finished, but in the meantime, here's a repository for my ideas (it is a blog after all) and hopefully other people's input too.This also raises a question over pronouns. Sometimes pronouns can also be ignored. For example, 'give me the sword' could have the pronoun (me) and article (the) removed without its meaning suffering: 'give sword'. But equally, 'give the sword to me' could lose pronoun, article, and preposition (to). But if the topic is 'give my sword to him' the two pronouns are important, so it's not a simple matter. Rather, this level of topic processing requires quite a complex parser. As mentioned above, this would need to be done server side (well it could be done client side -- for example, the client could encapsulate 'useless' words in non-printable chars -- in this way they could still be displayed (the words not the chars) in the GUI but could be ignored by the topic matching -- however this would slightly increase the amount of data being transferred: 'give ®the® sword ®to me®'.
At this stage punctuation also becomes interesting... You see where this is going. Smile A full client-side parser for /talk topics a la those found in text adventures may be a useful addition, making NPC interaction via the GUI much more satisfying and powerful.
However, this is a big job, probably enough to warrant its own separate development stream.
A better way to do this, I think, would be to parse the topic message, client-side, into just three (one mandatory and two optional) 'parts'.
The first part (the mandatory one) would be the
action: for example, repair, cast, give, sell, etc.
The second part (optional) would be the
direct object: for example, sword.
The third part (optional but requires direct object too) would be the
indirect object. For example, Smacky.
Thus 'give the sword to Smacky' and 'give Smacky the sword' both parse to:
action = give
dobj = sword
iobj = smacky
The client send both the message as typed and the parsed topic to the server, in the same way as a map name and media string is sent the other way. Ie, using some sort of separator tag: /talk give the sword to smacky®give sword smacky
Scripts can then use tl:CheckMessage() to match the message as typed in the normal way. For backwards compatibility.
OR they can use, eg, toparse.lua which matches the parsed topic instead.