SMS template - when there are new entries user didn't see
SMS template - when there are new entries user didn't see
I have a phone in the game, where I want to see notifications about the new messages. Is there a way to learn if there are new messages in the conversations somehow?
Re: SMS template - when there are new entries user didn't see
Hi!
First, let's say a conversation looks like this:
The conversation will stop at the node with the condition until IsAtPark() is true.
Here are two ideas on how to handle it:
1. You could handle it outside of the conversation. When you make whatever change causes IsAtPark() to be true, also activate a custom "new message" indicator. The conversation doesn't need to know about this.
2. Or handle it in the conversation. To do this, you'll need to get the SMSDialogueUI's
First, let's say a conversation looks like this:
The conversation will stop at the node with the condition until IsAtPark() is true.
Here are two ideas on how to handle it:
1. You could handle it outside of the conversation. When you make whatever change causes IsAtPark() to be true, also activate a custom "new message" indicator. The conversation doesn't need to know about this.
2. Or handle it in the conversation. To do this, you'll need to get the SMSDialogueUI's
Spoiler
Code: Select all
public bool AreThereNewEntries(string conversationTitle);
// Get the conversation's current history:
string dialogueEntryRecords = DialogueLua.GetVariable($"DialogueEntryRecords_{conversationTitle}").asString;
// Get the last dialogue entry in the conversation history:
string[] values = s.Split(';');
if (values.Count >= 3)
{
var conversationID = Tools.StringToInt(values[values.Length - 2]);
var entryID = Tools.StringToInt(values[values.Length - 1]);
}
DialogueEntry entry = DialogueManager.masterDatabase.GetDialogueEntry(conversationID, entryID);
// Check if any of its children are currently valid:
foreach (Link link in entry.outgoingLinks)
{
DialogueEntry entry = DialogueManager.masterDatabase.GetDialogueEntry(link);
if (Lua.IsTrue(entry.conditionsString)) return true;
}
// Otherwise no new entries are available:
return false;
}