snozbot / fungus

An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
MIT License
1.6k stars 291 forks source link

Narrative Log - Doesn't support tag {wc} #938

Closed ianicmathieu closed 3 years ago

ianicmathieu commented 3 years ago

Describe the bug The narrative log doesn't support the commonly used tag {wc}.

To Reproduce Simple create a Narrative log. Create a Node with a SayDialog or a Conversation.

Add text : Hi {wc} Welcome {wc} Hello.

Expected behavior the Narrative Log should displays : Hi Welcome Hello

Current result: the Narrative Log displays: Hello

Peter has a solution - Please follow up with him.

wolfrug commented 3 years ago

In Writer.cs, add an extra NotifyEnd(false) in the DoWaitForInput method on line ~690

"in short what happens is that when the Writer notices the {wc} command, it starts that coroutine, where it waits for input, and if it's set to clear (in the case of the wc command, e.g. wait for input-clear) and then it clears the text and then continues

the narrative log in turn is listening to the "writer end" signal which only happens once for a say command full of {wc} hence why it only picks up the last line but by putting that there (IN FRONT OF THE CLEAR!) it runs it an extra time"

stevehalliwell commented 3 years ago

There are a number of use cases for {wc}, might need to add additional tokens that do the same logic but have different symantic meanings. But, the suggestion here makes the most sense, and is in line with the current examples in the wiki. It's certainly more useful that what it does now.

I'm going to go ahead and implement the proposed solve from wolfrug.