How to Stack Alert messages
How to Stack Alert messages
Hello, I'm still making the game well using the Dialog System Asset.
I'm curious if I can get an idea while using the asset.
I wonder if I can implement the functions I want to create currently using the conversation system.
The function I want to create is a function that stacks Alert Messages in the same format as Log and uses them like an indicator.
During the game or conversation, I was planning to use ShowAlert at the desired time.
(And this message doesn't disappear until a certain number of times)
Like this : However, if you duplicate and use the Alert Message component several times, several Alert Messages will only be output in order as follows : Can I use the Dialogue System to create the functions I want?
Should we use the Alert Message or create a UI type exclusively for indicators?
If you have any ideas, please let me know. Thank you!
* I used a translator.
I'm curious if I can get an idea while using the asset.
I wonder if I can implement the functions I want to create currently using the conversation system.
The function I want to create is a function that stacks Alert Messages in the same format as Log and uses them like an indicator.
During the game or conversation, I was planning to use ShowAlert at the desired time.
(And this message doesn't disappear until a certain number of times)
Like this : However, if you duplicate and use the Alert Message component several times, several Alert Messages will only be output in order as follows : Can I use the Dialogue System to create the functions I want?
Should we use the Alert Message or create a UI type exclusively for indicators?
If you have any ideas, please let me know. Thank you!
* I used a translator.
Re: How to Stack Alert messages
Hello,
The dialogue UI code does not stack messages, but you can make a subclass of StandardDialogueUI to use your own code to show stacked messages. Override the ShowAlert() method to show the alert in your own UI that it written to stack messages. Example:
The dialogue UI code does not stack messages, but you can make a subclass of StandardDialogueUI to use your own code to show stacked messages. Override the ShowAlert() method to show the alert in your own UI that it written to stack messages. Example:
Code: Select all
public class MyDialogueUI : StandardDialogueUI
{
public override void ShowAlert(string message, float duration)
{
// ** Your code here. Example: **
StackedMessageUI.ShowAlert(message, duration);
}
}
Re: How to Stack Alert messages
Hello, thank you for the idea.
However, I'm asking you additional questions because it doesn't seem to work as intended.
1. I thought of the structure of receiving the message value received as a ShowAlert function through override and handing it over to the custom UI, and I wrote it the same as the code you wrote down. And I took a Debug.Log to see if the message value came in.
2. I put a test Dialogue System Trigger in the scene and created the following sequence through Play Sequence.
3. The script was attached to the HUD Canvas as follows.
4. However, when you run it, you can see that you are outputting a Show Alert from the Dialogue System message, but the message you have received is not captured as Debug.Log.
It is difficult to track the problem due to low coding proficiency:(
Will I be missing something?
However, I'm asking you additional questions because it doesn't seem to work as intended.
1. I thought of the structure of receiving the message value received as a ShowAlert function through override and handing it over to the custom UI, and I wrote it the same as the code you wrote down. And I took a Debug.Log to see if the message value came in.
Code: Select all
public class CHUDManager : StandardDialogueUI
{
public override void ShowAlert(string message, float duration)
{
Debug.Log(message);
}
}
Will I be missing something?
Re: How to Stack Alert messages
Hi,
ShowAlert() is not a sequencer command. It's a Lua function. In conversations, put it in the Script field.
If you're using a Dialogue System Trigger, use a Show Alert action. Alternatively, you can use a Run Lua Code action, but it's not really necessary since there's a dedicated Show Alert action:
ShowAlert() is not a sequencer command. It's a Lua function. In conversations, put it in the Script field.
If you're using a Dialogue System Trigger, use a Show Alert action. Alternatively, you can use a Run Lua Code action, but it's not really necessary since there's a dedicated Show Alert action:
Re: How to Stack Alert messages
Oh, I didn't know that! Thank you.
We confirmed that ShowAlert was connected normally from the existing StandardUI using the Lua Code.
However, the value of Debug.Log remains unchanged. For some reason, the Override script content attached to the Custom UI does not seem to be running.
The only response to the ShowAlert() call is the Alert Panel of the StandardUI referenced by the Dialogue System.
(To explain the environment in case it helps, there are MainScene and RoomScene, and Dialogue Manager is located in MainScene. The Custom Alert UI is located in RoomScene. It is played in the order of MainScene->RoomScene.)
We confirmed that ShowAlert was connected normally from the existing StandardUI using the Lua Code.
However, the value of Debug.Log remains unchanged. For some reason, the Override script content attached to the Custom UI does not seem to be running.
The only response to the ShowAlert() call is the Alert Panel of the StandardUI referenced by the Dialogue System.
(To explain the environment in case it helps, there are MainScene and RoomScene, and Dialogue Manager is located in MainScene. The Custom Alert UI is located in RoomScene. It is played in the order of MainScene->RoomScene.)
Re: How to Stack Alert messages
Alerts will use the current dialogue UI. In other words, they'll be shown using DialogueManager.dialogueUI.ShowAlert().
By default, the Dialogue Manager in MainScene will survive into RoomScene, supplanting any Dialogue Manager that might be in RoomScene.
This means alerts will go through the MainScene Dialogue Manager's Dialogue UI.
However, there are ways to tell the Dialogue Manager to use a different dialogue UI, such as the Override Dialogue UI component or using the C# method DialogueManager.UseDialogueUI(). If you haven't done any of that, however, alerts will use the dialogue UI that was assigned to the Dialogue Manager in MainScene.
By default, the Dialogue Manager in MainScene will survive into RoomScene, supplanting any Dialogue Manager that might be in RoomScene.
This means alerts will go through the MainScene Dialogue Manager's Dialogue UI.
However, there are ways to tell the Dialogue Manager to use a different dialogue UI, such as the Override Dialogue UI component or using the C# method DialogueManager.UseDialogueUI(). If you haven't done any of that, however, alerts will use the dialogue UI that was assigned to the Dialogue Manager in MainScene.
Re: How to Stack Alert messages
Thank you for your continued help. I finally succeeded in uploading the Debug.log!
Re: How to Stack Alert messages
I thought it was solved, but there was a problem at the end of the last.
I connected the Override ShowAlert to the game manager and succeeded in creating an indicator every time I called ShowAlert(). (hooray!) However, if you try to screen the string value taken from ShowAlert into UIText, the following problems arise.
May I know what caused this error? .
.
Each script is as follows:
DialogueUI
GameManager
HUD Manager (Receive alert data and create indicator items.)
itemdata.AlertData(data) has a function of putting the received string value into UIText.text.
Thank you!
I connected the Override ShowAlert to the game manager and succeeded in creating an indicator every time I called ShowAlert(). (hooray!) However, if you try to screen the string value taken from ShowAlert into UIText, the following problems arise.
May I know what caused this error? .
.
Each script is as follows:
DialogueUI
Code: Select all
public class CustomDialogueUI : StandardDialogueUI
{
public override void ShowAlert(string message, float duration)
{
CGameManager.instance.IndicatorAlert(message);
}
}
Code: Select all
public void IndicatorAlert(string AlertTxt) //Call for creating an indicator.
{
HUDmanager = GameObject.Find("HUDCanvas").GetComponent<HUDManager>();
HUDmanager.IndicatorSetting(AlertTxt);
}
Code: Select all
public class HUDManager : MonoBehaviour
{
public GameObject Prefabs;
public Transform TargetPath;
public void IndicatorSetting(string data) //Create and place indicator items.
{
GameObject items = Instantiate<GameObject>(Prefabs, TargetPath);
CItemIndicator itemdata = GetComponent<CItemIndicator>();
itemdata.AlertData(data);
}
}
Thank you!
Re: How to Stack Alert messages
Hi,
The first error (NullReferenceException in line 16 HUDManager) doesn't make sense with the version of HUDManager.cs you posted because it doesn't have 16 lines. So I'll assume you fixed that error and shortened HUDManager.cs before posting here.
The second error means the built-in ShowAlert() Lua function has been unregistered, or wasn't registered in the first place. Does the scene have a Dialogue Manager GameObject?
The first error (NullReferenceException in line 16 HUDManager) doesn't make sense with the version of HUDManager.cs you posted because it doesn't have 16 lines. So I'll assume you fixed that error and shortened HUDManager.cs before posting here.
The second error means the built-in ShowAlert() Lua function has been unregistered, or wasn't registered in the first place. Does the scene have a Dialogue Manager GameObject?
Re: How to Stack Alert messages
HUD Manager's line 16 is as follows.
This is the appearance of Hierarchy
The scene moves in the order of MainMenu -> Loading -> Chamber, and the Dialogue Manager located in MainMenu has DontDestroy.
(Chamber is repeatedly loaded, and HUDCanvas is placed in Chamber scene to initialize the accumulated indicators each time it is loaded.) Indicator Manager is a node with a DIalogue System Trigger component for ShowAlert() testing.
I hope it helps.
There is no problem when you write DebugLog on Line 16. An error occurs when trying to insert the string received through ShowAlert into UItext.text, whether from HUDManager or CItem Indicator. This is the appearance of Hierarchy
The scene moves in the order of MainMenu -> Loading -> Chamber, and the Dialogue Manager located in MainMenu has DontDestroy.
(Chamber is repeatedly loaded, and HUDCanvas is placed in Chamber scene to initialize the accumulated indicators each time it is loaded.) Indicator Manager is a node with a DIalogue System Trigger component for ShowAlert() testing.
I hope it helps.
Last edited by 2gold on Fri Oct 08, 2021 11:16 am, edited 1 time in total.