# Copyright (c) 2005 mudpy, Jeremy Stanley <fungi@yuggoth.org>, all rights reserved.
# Licensed per terms in the LICENSE file distributed with this software.
+import ConfigParser
+
# used by several functions for random calls
import random
else: return string_value
def getlong(config, section, option):
- return int(config.get(section, option).strip("L"))
+ try:
+ return int(config.get(section, option).strip("L"))
+ except ConfigParser.NoSectionError:
+ config.add_section(section)
+ return getlong(config, section, option)
+ except ConfigParser.NoOptionError:
+ setlong(config, section, option, 0)
+ return getlong(config, section, option)
def setlong(config, section, option, value):
return config.set(section, option, repr_long(value))
elif macro == "$(account)":
text = string.replace(text, macro, user.name)
+ # third person subjective pronoun
+ elif macro == "$(tpsp)":
+ if user.avatar.get("gender") == "male":
+ text = string.replace(text, macro, "he")
+ elif user.avatar.get("gender") == "female":
+ text = string.replace(text, macro, "she")
+ else:
+ text = string.replace(text, macro, "it")
+
+ # third person objective pronoun
+ elif macro == "$(tpop)":
+ if user.avatar.get("gender") == "male":
+ text = string.replace(text, macro, "him")
+ elif user.avatar.get("gender") == "female":
+ text = string.replace(text, macro, "her")
+ else:
+ text = string.replace(text, macro, "it")
+
+ # third person possessive pronoun
+ elif macro == "$(tppp)":
+ if user.avatar.get("gender") == "male":
+ text = string.replace(text, macro, "his")
+ elif user.avatar.get("gender") == "female":
+ text = string.replace(text, macro, "hers")
+ else:
+ text = string.replace(text, macro, "its")
+
# if we get here, log and replace it with null
else:
text = string.replace(text, macro, "")
if check_time("frequency_save"):
muffvars.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"))