From 095a1c0c138d2063d7254d2a48664451bfd49337 Mon Sep 17 00:00:00 2001 From: Griatch Date: Tue, 7 Jul 2015 16:43:10 +0200 Subject: [PATCH] Updated contrib menusystem and talking_npc to make use of the dynamic command update properties. Also fixed a lingering error in talking npc that resolves #768. --- evennia/contrib/menusystem.py | 7 ++----- evennia/contrib/talking_npc.py | 10 +++++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/evennia/contrib/menusystem.py b/evennia/contrib/menusystem.py index cfeaeffa36..1b2f17317b 100644 --- a/evennia/contrib/menusystem.py +++ b/evennia/contrib/menusystem.py @@ -42,9 +42,6 @@ from evennia import syscmdkeys from evennia import Command, CmdSet, utils from evennia import default_cmds, logger -# imported only to make it available during execution of code blocks -import evennia - CMD_NOMATCH = syscmdkeys.CMD_NOMATCH CMD_NOINPUT = syscmdkeys.CMD_NOINPUT @@ -398,7 +395,7 @@ class MenuNode(object): else: # this is the operable command, it moves us to the next node. cmd = CmdMenuNode() - cmd.key = str(i + 1) + cmd.set_key(str(i + 1)) cmd.link = link def _callback(self): self.menutree.goto(self.link) @@ -406,7 +403,7 @@ class MenuNode(object): # also custom commands get access to the menutree. cmd.menutree = menutree if self.keywords[i] and cmd.key not in (CMD_NOMATCH, CMD_NOINPUT): - cmd.aliases = [self.keywords[i]] + cmd.set_aliases(self.keywords[i]) self.cmdset.add(cmd) def __str__(self): diff --git a/evennia/contrib/talking_npc.py b/evennia/contrib/talking_npc.py index 7ba7d17946..f2a86904f9 100644 --- a/evennia/contrib/talking_npc.py +++ b/evennia/contrib/talking_npc.py @@ -8,7 +8,7 @@ This is a simple NPC object capable of holding a simple menu-driven conversation. Create it by creating an object of typeclass contrib.talking_npc.TalkingNPC, For example using @create: - @create John : contrib.talking_npc.TalkingNPC + @create/drop John : contrib.talking_npc.TalkingNPC Walk up to it and give the talk command to strike up a conversation. If there are many talkative npcs in the same room you will get to @@ -84,26 +84,26 @@ CONV = {"START": {"text": "Hello there, how can I help you?", "linktexts": ["Hey, do you know what this 'Evennia' thing is all about?", "What's your name, little NPC?"], "keywords": None, - "code": None}, + "callback": None}, "info1": {"text": "Oh, Evennia is where you are right now! Don't you feel the power?", "links": ["info3", "info2", "END"], "linktexts":["Sure, *I* do, not sure how you do though. You are just an NPC.", "Sure I do. What's yer name, NPC?", "Ok, bye for now then."], "keywords": None, - "code": None}, + "callback": None}, "info2": {"text": "My name is not really important ... I'm just an NPC after all.", "links": ["info3", "info1"], "linktexts": ["I didn't really want to know it anyhow.", "Okay then, so what's this 'Evennia' thing about?"], "keywords": None, - "code": None}, + "callback": None}, "info3": {"text": "Well ... I'm sort of busy so, have to go. NPC business. Important stuff. You wouldn't understand.", "links": ["END", "info2"], "linktexts": ["Oookay ... I won't keep you. Bye.", "Wait, why don't you tell me your name first?"], "keywords": None, - "code": None}, + "callback": None}, }