Mercurial > skaapsteker
comparison scripts/npc-test @ 222:2cbeeef5867c
Fix npc tester (again).
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Thu, 07 Apr 2011 01:15:47 +0200 |
parents | a4c4e2f34162 |
children | 13b912f40a10 |
comparison
equal
deleted
inserted
replaced
221:9e2949210c07 | 222:2cbeeef5867c |
---|---|
10 | 10 |
11 from skaapsteker.dialogue import DSM, DsmEvent | 11 from skaapsteker.dialogue import DSM, DsmEvent |
12 from skaapsteker.gamestate import GameState | 12 from skaapsteker.gamestate import GameState |
13 | 13 |
14 | 14 |
15 def run(npc_file): | 15 def run(npc_name): |
16 game = GameState("game.json") | 16 game = GameState("game.json") |
17 name = os.path.splitext(os.path.basename(npc_file))[0] | 17 npc = getattr(game.world.npcs, npc_name) |
18 dsm = DSM(name, game.world, npc_file) | 18 dsm = DSM(npc_name, game.world, npc.dsm, npc.state) |
19 | 19 |
20 print "States:" | 20 print "States:" |
21 print "-------" | 21 print "-------" |
22 pprint(dsm.states.keys()) | 22 pprint(dsm.states.keys()) |
23 print | 23 print |
40 | 40 |
41 print "--" | 41 print "--" |
42 | 42 |
43 | 43 |
44 def main(): | 44 def main(): |
45 p = optparse.OptionParser(usage="%prog [options] <npc json state file>") | 45 p = optparse.OptionParser(usage="%prog [options] <npc name>") |
46 opts, args = p.parse_args() | 46 opts, args = p.parse_args() |
47 if len(args) != 1: | 47 if len(args) != 1: |
48 p.error("Must provide an npc json file") | 48 p.error("Must provide an npc json file") |
49 run(args[0]) | 49 run(args[0]) |
50 | 50 |