Description:
Fix dialog bugs.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r429:63185be3ab12 -

@@ -40,20 +40,16
40 40 Governor: Welcome to your new park, director!
41 41
42 42 * [Okay]
43
44 43 Governor: Make sure that you keep visitors happy and the budget in the black! You're currently getting an annual grant out of my budget—it'd sure be nice if you park were self-sufficient so we could drop that expense!
45 44
46 45 * * [And I need to keep the forest healthy, too, right?]
47 46 ~ GovernorOpinion = GovernorOpinion - 1
48
49
50 47 Governor: Ummm, yeah
51 48 * * * [\...]
52 49 -> END
53 50 * * [Sounds good!]
54 51 ~ GovernorOpinion = GovernorOpinion + 1
55 52
56
57 53 Governor: I'll check in soon.
58 54
59 55
@@ -64,16 +60,17
64 60
65 61 \#assistantName\#: Hello. I'm \#assistantName\#.
66 62 * [Nice to meet you.]
67 You can use the mouse or arrow keys to move around, and the plus and minus keys to zoom in and out. B opens the budget and F lets you adjust Forest Policy.
63
64 \#assistantName\#: You can use the mouse or arrow keys to move around, and the plus and minus keys to zoom in and out. B opens the budget and F lets you adjust Forest Policy.
68 65
69 66 * * [Got it, thanks.]
70 67
71 \#assistantName\#: Bye
68 \#assistantName\#: Bye
72 69 -> END
73 70 * * [How are you?]
74 71
75 \#assistantName\#: \#howdoing\#
76 -> END
72 \#assistantName\#: \#howdoing\#
73 -> END
77 74
78 75
79 76 === BadNewsReact ===
@@ -107,6 +104,7
107 104 === MassVandalism ===
108 105 \#assistantName\#: Bad news, director.
109 106 + [Oh?]
107
110 108 \#assistantName\#: A number of trees have been seriously damaged overnight.
111 109 + + [How bad are they?]
112 110
@@ -1,1 +1,1
1 {"inkVersion":20,"root":[[["done",{"#f":5,"#n":"g-0"}],null],"done",{"placeholder":["end",{"#f":1}],"alter":[{"temp=":"k"},{"temp=":"x"},"ev",{"VAR?":"x"},{"VAR?":"k"},"+","/ev",{"temp=":"x","re":true},{"#f":1}],"inc":[{"temp=":"x"},"ev",{"VAR?":"x"},1,"+","/ev",{"temp=":"x","re":true},{"#f":1}],"dec":[{"temp=":"x"},"ev",{"VAR?":"x"},1,"-","/ev",{"temp=":"x","re":true},{"#f":1}],"Once":[["^Once upon a time...","\n",["ev",{"^->":"Once.0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":2},{"s":["^There were two choices.",{"->":"$r","var":true},null]}],["ev",{"^->":"Once.0.3.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-1","flg":2},{"s":["^There were four lines of content.",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"Once.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.2.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},{"#f":5}],"c-1":["ev",{"^->":"Once.0.c-1.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.3.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},{"#f":5}],"g-0":["^They lived happily ever after.","\n","end",{"#f":5}]}],{"#f":1}],"IntroGovernor":[["^Governor: Welcome to your new park, director!","\n","ev","str","^Okay","/str","/ev",{"*":".^.c-0","flg":20},{"c-0":["\n","^Governor: Make sure that you keep visitors happy and the budget in the black! You're currently getting an annual grant out of my budget—it'd sure be nice if you park were self-sufficient so we could drop that expense!","\n",["ev","str","^And I need to keep the forest healthy, too, right?","/str","/ev",{"*":".^.c-0","flg":20},"ev","str","^Sounds good!","/str","/ev",{"*":".^.c-1","flg":20},{"c-0":["^ ","\n","ev",{"VAR?":"GovernorOpinion"},1,"-","/ev",{"VAR=":"GovernorOpinion","re":true},"^Governor: Ummm, yeah","\n",["ev","str","^...","/str","/ev",{"*":".^.c-0","flg":20},{"c-0":["\n","end",{"#f":5}]}],{"#f":5}],"c-1":["\n","ev",{"VAR?":"GovernorOpinion"},1,"+","/ev",{"VAR=":"GovernorOpinion","re":true},"^Governor: I'll check in soon.","\n","end",{"#f":5}]}],{"#f":5}]}],{"#f":1}],"IntroAssistant":[["^#assistantName#: Hello. I'm #assistantName#.","\n","ev","str","^Nice to meet you.","/str","/ev",{"*":".^.c-0","flg":20},{"c-0":["\n","^You can use the mouse or arrow keys to move around, and the plus and minus keys to zoom in and out. B opens the budget and F lets you adjust Forest Policy.","\n",["ev","str","^Got it, thanks.","/str","/ev",{"*":".^.c-0","flg":20},"ev","str","^How are you?","/str","/ev",{"*":".^.c-1","flg":20},{"c-0":["\n","^#assistantName#: Bye","\n","end",{"#f":5}],"c-1":["\n","^#assistantName#: #howdoing#","\n","end",{"#f":5}]}],{"#f":5}]}],{"#f":1}],"BadNewsReact":[["ev","str","^Damn.","/str","/ev",{"*":".^.c-0","flg":4},"ev","str","^Fuck.","/str","/ev",{"*":".^.c-1","flg":4},"ev","str","^Shoot.","/str","/ev",{"*":".^.c-2","flg":4},"ev","str","^*Sigh.* Fine.","/str","/ev",{"*":".^.c-3","flg":4},"ev","str","^Who cares?","/str","/ev",{"*":".^.c-4","flg":4},{"c-0":["^ ","ev",{"^var":"playerSwears","ci":-1},{"f()":"inc"},"out","/ev","\n","ev","void","/ev","->->",{"#f":5}],"c-1":["^ ","ev",{"^var":"playerSwears","ci":-1},{"f()":"inc"},"out","/ev","\n","ev","void","/ev","->->",{"#f":5}],"c-2":["^ ","ev",{"^var":"playerSwears","ci":-1},{"f()":"inc"},"out","/ev","\n","ev","void","/ev","->->",{"#f":5}],"c-3":["\n","ev","void","/ev","->->",{"#f":5}],"c-4":["\n","ev","void","/ev","->->",{"#f":5}]}],{"#f":1}],"AssistantAcknowlege":[["ev","str","^Thanks.","/str","/ev",{"*":".^.c-0","flg":4},"ev","str","^Mmmm hmm.","/str","/ev",{"*":".^.c-1","flg":4},"ev","str","^Get to it.","/str","/ev",{"*":".^.c-2","flg":4},"ev","str","^I really appreciate it, #assistantName#","/str","/ev",{"*":".^.c-3","flg":4},{"c-0":["\n","ev","void","/ev","->->",{"#f":5}],"c-1":["\n","ev","void","/ev","->->",{"#f":5}],"c-2":["^ ","ev",{"^var":"playerRude","ci":-1},{"f()":"inc"},"out","/ev","\n","ev","void","/ev","->->",{"#f":5}],"c-3":["\n",{"->":".^.^.^.Appreciate"},{"#f":5}]}],{"Appreciate":["^#assistantName#: ","ev",{"VAR?":"assistantTraits"},{"VAR?":"shy"},"?","/ev",[{"->":".^.b","c":true},{"b":["^...",{"->":".^.^.^.8"},null]}],[{"->":".^.b"},{"b":[["ev","visit",3,"seq","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"ev","du",2,"==","/ev",{"->":".^.s2","c":true},"nop",{"s0":["pop","^No problem.",{"->":".^.^.23"},null],"s1":["pop","^Oh, you're welcome.",{"->":".^.^.23"},null],"s2":["pop","^My pleasure.",{"->":".^.^.23"},null],"#f":5}],{"->":".^.^.^.8"},null]}],"nop","\n","ev","void","/ev","->->",{"#f":1}],"#f":1}],"MassVandalism":[["^#assistantName#: Bad news, director.","\n","ev","str","^Oh?","/str","/ev",{"*":".^.c-0","flg":4},{"c-0":["\n","^#assistantName#: A number of trees have been seriously damaged overnight.","\n",["ev","str","^How bad are they?","/str","/ev",{"*":".^.c-0","flg":4},{"c-0":["\n","^#assistantName#: I'm no botanist, but they're not great. The gouges are pretty deep.","\n",{"->t->":"BadNewsReact"},"^#assistantName#: Yeah, it's ","ev",{"VAR?":"assistantTraits"},{"VAR?":"sweary"},"?","/ev",[{"->":".^.b","c":true},{"b":["^fucking",{"->":".^.^.^.11"},null]}],"nop","^ awful.","\n","^I'll see who's around and get to cleaning.","\n",{"->t->":"AssistantAcknowlege"},"end",{"#f":5}]}],{"#f":5}]}],{"#f":1}],"global decl":["ev",0,{"VAR=":"playerSwears"},0,{"VAR=":"playerRude"},0,{"VAR=":"GovernorOpinion"},{"list":{},"origins":["assistantTraits"]},{"VAR=":"assistantTraits"},"/ev","end",null],"#f":1}],"listDefs":{"assistantTraits":{"shy":1,"esoteric":2,"sweary":3}}} No newline at end of file
1 {"inkVersion":20,"root":[[["done",{"#f":5,"#n":"g-0"}],null],"done",{"placeholder":["end",{"#f":1}],"alter":[{"temp=":"k"},{"temp=":"x"},"ev",{"VAR?":"x"},{"VAR?":"k"},"+","/ev",{"temp=":"x","re":true},{"#f":1}],"inc":[{"temp=":"x"},"ev",{"VAR?":"x"},1,"+","/ev",{"temp=":"x","re":true},{"#f":1}],"dec":[{"temp=":"x"},"ev",{"VAR?":"x"},1,"-","/ev",{"temp=":"x","re":true},{"#f":1}],"Once":[["^Once upon a time...","\n",["ev",{"^->":"Once.0.2.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-0","flg":2},{"s":["^There were two choices.",{"->":"$r","var":true},null]}],["ev",{"^->":"Once.0.3.$r1"},{"temp=":"$r"},"str",{"->":".^.s"},[{"#n":"$r1"}],"/str","/ev",{"*":".^.^.c-1","flg":2},{"s":["^There were four lines of content.",{"->":"$r","var":true},null]}],{"c-0":["ev",{"^->":"Once.0.c-0.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.2.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},{"#f":5}],"c-1":["ev",{"^->":"Once.0.c-1.$r2"},"/ev",{"temp=":"$r"},{"->":".^.^.3.s"},[{"#n":"$r2"}],"\n",{"->":".^.^.g-0"},{"#f":5}],"g-0":["^They lived happily ever after.","\n","end",{"#f":5}]}],{"#f":1}],"IntroGovernor":[["^Governor: Welcome to your new park, director!","\n","ev","str","^Okay","/str","/ev",{"*":".^.c-0","flg":20},{"c-0":["\n","^Governor: Make sure that you keep visitors happy and the budget in the black! You're currently getting an annual grant out of my budget—it'd sure be nice if you park were self-sufficient so we could drop that expense!","\n",["ev","str","^And I need to keep the forest healthy, too, right?","/str","/ev",{"*":".^.c-0","flg":20},"ev","str","^Sounds good!","/str","/ev",{"*":".^.c-1","flg":20},{"c-0":["^ ","\n","ev",{"VAR?":"GovernorOpinion"},1,"-","/ev",{"VAR=":"GovernorOpinion","re":true},"^Governor: Ummm, yeah","\n",["ev","str","^...","/str","/ev",{"*":".^.c-0","flg":20},{"c-0":["\n","end",{"#f":5}]}],{"#f":5}],"c-1":["\n","ev",{"VAR?":"GovernorOpinion"},1,"+","/ev",{"VAR=":"GovernorOpinion","re":true},"^Governor: I'll check in soon.","\n","end",{"#f":5}]}],{"#f":5}]}],{"#f":1}],"IntroAssistant":[["^#assistantName#: Hello. I'm #assistantName#.","\n","ev","str","^Nice to meet you.","/str","/ev",{"*":".^.c-0","flg":20},{"c-0":["\n","^#assistantName#: You can use the mouse or arrow keys to move around, and the plus and minus keys to zoom in and out. B opens the budget and F lets you adjust Forest Policy.","\n",["ev","str","^Got it, thanks.","/str","/ev",{"*":".^.c-0","flg":20},"ev","str","^How are you?","/str","/ev",{"*":".^.c-1","flg":20},{"c-0":["\n","^#assistantName#: Bye","\n","end",{"#f":5}],"c-1":["\n","^#assistantName#: #howdoing#","\n","end",{"#f":5}]}],{"#f":5}]}],{"#f":1}],"BadNewsReact":[["ev","str","^Damn.","/str","/ev",{"*":".^.c-0","flg":4},"ev","str","^Fuck.","/str","/ev",{"*":".^.c-1","flg":4},"ev","str","^Shoot.","/str","/ev",{"*":".^.c-2","flg":4},"ev","str","^*Sigh.* Fine.","/str","/ev",{"*":".^.c-3","flg":4},"ev","str","^Who cares?","/str","/ev",{"*":".^.c-4","flg":4},{"c-0":["^ ","ev",{"^var":"playerSwears","ci":-1},{"f()":"inc"},"out","/ev","\n","ev","void","/ev","->->",{"#f":5}],"c-1":["^ ","ev",{"^var":"playerSwears","ci":-1},{"f()":"inc"},"out","/ev","\n","ev","void","/ev","->->",{"#f":5}],"c-2":["^ ","ev",{"^var":"playerSwears","ci":-1},{"f()":"inc"},"out","/ev","\n","ev","void","/ev","->->",{"#f":5}],"c-3":["\n","ev","void","/ev","->->",{"#f":5}],"c-4":["\n","ev","void","/ev","->->",{"#f":5}]}],{"#f":1}],"AssistantAcknowlege":[["ev","str","^Thanks.","/str","/ev",{"*":".^.c-0","flg":4},"ev","str","^Mmmm hmm.","/str","/ev",{"*":".^.c-1","flg":4},"ev","str","^Get to it.","/str","/ev",{"*":".^.c-2","flg":4},"ev","str","^I really appreciate it, #assistantName#","/str","/ev",{"*":".^.c-3","flg":4},{"c-0":["\n","ev","void","/ev","->->",{"#f":5}],"c-1":["\n","ev","void","/ev","->->",{"#f":5}],"c-2":["^ ","ev",{"^var":"playerRude","ci":-1},{"f()":"inc"},"out","/ev","\n","ev","void","/ev","->->",{"#f":5}],"c-3":["\n",{"->":".^.^.^.Appreciate"},{"#f":5}]}],{"Appreciate":["^#assistantName#: ","ev",{"VAR?":"assistantTraits"},{"VAR?":"shy"},"?","/ev",[{"->":".^.b","c":true},{"b":["^...",{"->":".^.^.^.8"},null]}],[{"->":".^.b"},{"b":[["ev","visit",3,"seq","/ev","ev","du",0,"==","/ev",{"->":".^.s0","c":true},"ev","du",1,"==","/ev",{"->":".^.s1","c":true},"ev","du",2,"==","/ev",{"->":".^.s2","c":true},"nop",{"s0":["pop","^No problem.",{"->":".^.^.23"},null],"s1":["pop","^Oh, you're welcome.",{"->":".^.^.23"},null],"s2":["pop","^My pleasure.",{"->":".^.^.23"},null],"#f":5}],{"->":".^.^.^.8"},null]}],"nop","\n","ev","void","/ev","->->",{"#f":1}],"#f":1}],"MassVandalism":[["^#assistantName#: Bad news, director.","\n","ev","str","^Oh?","/str","/ev",{"*":".^.c-0","flg":4},{"c-0":["\n","^#assistantName#: A number of trees have been seriously damaged overnight.","\n",["ev","str","^How bad are they?","/str","/ev",{"*":".^.c-0","flg":4},{"c-0":["\n","^#assistantName#: I'm no botanist, but they're not great. The gouges are pretty deep.","\n",{"->t->":"BadNewsReact"},"^#assistantName#: Yeah, it's ","ev",{"VAR?":"assistantTraits"},{"VAR?":"sweary"},"?","/ev",[{"->":".^.b","c":true},{"b":["^fucking",{"->":".^.^.^.11"},null]}],"nop","^ awful.","\n","^I'll see who's around and get to cleaning.","\n",{"->t->":"AssistantAcknowlege"},"end",{"#f":5}]}],{"#f":5}]}],{"#f":1}],"global decl":["ev",0,{"VAR=":"playerSwears"},0,{"VAR=":"playerRude"},0,{"VAR=":"GovernorOpinion"},{"list":{},"origins":["assistantTraits"]},{"VAR=":"assistantTraits"},"/ev","end",null],"#f":1}],"listDefs":{"assistantTraits":{"shy":1,"esoteric":2,"sweary":3}}} No newline at end of file
@@ -6,6 +6,6
6 6 ~ assistantTraits = (shy, sweary)
7 7
8 8
9 -> MassVandalism
9 -> IntroAssistant
10 10
11 11 -> END No newline at end of file
@@ -100,32 +100,20
100 100 var parts = Regex.Split(continuation, ":", 0);
101 101 var speaker = (parts.Length == 2) ? this.Grammar.Flatten(parts[0]) : "Dialog";
102 102 var dialog = (parts.Length == 2) ? this.Grammar.Flatten(parts[1]) : continuation;
103 var index = 0;
104 103
105 104 SetComponent(choiceMessage.Entity, new DialogComponent {
106 105 CurrentDialog = dialog,
107 CurrentSpeaker = speaker,
106 CurrentSpeaker = speaker.Trim(),
108 107 Options = this.Story.currentChoices
109 108 .Select(option => BleepString(option.text,
110 109 profanity_setting ))
111 110 .ToList()});
112 111
113 if (DialogSpawner.indexes.ContainsKey(this.Grammar.Flatten(speaker))) {
114 index = DialogSpawner.indexes[this.Grammar.Flatten(speaker)];
115 }
116 else {
117 do
118 {
119 index = Random.Next(0,7);
120 } while(DialogSpawner.indexes.ContainsValue(index));
112 var index = DialogSpawner.GetSpeakerImageIndex(this.Grammar, this.Random, speaker);
121 113
122 DialogSpawner.indexes[this.Grammar.Flatten(speaker)] = index;
123 }
124 114 SetComponent(choiceMessage.Entity, new ImageComponent {
125 115 ImageIndex = index});
126 116 }
127
128
129 117 else
130 118 {
131 119 Logging.Debug(String.Format("Destroying Dialog (Entity ID {0}).", choiceMessage.Entity.ID));
@@ -165,11 +153,16
165 153 SetComponent(lowestEntity, new DialogComponent {
166 154 Knot = Knot,
167 155 CurrentDialog = dialog,
168 CurrentSpeaker = speaker,
156 CurrentSpeaker = speaker.Trim(),
169 157 Options = this.Story.currentChoices
170 158 .Select(option => option.text)
171 159 .ToList()});
172 160
161 var index = DialogSpawner.GetSpeakerImageIndex(this.Grammar, this.Random, speaker);
162
163 SetComponent(lowestEntity, new ImageComponent {
164 ImageIndex = index});
165
173 166 }
174 167 }
175 168 }
@@ -45,6 +45,26
45 45 }
46 46 }
47 47
48 public static int GetSpeakerImageIndex(Grammar grammar, Random random, String speakerRaw)
49 {
50 var index = 0;
51 String speaker = grammar.Flatten(speakerRaw.Trim());
52
53 if (DialogSpawner.indexes.ContainsKey(speaker)) {
54 index = DialogSpawner.indexes[speaker];
55 }
56 else {
57 Logging.Info(String.Format("Creating a new image for speaker {0}", speaker));
58 do
59 {
60 index = random.Next(0,7);
61 } while(DialogSpawner.indexes.ContainsValue(index));
62
63 DialogSpawner.indexes[speaker] = index;
64 }
65 return index;
66 }
67
48 68 protected override void Spawn(in SpawnDialogMessage message)
49 69 {
50 70 Logging.Spy(this.Story.currentChoices.Count(), "Count");
@@ -72,7 +92,7
72 92 AddComponent(newDialog, new DialogComponent {
73 93 Knot = message.Path,
74 94 CurrentDialog = this.Grammar.Flatten(dialog),
75 CurrentSpeaker = this.Grammar.Flatten(speaker),
95 CurrentSpeaker = this.Grammar.Flatten(speaker).Trim(),
76 96 Options = this.Story.currentChoices
77 97 .Select(option => option.text)
78 98 .ToList()});
@@ -82,17 +102,7
82 102 AddComponent(newDialog,
83 103 new VisibilityComponent{ visible = true});
84 104
85 if (DialogSpawner.indexes.ContainsKey(this.Grammar.Flatten(speaker))) {
86 index = DialogSpawner.indexes[this.Grammar.Flatten(speaker)];
87 }
88 else {
89 do
90 {
91 index = Random.Next(0,7);
92 } while(DialogSpawner.indexes.ContainsValue(index));
93
94 DialogSpawner.indexes[this.Grammar.Flatten(speaker)] = index;
95 }
105 index = GetSpeakerImageIndex(this.Grammar, this.Random, speaker);
96 106
97 107 AddComponent(newDialog, new ImageComponent {
98 108 ImageIndex = index});
@@ -944,8 +944,15
944 944 additionalInfo.Add("mouse ", String.Format("{0}, {1}", state.X, state.Y));
945 945 additionalInfo.Add("mouse delta", delta.ToString());
946 946
947 string entries = "";
948 foreach (var pair in DialogSpawner.indexes)
949 {
950 entries += String.Format("{0}={1}, ", pair.Key, pair.Value);
951 }
952
947 953 additionalInfo.Add("Tracery Test", this.output);
948 954 additionalInfo.Add("Log Entry", string.Format("{0} {1}", Logging.entries[Logging.entries.Count-1].level, Logging.entries[Logging.entries.Count-1].message));
955 additionalInfo.Add("Dialog entries", entries);
949 956
950 957 debugWindow.Layout(debugInfo, additionalInfo, ref show_another_window);
951 958
@@ -151,7 +151,7
151 151 {
152 152 //Could address this with a placeholder image, but
153 153 //I think I prefer eliminating the possibility of a placeholder.
154 Logging.Warning(String.Format("Conversation (Entity ID {0}) without an image.", entity.ID));
154 // Logging.Warning(String.Format("Conversation (Entity ID {0}) without an image.", entity.ID));
155 155
156 156 }
157 157 var dialog = GetComponent<DialogComponent>(entity);
You need to be logged in to leave comments. Login now