comparison scripts/npc-test @ 521:5a8a7f17597d

Add support for 'if': '...' to dialogue choices.
author Simon Cross <hodgestar@gmail.com>
date Sat, 09 Apr 2011 23:36:05 +0200
parents b48c194c4af9
children
comparison
equal deleted inserted replaced
520:17987763b80f 521:5a8a7f17597d
37 text = state.text 37 text = state.text
38 if text is not None: 38 if text is not None:
39 text = text.encode('utf-8') 39 text = text.encode('utf-8')
40 print "%s:" % dsm.state, text 40 print "%s:" % dsm.state, text
41 print "--" 41 print "--"
42 for i, choice in state.choices: 42 for i, choice in dsm.choices():
43 print "%d: %s" % (i, choice) 43 print "%d: %s" % (i, choice)
44 if state.auto_next: 44 if state.auto_next:
45 print "N: Next" 45 print "N: Next"
46 else: 46 else:
47 print "L: Leave" 47 print "L: Leave"
87 eval(trigger._matches, {}, my_locals.copy()) 87 eval(trigger._matches, {}, my_locals.copy())
88 eval(trigger._next_state, {}, my_locals.copy()) 88 eval(trigger._next_state, {}, my_locals.copy())
89 print " Test on_entry and on_exit for state %s" % state_name 89 print " Test on_entry and on_exit for state %s" % state_name
90 state.enter(my_locals) 90 state.enter(my_locals)
91 state.leave(my_locals) 91 state.leave(my_locals)
92 list(state.choices(my_locals))
92 print "ok" 93 print "ok"
93 94
94 95
95 def test_all(game_json): 96 def test_all(game_json):
96 game = GameState(game_json) 97 game = GameState(game_json)