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.
This commit is contained in:
parent
ea0de32607
commit
095a1c0c13
2 changed files with 7 additions and 10 deletions
|
|
@ -42,9 +42,6 @@ from evennia import syscmdkeys
|
||||||
from evennia import Command, CmdSet, utils
|
from evennia import Command, CmdSet, utils
|
||||||
from evennia import default_cmds, logger
|
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_NOMATCH = syscmdkeys.CMD_NOMATCH
|
||||||
CMD_NOINPUT = syscmdkeys.CMD_NOINPUT
|
CMD_NOINPUT = syscmdkeys.CMD_NOINPUT
|
||||||
|
|
||||||
|
|
@ -398,7 +395,7 @@ class MenuNode(object):
|
||||||
else:
|
else:
|
||||||
# this is the operable command, it moves us to the next node.
|
# this is the operable command, it moves us to the next node.
|
||||||
cmd = CmdMenuNode()
|
cmd = CmdMenuNode()
|
||||||
cmd.key = str(i + 1)
|
cmd.set_key(str(i + 1))
|
||||||
cmd.link = link
|
cmd.link = link
|
||||||
def _callback(self):
|
def _callback(self):
|
||||||
self.menutree.goto(self.link)
|
self.menutree.goto(self.link)
|
||||||
|
|
@ -406,7 +403,7 @@ class MenuNode(object):
|
||||||
# also custom commands get access to the menutree.
|
# also custom commands get access to the menutree.
|
||||||
cmd.menutree = menutree
|
cmd.menutree = menutree
|
||||||
if self.keywords[i] and cmd.key not in (CMD_NOMATCH, CMD_NOINPUT):
|
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)
|
self.cmdset.add(cmd)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
|
||||||
|
|
@ -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
|
conversation. Create it by creating an object of typeclass
|
||||||
contrib.talking_npc.TalkingNPC, For example using @create:
|
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.
|
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
|
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?",
|
"linktexts": ["Hey, do you know what this 'Evennia' thing is all about?",
|
||||||
"What's your name, little NPC?"],
|
"What's your name, little NPC?"],
|
||||||
"keywords": None,
|
"keywords": None,
|
||||||
"code": None},
|
"callback": None},
|
||||||
"info1": {"text": "Oh, Evennia is where you are right now! Don't you feel the power?",
|
"info1": {"text": "Oh, Evennia is where you are right now! Don't you feel the power?",
|
||||||
"links": ["info3", "info2", "END"],
|
"links": ["info3", "info2", "END"],
|
||||||
"linktexts":["Sure, *I* do, not sure how you do though. You are just an NPC.",
|
"linktexts":["Sure, *I* do, not sure how you do though. You are just an NPC.",
|
||||||
"Sure I do. What's yer name, NPC?",
|
"Sure I do. What's yer name, NPC?",
|
||||||
"Ok, bye for now then."],
|
"Ok, bye for now then."],
|
||||||
"keywords": None,
|
"keywords": None,
|
||||||
"code": None},
|
"callback": None},
|
||||||
"info2": {"text": "My name is not really important ... I'm just an NPC after all.",
|
"info2": {"text": "My name is not really important ... I'm just an NPC after all.",
|
||||||
"links": ["info3", "info1"],
|
"links": ["info3", "info1"],
|
||||||
"linktexts": ["I didn't really want to know it anyhow.",
|
"linktexts": ["I didn't really want to know it anyhow.",
|
||||||
"Okay then, so what's this 'Evennia' thing about?"],
|
"Okay then, so what's this 'Evennia' thing about?"],
|
||||||
"keywords": None,
|
"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.",
|
"info3": {"text": "Well ... I'm sort of busy so, have to go. NPC business. Important stuff. You wouldn't understand.",
|
||||||
"links": ["END", "info2"],
|
"links": ["END", "info2"],
|
||||||
"linktexts": ["Oookay ... I won't keep you. Bye.",
|
"linktexts": ["Oookay ... I won't keep you. Bye.",
|
||||||
"Wait, why don't you tell me your name first?"],
|
"Wait, why don't you tell me your name first?"],
|
||||||
"keywords": None,
|
"keywords": None,
|
||||||
"code": None},
|
"callback": None},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue