Skip to content

Instantly share code, notes, and snippets.

@Hasimir
Created May 8, 2015 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hasimir/c7a637566cb094837fd8 to your computer and use it in GitHub Desktop.
Save Hasimir/c7a637566cb094837fd8 to your computer and use it in GitHub Desktop.
foo = fooClass()
class zhumClass:
def __repr__(self):
return "zERR: This function accepts one numeric argument in the
range 0-10."
def __call__(*args):
errMsg = "zERR: This function accepts one numeric argument in the range 0-10."
if len(args) != 2:
print errMsg,
return
newH = args[1]
if (type(newH) != IntType) or newH < 0 or newH > 10:
print errMsg,
return
pc = __main__.FindPlayer()
# there's no reliable way to read current humanity level,
# so max it out and then subtract as needed
pc.HumanityAdd(10)
pc.HumanityAdd(newH - 10)
print "HUMANITY LEVEL SET",
# instantiate class
zhum = zhumClass()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment