Been looking around and searching in both this forum and in the online manual, but I can't figure out how to retrieve the current simstatus of a dialogue entry?
When the player is presented with multiple responses, I want a typewriter effect only to happen on the new response, which has not been offered/shown before. The responses which are already shown previously should skip the typewriter effect, and just show the entire dialogue response line at once.
How to get the sim status of a dialogue in scripting
-
- Posts: 11
- Joined: Mon May 14, 2018 5:57 am
Re: How to get the sim status of a dialogue in scripting
Hi,
The DialogueLua class provides methods to set SimStatus, but it assumes that SimStatus will only be checked internally so it doesn't provide a method to get SimStatus. Instead, you'll need to use Lua.Run() in an OnPrepareConversationLine method. Here's an example:
The DialogueLua class provides methods to set SimStatus, but it assumes that SimStatus will only be checked internally so it doesn't provide a method to get SimStatus. Instead, you'll need to use Lua.Run() in an OnPrepareConversationLine method. Here's an example:
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class LogSimStatus : MonoBehaviour
{
void OnPrepareConversationLine(DialogueEntry entry)
{
var simStatus = Lua.Run("return Conversation[" + entry.conversationID + "].Dialog[" + entry.id + "].SimStatus").AsString;
Debug.Log("Line '" + entry.DialogueText + "' SimStatus=" + simStatus);
}
}
-
- Posts: 11
- Joined: Mon May 14, 2018 5:57 am
Re: How to get the sim status of a dialogue in scripting
Thanks for looking into it, Tony.
Using the OnPrepareConversationLine only debugs dialogue lines as far as I can see and not Response options. Maybe I wasn't clear enough on what I want to achieve.
Using the OnConversationResponseMenu(Response[] responses) instead gives me the actual responses in the menu, eg. like this debug prinout:
Response 'Can I ask who you are?' SimStatus=WasOffered delaySimStatus: False
Response 'You seem kind of frustrated! Are you ok?' SimStatus=WasOffered delaySimStatus: False
The issue is that in the documentation it seems like OnConversationResponseMenu should trigger before actual showing the response options:
But as you can see in the debug printout, at the moment the OnConversationResponseMenu triggers, their SimStatus is already "WasOffered".
Is there a way to check if a response option is showing for the first time, as in retrieving the "Untouched" simStatus for a response?
Btw. I have no idea what "delaySimStatus" does, but added it to the printout just in case.
Using the OnPrepareConversationLine only debugs dialogue lines as far as I can see and not Response options. Maybe I wasn't clear enough on what I want to achieve.
Using the OnConversationResponseMenu(Response[] responses) instead gives me the actual responses in the menu, eg. like this debug prinout:
Response 'Can I ask who you are?' SimStatus=WasOffered delaySimStatus: False
Response 'You seem kind of frustrated! Are you ok?' SimStatus=WasOffered delaySimStatus: False
The issue is that in the documentation it seems like OnConversationResponseMenu should trigger before actual showing the response options:
http://www.pixelcrushers.com/dialogue_s ... sages.htmlSent before showing a response menu
But as you can see in the debug printout, at the moment the OnConversationResponseMenu triggers, their SimStatus is already "WasOffered".
Is there a way to check if a response option is showing for the first time, as in retrieving the "Untouched" simStatus for a response?
Btw. I have no idea what "delaySimStatus" does, but added it to the printout just in case.
Re: How to get the sim status of a dialogue in scripting
Hi,
The Dialogue System uses a data model established by Chat Mapper. delaySimStatus is a Chat Mapper value that's not used in the Dialogue System. (It doesn't work the way you'd need in Chat Mapper, either.)
Do you want to play the typewriter effect in the response menu itself (i.e., on the response buttons), or in the PC's subtitle text after the player has clicked on a response button?
If it's the PC's subtitle text, do you want to play the typewriter effect the first time the player has clicked on the response button, or only if the player has clicked on the response button and this is the first time the button has been shown in the menu?
If you want to play the typewriter effect in the response menu itself, that's a little harder. As you've seen, the Dialogue System marks the entries "WasOffered" before calling OnConversationResponseMenu.
The Dialogue System uses a data model established by Chat Mapper. delaySimStatus is a Chat Mapper value that's not used in the Dialogue System. (It doesn't work the way you'd need in Chat Mapper, either.)
Do you want to play the typewriter effect in the response menu itself (i.e., on the response buttons), or in the PC's subtitle text after the player has clicked on a response button?
If it's the PC's subtitle text, do you want to play the typewriter effect the first time the player has clicked on the response button, or only if the player has clicked on the response button and this is the first time the button has been shown in the menu?
If you want to play the typewriter effect in the response menu itself, that's a little harder. As you've seen, the Dialogue System marks the entries "WasOffered" before calling OnConversationResponseMenu.
-
- Posts: 11
- Joined: Mon May 14, 2018 5:57 am
Re: How to get the sim status of a dialogue in scripting
Thanks for clearing that up.
I want to show the effect as we see the response options in the "response menu".
So if it's not doable, I will just cache the already shown responses, and if the response line is not previously found, I'll trigger the typewriter effect and add that to the cached responses.
I want to show the effect as we see the response options in the "response menu".
So if it's not doable, I will just cache the already shown responses, and if the response line is not previously found, I'll trigger the typewriter effect and add that to the cached responses.
Re: How to get the sim status of a dialogue in scripting
It's not doable with SimStatus. If you end up not using SimStatus, untick the Dialogue Manager's Include SimStatus checkbox to save memory.
You can still use the Dialogue System to cache the information. Define a custom field in your dialogue entry template (on the Template tab of the Dialogue Editor). For example, define a Boolean field named Typed whose initial value is false. When you show the response menu, if Typed is false then play the typewriter effect and set it true.
You can still use the Dialogue System to cache the information. Define a custom field in your dialogue entry template (on the Template tab of the Dialogue Editor). For example, define a Boolean field named Typed whose initial value is false. When you show the response menu, if Typed is false then play the typewriter effect and set it true.
-
- Posts: 11
- Joined: Mon May 14, 2018 5:57 am
Re: How to get the sim status of a dialogue in scripting
Thanks Tony, I made it work with adding a variable to the Dialogue Entries template, as you suggested
Re: How to get the sim status of a dialogue in scripting
Great! Glad I could help.