forked from jonepatr/furhat-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwerewolf_test.py
78 lines (67 loc) · 2.23 KB
/
werewolf_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import sys
import clr
# This variable points to where the FAtiMA Libraries are located in your
# machine
fatima_lib_path = r"C:\GIT\furhat-client-fatima\fatima"
sys.path.append(fatima_lib_path)
clr.AddReference("IntegratedAuthoringTool")
from System import Array
from IntegratedAuthoringTool import IntegratedAuthoringToolAsset
from IntegratedAuthoringTool import IATConsts
from IntegratedAuthoringTool.DTOs import CharacterSourceDTO
from RolePlayCharacter import RolePlayCharacterAsset
from RolePlayCharacter import EventHelper
# Load the Scenario Configuration
scenarioFile = 'C:/GIT/furhat-client-fatima/scenarios/test1.iat'
outputFile = 'C:/GIT/furhat-client-fatima/scenarios/output.rpc'
iat = IntegratedAuthoringToolAsset.LoadFromFile(scenarioFile)
print('- Scenario Information -')
print('Name: ', iat.ScenarioName)
print('Description: ', iat.ScenarioDescription)
print('\n')
# Load All The Character Sources
sources = []
for s in iat.GetAllCharacterSources():
sources.append(s.Source)
# Loading the First Character From the Scenario
rpc = RolePlayCharacterAsset.LoadFromFile(sources[0])
rpc.LoadAssociatedAssets()
iat.BindToRegistry(rpc.DynamicPropertiesRegistry)
print('- Character Information -')
print('Name: ', rpc.CharacterName)
print('Mood: ', rpc.Mood)
print('\n')
# Action Event
evt = EventHelper.ActionEnd('PlayerA', 'Accuse', str(rpc.CharacterName))
print('\n', evt, '\n')
rpc.Perceive(evt)
rpc.SaveToFile(outputFile)
rpc.Update()
# Property Change Event
evt = EventHelper.PropertyChange('Suspects(Furhat,A)', '1', 'Furhat')
print('\n', evt, '\n')
rpc.Perceive(evt)
rpc.SaveToFile(outputFile)
suspectsA = rpc.GetBeliefValue('Suspects(Furhat,A)')
print('\n', suspectsA, '\n')
# responses = []
# for d in rpc.Decide():
# pa = []
# for p in d.Parameters:
# pa.append(p)
#
# for r in iat.GetDialogueActions('Agent', pa[0], pa[1], pa[2], pa[3]):
# responses.append(r)
#
# response = responses[0]
# print('Character Response: ', responses[0].Utterance)
#
# # Property Change Event
# curState = responses[0].NextState
# dState = 'DialogueState(Player)'
# evt = EventHelper.PropertyChange(dState, curState, str(rpc.CharacterName))
# print('\n', evt, '\n')
# rpc.Perceive(evt)
#
# print('\n')
# print('Character Mood: ', rpc.Mood, '\n')