Using auxiliary.py - Just starting out.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using auxiliary.py - Just starting out.

telestrial
This post has NOT been accepted by the mailing list yet.
Hello,

I just downloaded and got NakedMud running.  I know a decent amount about Python and feel like I can get around (at least a little).  I have fooled around here and there...changing very small things, but I decided I'd start trying to make some bigger changes by creating a prompt.  First I need to get some auxiliary data going....right?

SO: I'm using auxiliary.py (from the module link on the NakedMud website.) I put in in /lib/pymodules. And then I created another python file in the same directory and filled it with:

import auxdata, auxiliary

class Vitals(auxdata.Auxdata):
    def __init__(self, storage_set=None):
        self.health = 0
        self.load(storage_set)

auxiliary.install("Vitals", Vitals, "character")


...This crashes my mud on copyover and it just won't compile.  It must be how this is implemented. The top of auxiliary.py says:

#   This module greatly simplifies the development of auxiliary data
# modules for NakedMUD. A class that inherits from the AuxData class in
# this module need only to define its own attributes.
#
#   An optional storable() method can be defined - it should return an
# iterable of keys to store.
#
#   Example Module:
#
#   import auxdata, auxiliary
#
#   class ExampleAux(auxdata.AuxData):
#       def __init__(self, storage_set=None):
#           self.foo = {
#               "bar": [1,2,3,4]
#               "baz": {1:2, 3:4}
#               }
#           self.bar = "this will not be stored"
#           self.load(storage_set)
#
#       def storable(self):
#           return ["foo"]
#
#   auxiliary.install("example_aux", ExampleAux, "character")
#
###############################################################################


I'm not sure what's gone wrong here.  I may not understand the implementation fully.

Also, I know that custom_prompt is in utils but I'm unsure how to access the data I'm (TRYING!) to define and place in that prompt.

I would really appreciate any help someone can provide.  I am kind of trying to use this mud project as a way to learn. I've tried doing it several different ways...but the way I'm posting seems to be most like what the example at the top of auxiliary.py refers to.

Thanks,

-Telestrial
Reply | Threaded
Open this post in threaded view
|

Re: Using auxiliary.py - Just starting out.

telestrial
This post has NOT been accepted by the mailing list yet.
"auxdata.AuxData" not "auxdata.Auxdata"

Der.