X-Git-Url: https://mudpy.org/gitweb?a=blobdiff_plain;f=muff%2Fmuffmisc.py;fp=lib%2Fmuff%2Fmuffmisc.py;h=d507e6de4d9856519fe3380014d9ac277384820d;hb=fc67241160a8fa4810e80e4700e91bf5ec0b574b;hp=3e39798a6ee40d5804263e669ad32e476d1a3431;hpb=0c835a0a43cc3c7782f46857d72e518539725eca;p=mudpy.git diff --git a/lib/muff/muffmisc.py b/muff/muffmisc.py similarity index 92% rename from lib/muff/muffmisc.py rename to muff/muffmisc.py index 3e39798..d507e6d 100644 --- a/lib/muff/muffmisc.py +++ b/muff/muffmisc.py @@ -152,7 +152,7 @@ def replace_macros(user, text, is_input=False): # the user's account name elif macro == "$(account)": - text = string.replace(text, macro, user.name) + text = string.replace(text, macro, user.account.get("name")) # third person subjective pronoun elif macro == "$(tpsp)": @@ -195,8 +195,10 @@ def replace_macros(user, text, is_input=False): def check_time(frequency): """Check for a factor of the current increment count.""" if type(frequency) is str: - frequency = muffconf.getint("time", frequency) - return not muffuniv.universe.internals["counters"].getint("elapsed") % frequency + frequency = muffuniv.universe.categories["internal"]["time"].getint(frequency) + if not "counters" in muffuniv.universe.categories["internal"]: + muffuniv.Element("internal:counters", muffuniv.universe) + return not muffuniv.universe.categories["internal"]["counters"].getint("elapsed") % frequency def on_pulse(): """The things which should happen on each pulse, aside from reloads.""" @@ -217,14 +219,13 @@ def on_pulse(): # periodically save everything if check_time("frequency_save"): - for user in muffvars.userlist: user.save() muffuniv.universe.save() # pause for a configurable amount of time (decimal seconds) - time.sleep(muffconf.getfloat("time", "increment")) + time.sleep(muffuniv.universe.categories["internal"]["time"].getfloat("increment")) # increment the elapsed increment counter - muffuniv.universe.internals["counters"].set("elapsed", muffuniv.universe.internals["counters"].getint("elapsed") + 1) + muffuniv.universe.categories["internal"]["counters"].set("elapsed", muffuniv.universe.categories["internal"]["counters"].getint("elapsed") + 1) def reload_data(): """Reload data into new persistent objects."""