Triggers now execute commands when preceded with @

This commit is contained in:
Howard Abrams 2025-05-27 18:23:42 -07:00
parent daace6e983
commit a1e852c8a8
2 changed files with 44 additions and 7 deletions

View file

@ -246,10 +246,13 @@ class CmdGMTrigger(Command):
for idx, event in enumerate(events): for idx, event in enumerate(events):
if isinstance(event, str): if isinstance(event, str):
msg = target.gendered_text(routput(event, name)) if event.startswith("@"):
delay(time_delay * idx, self.caller.execute_cmd(event[1:])
self.caller.location.msg_contents, else:
"\n" + msg) msg = target.gendered_text(routput(event, name))
delay(time_delay * idx,
self.caller.location.msg_contents,
"\n" + msg)
else: else:
char = target.gendered_text(routput(event[0], name)) char = target.gendered_text(routput(event[0], name))
room = target.gendered_text(routput(event[1], name)) room = target.gendered_text(routput(event[1], name))

View file

@ -85,6 +85,38 @@
You also notice a glowing orb... and then another, and another. The field, filled with soft light, illuminates another path... You also notice a glowing orb... and then another, and another. The field, filled with soft light, illuminates another path...
# Portal:4 ends here # Portal:4 ends here
# Lets do them all with the Raven:
# [[file:../../../projects/mud-rpg.org::*Opening the Portal][Opening the Portal:7]]
@set/character Raven/triggers:session0 = {
"open": {"desc": "Open the Portal to the Wyldwood Bar",
"timer": 1,
"events": [
"@fly Frog Meadow",
"The big, hairy beast trembles with the appearance of the raven, and flees behind the waterfall.",
"@teleport beast = Lair",
"You notice a glowing orb dancing in front of you... and then another, and another. The field, filled with soft light, illuminates a different path into the forest...",
"@teleport follow the glowing orbs = Frog Meadow",
"@roomstate portal_open",
"@fly Radiant Workshop",
]
},
"close": {"desc": "Close the Portal to the Wyldwood Bar",
"timer": 1,
"events": [
"@fly Frog Meadow",
"The glowing orbs that filled the field start to wink out.",
"@teleport/tonone follow the glowing orbs",
"@roomstate portal_open",
"@fly Radiant Workshop",
]
},
}
# Opening the Portal:7 ends here
# Closing the Portal # Closing the Portal
# First, close the portal by moving it to the =None= location: # First, close the portal by moving it to the =None= location:
@ -161,16 +193,18 @@ py bt = self.search('Bartender'); bt.db.gender = 'male'; bt.db._sdesc = 'blonde
# A haughty elf named Elendil # A haughty elf named Elendil
# [[file:../../../projects/mud-rpg.org::*Pixie Quartet][Pixie Quartet:1]] # [[file:../../../projects/mud-rpg.org::*Pixie Quartet][Pixie Quartet:1]]
@create/drop quartet of pixies;quartet;pixies;pixie: typeclasses.puppets.Puppet @create/drop Pixies;pixie: typeclasses.puppets.Puppet
# Pixie Quartet:1 ends here # Pixie Quartet:1 ends here
# And give them a better name/description:
# And all the RP system stuff: # And all the RP system stuff:
# [[file:../../../projects/mud-rpg.org::*Pixie Quartet][Pixie Quartet:2]] # [[file:../../../projects/mud-rpg.org::*Pixie Quartet][Pixie Quartet:2]]
py bt = self.search('pixies'); bt.db.pose_default = 'playing music atop a giant fieldcap mushroom'; bt.db.pose = 'playing music' py bt = self.search('pixies'); bt.db._sdesc = "quartet of pixies"; bt.db.pose_default = 'playing music atop a giant fieldcap mushroom'; bt.db.pose = 'playing music'; bt.db.gender = 'ambiguous';
# Pixie Quartet:2 ends here # Pixie Quartet:2 ends here
# [[file:../../../projects/mud-rpg.org::*Pixie Quartet][Pixie Quartet:3]] # [[file:../../../projects/mud-rpg.org::*Pixie Quartet][Pixie Quartet:3]]
@ -204,7 +238,7 @@ py bt = self.search('pixies'); bt.db.pose_default = 'playing music atop a giant
# [[file:../../../projects/mud-rpg.org::*Awakened Shrub][Awakened Shrub:1]] # [[file:../../../projects/mud-rpg.org::*Awakened Shrub][Awakened Shrub:1]]
@create/drop shrub;bush;chalkboard;awakened shrub: typeclasses.puppets.Shrub @create/drop Shrub;bush;chalkboard;awakened shrub: typeclasses.puppets.Shrub
# Awakened Shrub:1 ends here # Awakened Shrub:1 ends here