From 212061abb61346b7bc7f150e083d2648b717f6ef Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 5 Sep 2010 16:35:39 +0000 Subject: [PATCH] Made so the @scripts command properly display when scripts will fire next. --- game/gamesrc/commands/default/privileged.py | 23 +++++++++++---------- src/commands/cmdsethandler.py | 5 ++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/game/gamesrc/commands/default/privileged.py b/game/gamesrc/commands/default/privileged.py index d122431569..709e4520e1 100644 --- a/game/gamesrc/commands/default/privileged.py +++ b/game/gamesrc/commands/default/privileged.py @@ -154,18 +154,20 @@ class CmdListScripts(MuxCommand): table[3].append("--") else: table[3].append("%ss" % script.interval) - if not hasattr(script, 'next_repeat') or not script.next_repeat: - table[5].append("--") - else: - table[5].append("%ss" % script.next_repeat) - if not hasattr(script, 'repeats') or not script.repeats: + next = script.time_until_next_repeat() + if not next: table[4].append("--") else: - table[4].append("%ss" % script.repeats) - if script.persistent: - table[6].append("Y") + table[4].append("%ss" % next) + + if not hasattr(script, 'repeats') or not script.repeats: + table[5].append("--") else: - table[6].append("N") + table[5].append("%ss" % script.repeats) + if script.persistent: + table[6].append("*") + else: + table[6].append("-") typeclass_path = script.typeclass_path.rsplit('.', 1) table[7].append("%s" % typeclass_path[-1]) table[8].append(script.desc) @@ -232,8 +234,7 @@ class CmdListScripts(MuxCommand): string += "Started %s and stopped %s scripts." % (nr_started, nr_stopped) else: # No stopping or validation. We just want to view things. - string = self.format_script_list(scripts) - print string + string = self.format_script_list(scripts) caller.msg(string) diff --git a/src/commands/cmdsethandler.py b/src/commands/cmdsethandler.py index 4ef70acc22..36f2b5d85c 100644 --- a/src/commands/cmdsethandler.py +++ b/src/commands/cmdsethandler.py @@ -95,9 +95,8 @@ def import_cmdset(python_path, cmdsetobj, emit_to_obj=None, no_logging=False): #print "cmdset %s not in cache. Reloading." % wanted_cache_key # Not in cache. Reload from disk. modulepath, classname = python_path.rsplit('.', 1) - module = __import__(modulepath, fromlist=[True]) - cmdsetclass = module.__dict__[classname] + cmdsetclass = module.__dict__[classname] CACHED_CMDSETS[wanted_cache_key] = cmdsetclass #print "cmdset %s found." % wanted_cache_key #instantiate the cmdset (and catch its errors) @@ -122,7 +121,7 @@ def import_cmdset(python_path, cmdsetobj, emit_to_obj=None, no_logging=False): logger.log_trace() if emit_to_obj: emit_to_obj.msg(errstring) - raise + raise # have to raise, or we will not see any errors in some situations! # classes