Retrieve Variable & Adding Checkbox and Radio Buttons to A Panel
Retrieve Variable & Adding Checkbox and Radio Buttons to A Panel
Hey Tony!
In my game, I have set a variable for the game score. And now, I want the score and some dialogue texts of the NPCs to be displayed on a panel at the end of the game.
How can I do this? What's in my mind is to create a new script and retrieve the variable (But how?), so that it can display on the panel.
Also I will add some checkbox and radio buttons on the same panel. Those correctly ticked buttons will be given score and the score will be displaying again in the conversation of the quest giver. (score will be displayed twice) How can I retrieve the variables from my new script to Dialogue System and from Dialogue System to that script?
[Should I use the GetVariable()? But how to use it?]
I'm sorry, I'm still new to the scripting.
In my game, I have set a variable for the game score. And now, I want the score and some dialogue texts of the NPCs to be displayed on a panel at the end of the game.
How can I do this? What's in my mind is to create a new script and retrieve the variable (But how?), so that it can display on the panel.
Also I will add some checkbox and radio buttons on the same panel. Those correctly ticked buttons will be given score and the score will be displaying again in the conversation of the quest giver. (score will be displayed twice) How can I retrieve the variables from my new script to Dialogue System and from Dialogue System to that script?
[Should I use the GetVariable()? But how to use it?]
I'm sorry, I'm still new to the scripting.
Re: Retrieve Variable & Adding Checkbox and Radio Buttons to A Panel
Hi,
At the top of your script, include this line:
When you want to get the value of a Dialogue System variable, use DialogueLua.GetVariable(). You will also need to specify the type of value you want to get from the variable. For example:
At the top of your script, include this line:
Code: Select all
using PixelCrushers.DialogueSystem;
Code: Select all
int score = DialogueLua.GetVariable("Score").asInt;
Re: Retrieve Variable & Adding Checkbox and Radio Buttons to A Panel
Oh, I have missed out some information. The variable that I want to display on the panel is the variable I set at the Quest Node State/Active/Journal Text using Dialogue System Text Quest Content. And the variable will be displayed only when that particular node is Active.
Re: Retrieve Variable & Adding Checkbox and Radio Buttons to A Panel
Let's say that variable is named "Score" in the Dialogue Editor.
Set the Dialogue System Text Quest Content to something like:
The tag [var=Score] will be replaced by the value of the Score variable.
Set the Dialogue System Text Quest Content to something like:
Code: Select all
Points: [var=Score]
Re: Retrieve Variable & Adding Checkbox and Radio Buttons to A Panel
Can I write the same syntax in my script as well?
Re: Retrieve Variable & Adding Checkbox and Radio Buttons to A Panel
Yes, if you run it through FormattedText.ParseCode:
Code: Select all
string s = FormattedText.ParseCode("Points: [var=Score]");
Re: Retrieve Variable & Adding Checkbox and Radio Buttons to A Panel
I'm not sure whether I'm doing it right or not.
My game scenario: the player will choose the NPCs to talk to. I have set one Quest Node per conversation where the player will be given marks through the conversations set in Dialogue System. The Journal has also recorded the NPCs' characteristics that the player chooses to talk to.
And now, I will be doing my own script where the panel will display the characteristics of chosen NPCs (Recorded in the Journal). But the chosen NPCs' characteristics will only be displayed once that particular Quest Node is active. So what should I do? Or is there any way to ease the procedures?
Really appreciate your help!
My game scenario: the player will choose the NPCs to talk to. I have set one Quest Node per conversation where the player will be given marks through the conversations set in Dialogue System. The Journal has also recorded the NPCs' characteristics that the player chooses to talk to.
And now, I will be doing my own script where the panel will display the characteristics of chosen NPCs (Recorded in the Journal). But the chosen NPCs' characteristics will only be displayed once that particular Quest Node is active. So what should I do? Or is there any way to ease the procedures?
Really appreciate your help!
Re: Retrieve Variable & Adding Checkbox and Radio Buttons to A Panel
Hi,
Sorry, I don't understand. Can you please provide some mock-up screenshots or drawings to help clarify? (What is a mark? What is a characteristic?)
I think you should be able to do this without any scripting, but I can't give a definitive answer until I have a better understanding of your requirements.
Sorry, I don't understand. Can you please provide some mock-up screenshots or drawings to help clarify? (What is a mark? What is a characteristic?)
I think you should be able to do this without any scripting, but I can't give a definitive answer until I have a better understanding of your requirements.
Re: Retrieve Variable & Adding Checkbox and Radio Buttons to A Panel
Mark refers to the score.
And the characteristics is the physical appearance of the NPCs (For example, hairstyle) in the game. My game is to talk to the NPCs to collect the characteristics of each NPC. So yea.
And the characteristics is the physical appearance of the NPCs (For example, hairstyle) in the game. My game is to talk to the NPCs to collect the characteristics of each NPC. So yea.
Re: Retrieve Variable & Adding Checkbox and Radio Buttons to A Panel
There are too many nodes I have created and the screenshot below is just part of them.
I made each characteristic in one node and have set the score for every node, as shown in the screenshot below.
I made each characteristic in one node and have set the score for every node, as shown in the screenshot below.