Some advises on start needed

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Some advises on start needed

Post by Tony Li »

Hi,

That's C# code. You'll need to use a script to process the text and assign the result to the UI Text.

You can use this script:
CodedText.cs

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class CodedText : MonoBehaviour
{

    private UnityEngine.UI.Text text;
    private string originalValue = string.Empty;

    private void Awake()
    {
        text = GetComponent<UnityEngine.UI.Text>();
    }

    private void Start()
    {
        UpdateText();
    }

    public void UpdateText()
    {
        if (string.IsNullOrEmpty(originalValue)) originalValue = text.text;
        text.text = FormattedText.ParseCode(originalValue);
    }
}
It will update the text once when the GameObject starts. If you need to update it again, call the UpdateText() method. For example, you can rename the UI Text GameObject to a unique name such as "Money Count Value Text" and set a Sequence to:

Code: Select all

SendMessage(UpdateText,,Money Count Value Text)
pavsikakyj
Posts: 31
Joined: Fri Oct 06, 2017 11:34 am

Re: Some advises on start needed

Post by pavsikakyj »

I'm afraid it's too complicated for me. I’m not a coder – just a storyteller and a bit artist. Tried to apply new script component to a text panel, but failed. Guess, I have to find another way to display variables. Like separate conversation or something.

VN framework manual says it’s possible to show “to do” list with quest element. How may I do this inside VN framework? And may be this feature will help me to show variables to the player?


Tony Li wrote: Sun Jul 29, 2018 11:14 am Hi,

That's C# code. You'll need to use a script to process the text and assign the result to the UI Text.

You can use this script:
CodedText.cs

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class CodedText : MonoBehaviour
{

    private UnityEngine.UI.Text text;
    private string originalValue = string.Empty;

    private void Awake()
    {
        text = GetComponent<UnityEngine.UI.Text>();
    }

    private void Start()
    {
        UpdateText();
    }

    public void UpdateText()
    {
        if (string.IsNullOrEmpty(originalValue)) originalValue = text.text;
        text.text = FormattedText.ParseCode(originalValue);
    }
}
It will update the text once when the GameObject starts. If you need to update it again, call the UpdateText() method. For example, you can rename the UI Text GameObject to a unique name such as "Money Count Value Text" and set a Sequence to:

Code: Select all

SendMessage(UpdateText,,Money Count Value Text)
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Some advises on start needed

Post by Tony Li »

Hi,
pavsikakyj wrote: Mon Jul 30, 2018 8:59 amI'm afraid it's too complicated for me. I’m not a coder – just a storyteller and a bit artist. Tried to apply new script component to a text panel, but failed. Guess, I have to find another way to display variables. Like separate conversation or something.
If you use that script, it doesn't require any coding. Save the script as "CodedText.cs". Then add it to a GameObject that has a Text component. If that doesn't work, please let me know how it's failing.
pavsikakyj wrote: Mon Jul 30, 2018 8:59 amVN framework manual says it’s possible to show “to do” list with quest element. How may I do this inside VN framework? And may be this feature will help me to show variables to the player?
Yes. Here is one way to set it up:

1. Inspect the Dialogue Manager GameObject, and remove the Instantiate Prefabs component.

2. Add the prefab "Basic Standard UI Quest Log Window" to the Visual Novel Menu Canvas. You can deactivate its Main Panel child GameObject so you can see your other menu panels:

Image

3. Add a "Quests" button. (You can label it whatever you want -- "Journal", "To Do List", etc.) Connects its OnClick() event to the Basic Standard UI Quest Log Window's Open() method:

Image

Image
pavsikakyj
Posts: 31
Joined: Fri Oct 06, 2017 11:34 am

Re: Some advises on start needed

Post by pavsikakyj »

I added sript, as you wrote. And now [var=varName] works! Thank you! Do I need to use sequence comand to refresh it, when the variable is changed?
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Some advises on start needed

Post by Tony Li »

Yes, use the sequencer command, or call the script's CodedText.UpdateText method some other way such as the OnClick() event of a UI button.
pavsikakyj
Posts: 31
Joined: Fri Oct 06, 2017 11:34 am

Re: Some advises on start needed

Post by pavsikakyj »

Hi. I've done as you described with Quest Window and now I get this message, when I push quest button:
NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.StandardUIQuestLogWindow.OnQuestListUpdated () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI Subsystem/Standard UI/Quest UI/StandardUIQuestLogWindow.cs:188)
PixelCrushers.DialogueSystem.QuestLogWindow.ShowQuests (QuestState questStateMask) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Quest Subsystem/QuestLogWindow.cs:301)
PixelCrushers.DialogueSystem.StandardUIQuestLogWindow.ShowQuests (QuestState questStateMask) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI Subsystem/Standard UI/Quest UI/StandardUIQuestLogWindow.cs:357)
PixelCrushers.DialogueSystem.QuestLogWindow.OnOpenedWindow () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Quest Subsystem/QuestLogWindow.cs:232)
PixelCrushers.DialogueSystem.StandardUIQuestLogWindow.OpenWindow (System.Action openedWindowHandler) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI Subsystem/Standard UI/Quest UI/StandardUIQuestLogWindow.cs:118)
PixelCrushers.DialogueSystem.QuestLogWindow.Open () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Quest Subsystem/QuestLogWindow.cs:226)
UnityEngine.Events.InvokableCall.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:166)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:58)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:36)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:45)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update()
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Some advises on start needed

Post by Tony Li »

Hi,

This means you're probably calling the quest log window's Open method while the quest log window GameObject is inactive. You can leave this GameObject active. It will automatically hide its Main Panel at runtime, or you can set the Main Panel inactive at design time.

In version 2.0.3, this condition will no longer log an error, but it also won't show the quest log window if the GameObject is inactive.
pavsikakyj
Posts: 31
Joined: Fri Oct 06, 2017 11:34 am

Re: Some advises on start needed

Post by pavsikakyj »

Hi. Even if I make Quest Window visible, the error keeps appearing. When I press Quest Window button in the game, it actually freezes. Even main subtitle text stops. Nothing works.

I configured the buttonas you described.

After that I updated to 2.0.3. And now I can't change backgrounds for different conversation nodes ))). There is just blank screen and subtitles. Quest panel still doesn't work, but it doesn't freeze the game at least.

UPD. Also Continue button isn't shown in subtitle panel after update, even if it is visible.
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Some advises on start needed

Post by Tony Li »

Hi,
pavsikakyj wrote: Sun Aug 05, 2018 2:54 pmAfter that I updated to 2.0.3. And now I can't change backgrounds for different conversation nodes ))). There is just blank screen and subtitles. Quest panel still doesn't work, but it doesn't freeze the game at least.

UPD. Also Continue button isn't shown in subtitle panel after update, even if it is visible.
Does the VN Framework's "Example Start" game play correctly?

If you're on a lower version, you may want to import VisualNovelFramework_2_0_1.unitypackage. (Back up your project first.)
pavsikakyj wrote: Sun Aug 05, 2018 2:54 pmAnd now I can't change backgrounds for different conversation nodes
Does your Dialogue Manager (in your start scene) have a Handle Background Fields component? Maybe this component got removed.
pavsikakyj wrote: Sun Aug 05, 2018 2:54 pmWhen I press Quest Window button in the game, it actually freezes.
Untick the quest log window's Pause When Open checkbox. By default, the quest log window pauses the game when it's open.

It sounds like there are a few small configuration issues that are causing the problems. If you'd like to send your project to tony (at) pixelcrushers.com, I can take a look.
pavsikakyj
Posts: 31
Joined: Fri Oct 06, 2017 11:34 am

Re: Some advises on start needed

Post by pavsikakyj »

Hi.

I updated VN Framework, added Handle Background Fields component to DM, and everything got back to normal state, except Quest Window )). How should I send a project? Save it as scene? Or copy windows folder and put it to archive?
Post Reply