Page 1 of 1
How to track if a line is read already?
Posted: Sun Mar 30, 2025 6:42 pm
by Simon C
Hi, I am implementing two features that need some mechanic to memorize if a line is read already:
1. A skip-through feature that allows the player to jump to the next unread line.
2. Reading some lines will cost player's resource. However, if the line is already read (i.e. the player already paid to read), the player doesn't need to "pay" twice.
I want the line's read/unread status also be savable along with other data as well. Does Dialogue System for Unity provide such metadata on lines to keep track of? Or do I need to implement my own system to do so? Any suggestions?
Thank you!
Re: How to track if a line is read already?
Posted: Sun Mar 30, 2025 7:39 pm
by Tony Li
If you want to track all lines (all dialogue entries) use
SimStatus. In code, you can check
DialogueLua.
GetSimStatus().
If you only need to track a much smaller subset of lines, you might find it easier to use DS variables for those specific dialogue entries.
Re: How to track if a line is read already?
Posted: Mon Mar 31, 2025 11:50 pm
by Simon C
Thanks Tony, this is the script I appended to a node, but it seems raising some syntax errors:
Variable["Option_1_energy_cost"] = -3;
Variable["Option_2_energy_cost"] = -3;
Variable["Option_3_energy_cost"] = 0;
if Dialogue[203].SimStatus == "WasDisplayed" then Variable["Option_2_energy_cost"] = 0
I am not sure which part went wrong as I am very new to Lua... Though I am pretty sure it's line 4 causing the problem. Could you help me to take a look? Thanks!
Re: How to track if a line is read already?
Posted: Tue Apr 01, 2025 7:13 am
by Tony Li
Hi,
Try this:
Code: Select all
if Dialog[203].SimStatus == "WasDisplayed" then Variable["Option_2_energy_cost"] = 0 end
Lua, unlike C#, expects "end" at the end of an "if" statement, like;
Also, use "Dialog[]", not "Dialogue[]". It's inconsistent with the spelling of "dialogue" elsewhere in the Dialogue System, but this naming convention is a precedent carried over from Chat Mapper. (The Dialogue System shares the same internal data structure as Chat Mapper.)
Re: How to track if a line is read already?
Posted: Wed Apr 02, 2025 1:21 am
by Simon C
Re: How to track if a line is read already?
Posted: Wed Apr 02, 2025 7:17 am
by Tony Li
Glad to help!
Re: How to track if a line is read already?
Posted: Sun Apr 13, 2025 7:44 pm
by Simon C
Hi Tony, I've been playing around SimStatus for a while, and now I have a few follow-up questions in mind:
1) In the manual it says SimStatus is a value maintained at runtime. Is there any built-in mechanics to save SimStatus to disk? That means each time player re-open the game, the SimStatus of previous gaming session will be loaded -- just like any change made on a ScriptableObject would be static -- and lines player has read will always be read. If there is not a built-in one, what cost-efficient implementations would you suggest?
2) Is there a built-in "fast forward" feature so that I can easily make either a clickable button or a key input to accelerate typewriter effect on read lines and progress to the next line? Just like the left-ctrl button we usually see in visual novels. Any ideas on how to implement it?
Currently I have setup TextMeshProTypewriterEffect and StandardUIContinueButtonFastForward.
Thanks!
Re: How to track if a line is read already?
Posted: Sun Apr 13, 2025 8:33 pm
by Tony Li
Hi,
Simon C wrote: ↑Sun Apr 13, 2025 7:44 pm1) In the manual it says SimStatus is a value maintained at runtime. Is there any built-in mechanics to save SimStatus to disk?
Yes. If you set up the
save system, the Dialogue System Saver component will save SimStatus. (The Dialogue System Saver will also save variables' runtime values, quest states, etc.)
Simon C wrote: ↑Sun Apr 13, 2025 7:44 pm2) Is there a built-in "fast forward" feature so that I can easily make either a clickable button or a key input to accelerate typewriter effect on read lines and progress to the next line? Just like the left-ctrl button we usually see in visual novels. Any ideas on how to implement it?
StandardUIContinueButtonFastForward should do that. Please see:
How To: Set Up Continue Button Typewriter Fast Forward. The Conversation Control component also has some methods that you can, for example, connect to UI buttons to skip the continue button or skip all text until the end of the conversation or a response menu.
Re: How to track if a line is read already?
Posted: Sun Apr 13, 2025 9:44 pm
by Simon C
I‘ve checked out StandardUIContinueButtonFastForward and the how-to post you pointed. But I don't think there's something already built for the feature I want.
Right now, a single click will fast forward a single line. That's good. But if I want to fast forward multiple lines, I need to smash the click button to do so. What I want is to have a button (not an UI button but maybe calling Input.GetKey every frame on a keyboard key) such that when the button/key is hold, read lines (SimStatus == "WasDisplayed") will keep forwarded until the next unread line (SimStatus == "Untouched").
Is there an existing component to do the job? It would be similar to the Conversation Control component except the typewriter effect will also be shown.
Re: How to track if a line is read already?
Posted: Mon Apr 14, 2025 8:54 am
by Tony Li
Hi,
You'd need to write a custom script for that. You can follow ConversationControl as a model. And if you have any questions about it, please feel free to ask here.