Yarn 1.2.7

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

Re: Yarn 1.2.7

Post by Tony Li »

This patch will fix the issue where the <<command>> is in the wrong place (linked to both options instead of just the correct option):

<Edit: See updated patch below.>

I'm still looking into the issue with arguments.
User avatar
Tony Li
Posts: 21055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Yarn 1.2.7

Post by Tony Li »

This patch also fixes the my_command issue:

DS_YarnPatch_2022-09-26.unitypackage

The importer was setting up the Yarn commands so they'd try to pass all arguments as strings. Now it passes the correct type.
gblekkenhorst
Posts: 78
Joined: Wed Jun 24, 2020 5:06 pm

Re: Yarn 1.2.7

Post by gblekkenhorst »

I think something broke -

The command works if the string is only one word long, but if it's longer, it tries to send each word through as a different argument - it becomes this: _G['alert']('"with', 'my', 'man"')

Run Node also seems to be broken? now when the conversation hits a run node, it doesn't run the node, the conversation stops, but the controls don't unlock as though the conversation is over. I can fix this manually by changing the Links To: Node from <START> to the node after it, but that's not the way it's importing.
User avatar
Tony Li
Posts: 21055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Yarn 1.2.7

Post by Tony Li »

Hmm, I'll need to take a look at that case for the Run Node. I'll let you know what I find.

What is the command that results in: _G['alert']('"with', 'my', 'man"')
gblekkenhorst
Posts: 78
Joined: Wed Jun 24, 2020 5:06 pm

Re: Yarn 1.2.7

Post by gblekkenhorst »

Thanks!

It's <<alarm "with my man">>

<<alarm "with">> works fine, no errors.

The <<wait 1>> command has also gone weird. It's writing Delay(1) in the Sequence, but it just hangs up there - actually this has nothing to do with the new programming, it's because I changed the Continue button from "never" to "always"
User avatar
Tony Li
Posts: 21055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Yarn 1.2.7

Post by Tony Li »

gblekkenhorst wrote: Fri Sep 30, 2022 10:35 pmThe <<wait 1>> command has also gone weird. It's writing Delay(1) in the Sequence, but it just hangs up there - actually this has nothing to do with the new programming, it's because I changed the Continue button from "never" to "always"
How would you propose handling this. The corresponding dialogue entry node will delay for 1 second, but then the node will also wait for the player to click the continue button.
gblekkenhorst
Posts: 78
Joined: Wed Jun 24, 2020 5:06 pm

Re: Yarn 1.2.7

Post by gblekkenhorst »

I got it working like this:

Code: Select all

    public void Pause()
    {
        int time = 1;
        StartCoroutine(StartWait(time));
    }

    public IEnumerator StartWait(inttime)
    {
        DialogueManager.instance.gameObject.GetComponentInChildren<Canvas>().enabled = false;
        yield return new WaitForSeconds(time);
        DialogueManager.instance.gameObject.GetComponentInChildren<Canvas>().enabled = true;
    }
For now I'm just hard coding the time to wait into the function, because if I try to pass it as an argument I am still getting this error:

Code: Select all

ArgumentException: Object of type 'System.String' cannot be converted to type 'System.Int32'.
(Int not float works, when I tried float the pause stopped working.)

I'm trying to print a variable in the dialogue, Variable["carFundTotal"] throws the error 'expecting FORMAT_FUNCTION_ID' and $carFundTotal just prints $carFundTotal.
Last edited by gblekkenhorst on Thu Oct 06, 2022 7:50 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 21055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Yarn 1.2.7

Post by Tony Li »

Hi,

Sorry for the delay getting a final answer on that other issue. I'll update you on it when I have an answer.
gblekkenhorst wrote: Thu Oct 06, 2022 7:30 pmFor now I'm just hard coding the time to wait into the function, because if I try to pass it as an argument I am still getting this error:

Code: Select all

ArgumentException: Object of type 'System.String' cannot be converted to type 'System.Single'.
What is the command with the argument? Can you paste it here so I can test something similar? The patch should have fixed that.

Would you also please click on that ArgumentException line in the Console, press Ctrl+C to copy its details to the clipboard, then paste them here?

gblekkenhorst wrote: Thu Oct 06, 2022 7:30 pmI'm trying to print a variable in the dialogue, Variable["carFundTotal"] throws the error 'expecting FORMAT_FUNCTION_ID' and $carFundTotal just prints $carFundTotal.
Have you tried putting the variable in curly braces? Example:

The card fund total is {$carFundTotal} dollars.
gblekkenhorst
Posts: 78
Joined: Wed Jun 24, 2020 5:06 pm

Re: Yarn 1.2.7

Post by gblekkenhorst »

I switched this back to int because float wasn't working:

Command with the argument:

using <<pause 1>>

Code: Select all

    public void Pause(int time)
    {
      //  int time = 10;
        StartCoroutine(StartWait(time));
    }

    public IEnumerator StartWait(int time)
    {
        DialogueManager.instance.gameObject.GetComponentInChildren<Canvas>().enabled = false;
        yield return new WaitForSeconds(time);
        DialogueManager.instance.gameObject.GetComponentInChildren<Canvas>().enabled = true;
    }
Here are the errors:

Code: Select all

ArgumentException: Object of type 'System.Single' cannot be converted to type 'System.Int32'.
System.RuntimeType.CheckValue (System.Object value, System.Reflection.Binder binder, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Reflection.MonoMethod.ConvertValues (System.Reflection.Binder binder, System.Object[] args, System.Reflection.ParameterInfo[] pinfo, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
Language.Lua.LuaMethodFunction.InvokeMethod (Language.Lua.LuaValue[] args) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/LuaValue/LuaMethodFunction.cs:35)
UnityEngine.Debug:LogException(Exception)
Language.Lua.LuaMethodFunction:InvokeMethod(LuaValue[]) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/LuaValue/LuaMethodFunction.cs:40)
Language.Lua.FunctionCall:Evaluate(LuaValue, LuaTable) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/Expr/FunctionCall.cs:41)
Language.Lua.PrimaryExpr:Evaluate(LuaTable) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/Expr/PrimaryExpr.cs:15)
Language.Lua.ExprStmt:Execute(LuaTable, Boolean&) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/Chunk/ExprStmt.cs:11)
Language.Lua.Chunk:Execute(Boolean&) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/Chunk/Chunk.cs:42)
Language.Lua.Chunk:Execute() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/Chunk/Chunk.cs:15)
Language.Lua.LuaInterpreter:Interpreter(String, LuaTable) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Interpreter/LuaInterpreter.cs:38)
PixelCrushers.DialogueSystem.Lua:RunRaw(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:223)
PixelCrushers.DialogueSystem.Lua:Run(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:129)
PixelCrushers.DialogueSystem.ConversationModel:GetState(DialogueEntry, Boolean, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/Model/ConversationModel.cs:234)
PixelCrushers.DialogueSystem.ConversationModel:GetState(DialogueEntry) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/Model/ConversationModel.cs:304)
PixelCrushers.DialogueSystem.ConversationController:OnFinishedSubtitle(Object, EventArgs) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:270)
PixelCrushers.DialogueSystem.ConversationView:FinishSubtitle() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:428)
PixelCrushers.DialogueSystem.ConversationView:HandleContinueButtonClick() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:400)
PixelCrushers.DialogueSystem.ConversationView:OnConversationContinue(IDialogueUI) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:383)
UnityEngine.Component:SendMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnContinueConversation() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Abstract/Dialogue/AbstractDialogueUI.cs:366)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnContinue() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Abstract/Dialogue/AbstractDialogueUI.cs:356)
PixelCrushers.DialogueSystem.StandardUIContinueButtonFastForward:OnFastForward() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Effects/StandardUIContinueButtonFastForward.cs:75)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/UnityEditors/2020.2.6f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:385)

Code: Select all

Dialogue System: Lua code '_G['pause'](1)
' threw exception 'Object of type 'System.Single' cannot be converted to type 'System.Int32'.'
UnityEngine.Debug:LogError (object)
PixelCrushers.DialogueSystem.Lua:RunRaw (string,bool,bool) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:228)
PixelCrushers.DialogueSystem.Lua:Run (string,bool,bool) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:129)
PixelCrushers.DialogueSystem.ConversationModel:GetState (PixelCrushers.DialogueSystem.DialogueEntry,bool,bool,bool) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/Model/ConversationModel.cs:234)
PixelCrushers.DialogueSystem.ConversationModel:GetState (PixelCrushers.DialogueSystem.DialogueEntry) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/Model/ConversationModel.cs:304)
PixelCrushers.DialogueSystem.ConversationController:OnFinishedSubtitle (object,System.EventArgs) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:270)
PixelCrushers.DialogueSystem.ConversationView:FinishSubtitle () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:428)
PixelCrushers.DialogueSystem.ConversationView:HandleContinueButtonClick () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:400)
PixelCrushers.DialogueSystem.ConversationView:OnConversationContinue (PixelCrushers.DialogueSystem.IDialogueUI) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:383)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnContinueConversation () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Abstract/Dialogue/AbstractDialogueUI.cs:366)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnContinue () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Abstract/Dialogue/AbstractDialogueUI.cs:356)
PixelCrushers.DialogueSystem.StandardUIContinueButtonFastForward:OnFastForward () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Effects/StandardUIContinueButtonFastForward.cs:75)
UnityEngine.EventSystems.EventSystem:Update () (at C:/Program Files/UnityEditors/2020.2.6f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:385)
Curly brackets around the variables worked, thanks!
User avatar
Tony Li
Posts: 21055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Yarn 1.2.7

Post by Tony Li »

Hi,

Try changing this:

Code: Select all

public void Pause(int time)
to this:

Code: Select all

public void Pause(double time)
Then I think you should be able to use <<pause 1>>
Post Reply