Page 4 of 5
Re: start a simaltaneous conversation in an entry
Posted: Sun Feb 28, 2021 8:40 am
by CHOPJZL
That's indeed a little different. What I want is change a different custom panel at the beginning of dialogue entry. Like [panel=#]
For now I have set the customSubtitlePanel and SubtitlePanelNumber.Custom in OnConversationLine(), I think what lacks is a step to override the new customSubtitlePanel to the old one.
Re: start a simaltaneous conversation in an entry
Posted: Sun Feb 28, 2021 9:00 am
by Tony Li
Hi,
Thanks for the info. It sounds like this patch may help:
DS_SubtitlePanelPatch_2021-02-28.unitypackage
To switch to a different custom panel during a conversation, you can call:
StandardDialogueUI.conversationUIElements.standardSubtitleControls.OverrideActorPanel(dialogueActor, SubtitlePanelNumber.Custom, customPanel);
(These changes were already committed to the repository for version 2.2.16.)
Just to be safe, back up your project before importing.
Re: start a simaltaneous conversation in an entry
Posted: Sun Feb 28, 2021 9:22 am
by CHOPJZL
Now it works properly:)
About the Variable and Lua
There is only a Number type in Lua, Is there any risk that a variable I want to keep it int become float in some operations?
For [var=variable] Tag in text, if the variable is a float for example 3.1415..., can I control the text to be 3.141 or 3.1?
When will the Script of entry run? It's at the end of the entry, or beginning?
Can we modify set Variable in [lua(code)] of Text and Sequencer?
The Lua Console's key seems not working, I can use the console if I enable Visible, but I can't turn it out by the keys.
After I tried in Lua Console, although "X and not Y" is not working, "X and (not Y)" seems work properly
Re: start a simaltaneous conversation in an entry
Posted: Sun Feb 28, 2021 10:47 am
by Tony Li
Hi,
> There is only a Number type in Lua, Is there any risk that a variable I want to keep it int become float in some operations?
Internally, it's stored as a double. If you set it to an int value, it will not have any decimal part. But if you do decimal math on it, it's possible that it will no longer be an int.
> For [var=variable] Tag in text, if the variable is a float for example 3.1415..., can I control the text to be 3.141 or 3.1?
You can use math.floor() to get the int part.
> When will the Script of entry run? It's at the end of the entry, or beginning?
Beginning.
> Can we modify set Variable in [lua(code)] of Text and Sequencer?
Technically, yes. But it would be better to use the Script for that. If code doesn't start with "return", the Dialogue System will put "return" in front. So make sure to form your expression so it will work with "return" in front.
> The Lua Console's key seems not working, I can use the console if I enable Visible, but I can't turn it out by the keys.
Maybe something else is intercepting the key. Also, it uses Unity's built-in input system, not the new Input System.
> After I tried in Lua Console, although "X and not Y" is not working, "X and (not Y)" seems work properly
This may be a quirk of my Lua parser.
Re: start a simaltaneous conversation in an entry
Posted: Sun Feb 28, 2021 11:04 am
by CHOPJZL
Tony Li wrote: ↑Sun Feb 28, 2021 10:47 am
You can use math.floor() to get the int part.
This is a little different from what I means. I mean for a variable PPP that is 3.1415926, how to show "3.14" in the Text?
math.floor(100*PPP)/100 seems working, is there a more proper way?
Re: start a simaltaneous conversation in an entry
Posted: Sun Feb 28, 2021 11:46 am
by Tony Li
Hi,
That's what I was thinking. If you don't want to do that, there's a string format function. I'm away from the office right now so I can't look up the details. The string format is the same as C#'s String.Format().
Re: start a simaltaneous conversation in an entry
Posted: Sun Feb 28, 2021 8:03 pm
by CHOPJZL
I tried the format function but failed. In the console, string.format("%.2f",Variable["testv"]) returns "%.2f"
Re: start a simaltaneous conversation in an entry
Posted: Sun Feb 28, 2021 8:30 pm
by Tony Li
Hi,
It uses the same formatting codes as C#/.NET's
String.Format().
If Variable["testv"] = 3.14159, then string.format("{0:N2}", Variable["testv"]) will return 3.14.
Re: start a simaltaneous conversation in an entry
Posted: Sun Feb 28, 2021 8:55 pm
by CHOPJZL
It works now. I shouldn's use lua's format function.
About StartConversation() with a specified entry. Will it start in a brand new state, or inherit the operation of entries before it? Like scripts and animator sequence
Re: start a simaltaneous conversation in an entry
Posted: Sun Feb 28, 2021 9:03 pm
by Tony Li
Hi,
It will bypass previous entries and jump straight to the entry you specify.