diff --git a/typeclasses/characters.py b/typeclasses/characters.py index 932785a..3cfefc2 100644 --- a/typeclasses/characters.py +++ b/typeclasses/characters.py @@ -15,6 +15,8 @@ from utils.word_list import Token, routput from .objects import Object from .tutorial import TutorBird, TutorialState +from re import match + INTRO = """ As the surrounding mists dissipate, you find yourself in an ancient, halcyon forest dripping with moss. You see an envelope of parchment wedged under a scaly protrusion of bark...inside, a letter in familiar penmanship, personally addressed to you, which you pick up. @@ -93,7 +95,7 @@ class Character(Object, DefaultCharacter): thing.move_to(self, quiet=True, use_destination=True) return - self.msg(f"{victim.key} doesn't have a {to_take}.") + self.msg(f"{victim.key} doesn't have a {to_take} you can take.") else: self.msg(f"You don't see {from_whom}.") @@ -107,6 +109,25 @@ class Character(Object, DefaultCharacter): if self.db.is_sitting: self.msg("You stand up first...") self.db.is_sitting = False; + + # @lock thing = tethered:id(#19) + # @set thing/tethered_msg = "Let's put that back" + for thing in self.contents: + to = thing.locks.get('tethered') + if to: + m = match(r".*:id\(#?(.*)\)", to) + if m: + id_num = m.group(1) + dest = self.global_search(f"#{id_num}") + msg = thing.db.tethered_msg + if dest and msg: + thing.location = dest + self.msg(msg) + else: + print(f"Found tethered, {thing} to #{id_num}, but dest is {dest} and msg is '{msg}'. Set both.") + else: + print(f"Found tethered, {thing} to #{to}, but that needs to be 'tethered:id(num) where num is the ID# of an object/place.") + return super().at_pre_move(destination) def at_pre_say(self, message, **kwargs): diff --git a/typeclasses/things.py b/typeclasses/things.py index 9c9f7c9..823b05a 100755 --- a/typeclasses/things.py +++ b/typeclasses/things.py @@ -204,7 +204,7 @@ class Knocker(Object): # Let's see if a keyword gives a good response: for idx, [regex, responses] in enumerate(self.all_responses): full_regex = r".*" + regex + r".*" - if re.match(full_regex, message): + if re.match(full_regex, message, re.IGNORECASE): # The first match is the password, so we set a tag on # the character, so that they can go through the door: if idx == 0: