12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- from mudsys import add_cmd
- import auxiliary
- import storage
- class ExampleAux:
-
-
- def __init__(self, set = None):
- if not set:
- self.val = "abcxyz"
- else:
- self.val = set.readString("val")
-
- def copyTo(self, to):
- to.val = self.val
-
- def copy(self):
- newVal = ExampleAux()
- newVal.val = self.val
- return newVal
-
- def store(self):
- set = storage.StorageSet()
- set.storeString("val", self.val)
- return set
- def cmd_getaux(ch, cmd, arg):
- aux = ch.account.getAuxiliary("example_aux")
- ch.send("The val is " + aux.val)
- def cmd_setaux(ch, cmd, arg):
- aux = ch.account.getAuxiliary("example_aux")
- aux.val = arg
- ch.send("val set to " + arg)
- auxiliary.install("example_aux", ExampleAux, "account")
- add_cmd("getaux", None, cmd_getaux, "admin", False)
- add_cmd("setaux", None, cmd_setaux, "admin", False)
|