From 9784a2a5c0c28748a05e3358078542fb26810d4d Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 20 Apr 2014 23:54:46 +0200 Subject: [PATCH] Added a small example cmdset to dice.py. --- contrib/dice.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/contrib/dice.py b/contrib/dice.py index acd4b7c50a..e3ca9a535b 100644 --- a/contrib/dice.py +++ b/contrib/dice.py @@ -32,7 +32,7 @@ After a reload the dice (or roll) command will be available in-game. import re from random import randint -from ev import default_cmds +from ev import default_cmds, CmdSet def roll_dice(dicenum, dicetype, modifier=None, conditional=None, return_tuple=False): @@ -125,7 +125,7 @@ class CmdDice(default_cmds.MuxCommand): """ key = "dice" - aliases = ["roll"] + aliases = ["roll", "@dice"] locks = "cmd:all()" def func(self): @@ -223,3 +223,12 @@ class CmdDice(default_cmds.MuxCommand): string = resultstring % (rolls, result) string += outcomestring self.caller.location.msg_contents(string) + +class DiceCmdSet(CmdSet): + """ + a small cmdset for testing purposes. + Add with @py self.cmdset.add("contrib.dice.DiceCmdSet") + """ + def at_cmdset_creation(self): + "Called when set is created" + self.add(CmdDice())