Lyntin Question

Mac Daddy <[email protected]> Thu, 06 Aug 2009 11:58:53 +0200
Newsgroups gmane.comp.games.mud.client.lyntin
Message-ID <[email protected]>
Like most new programmers, I am having difficulty with "hooking."

I concede, I am new to Python/Programming, and will likely reveal that 
in my code. =) {so embarrassing}

Here is what the code looks like:

When I run the code, I get an slew of errors (lyntin quits), but primarily:

TypeError: unhashable type: 'list'  I don't have a list (at least, I 
don't think I do), in my module, so somewhere the engine is sending me 
one -- perhaps the spamargs is a list?

Anyway, thanks in advance!!


# Yet another "bot" attempt. it essentially
# just smiles if a player is encountered.  I know, I know, I can just make
# an "action" for this, but then I wouldn't learn anything =)
# more importantly, I am just trying to learn how to process the incoming
# text for more advanced usage.

import re
from lyntin import exported
from lyntin.modules import modutils

commands_dict = {}

# So far, just putting stuff that I deem minimally required.
# Here is my dictionary of Variables (only one for now).

BotTriggers = {"**PLAYER**": "player_check"}

# In 3k, I have the created the above tag to show (via aset) for ALL players
# in their pretitle.

def botfilter(args):
     # This takes in mud text, and filters it, I hope.
     ses = ["session"]
     text = ["dataadj"]
     # I am not 100% what those mean, other than what I can infer.
     # Clearly the session, but not sure the depths of what "dataadj"
     # means.
     # I used a format similar to the highlight module.
     # I think it runs the text against the dict list?
     if BotTriggers.has_key(ses):
         return BotTriggers[ses].expand(text)
     return text

def expand(text):
     # Again, used the highlight module as a guide, for matching
     # the text. On a match, I just want a TRUTH value to be returned.
     # not sure if "m" is the truth value?
     if text:
         trigger = BotTriggers.keys()
         trigger.sort()
         for m in trigger:
             BotTriggers[m].finditer(text)
     return m

def aufgehts(ses, args, input):
     # This is the primary command function.
     if BotTriggers:
         exported.lyntin_command("smile")
         exported.write_message("Active!!")

commands_dict["aufgehts"] = (aufgehts)

def load():
     modutils.load_commands(commands_dict)
     exported.hook_register("mud_filter_hook", botfilter, 99)

def unload():
     modultils.unload_commands(commands_dict)
     exported.hook_unregister("mud_filter_hook", botfilter)

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july