Ink Integration: Knots
Re: Ink Integration: Knots
Great! Glad to help.
Re: Ink Integration: Knots
Oh, one more thing, Tony.
I put in the definition
EXTERNAL SetIntVariable(x,y)
in the story.ink to test out.
I then added a variable xyz in the variable of the dialogue data base and added the fallback function at the end of story.ink
== function SetIntVariable(x,y) ==
~ return 1
Next, I put in the ink file a definition for a variable (same as in the dialogue system database) and then a call to the SetIntVariable. Hoping that I would see the variable in the dialogue system change when the call was made in the ink file. However, I didn't see a change in the variable. I did look in the dialogue manager to see if there was something I had to check there but didn't see anything. Here is mod I had for the story.ink file (see below).
What should I try next?
Thanks,
JB
// This version of the Ink integration example scene has these changes:
// 1. External Dialogue System functions, with fallbacks defined at the end of this file.
// 2. Actor=PlayerSpeaker tags to indicate the speaker where it's otherwise ambiguous.
// 3. Defines a variable wagerAmount and sets it to 20000 during the story.
// You can set a watch in the Dialogue Editor to see it change.
EXTERNAL ShowAlert(x) // ShowAlert("message")
EXTERNAL CurrentQuestState(x) // CurrentQuestState("quest")
EXTERNAL CurrentQuestEntryState(x,y) // CurrentQuestEntryState("quest", entry#)
EXTERNAL SetQuestState(x,y) // SetQuestState("quest", "inactive|active|success|failure")
EXTERNAL SetQuestEntryState(x,y,z) // SetQuestEntryState("quest", entry#, "inactive|active|success|failure")
EXTERNAL SetIntVariable(x,y)
VAR wagerAmount = 0
VAR xyz = 1
- I looked at Monsieur Fogg # Actor=PlayerSpeaker
* ... and I could contain myself no longer.
'What is the purpose of our journey, Monsieur?' # Actor=PlayerSpeaker
'A wager,' he replied. { SetIntVariable (xyz, 2) }{ SetQuestState("The Wager", "active") } { ShowAlert("Quest: The Wager") }
* * 'A wager!'[] I returned.
He nodded. { ShowAlert ("this is an alert") }
* * * 'But surely that is foolishness!'
* * * 'A most serious matter then!'
- - - He nodded again.
* * * 'But can we win?'
'That is what we will endeavour to find out,' he answered.
* * * 'A modest wager, I trust?'
'Twenty thousand pounds,' he replied, quite flatly.
~ wagerAmount = 20000
* * * I asked nothing further of him then[.], and after a final, polite cough, he offered nothing more to me. <>
* * 'Ah[.'],' I replied, uncertain what I thought.
- - After that, <>
* ... but I said nothing[] and <>
- we passed the day in silence.
- -> END
// Fallback functions
== function ShowAlert(x) ==
~ return 1
== function CurrentQuestState(x) ==
~ return "inactive"
== function CurrentQuestEntryState(x,y) ==
~ return "inactive"
== function SetQuestState(x,y) ==
~ return 1
== function SetQuestEntryState(x,y,z) ==
~ return 1
== function SetIntVariable(x,y) ==
~ return 1
I put in the definition
EXTERNAL SetIntVariable(x,y)
in the story.ink to test out.
I then added a variable xyz in the variable of the dialogue data base and added the fallback function at the end of story.ink
== function SetIntVariable(x,y) ==
~ return 1
Next, I put in the ink file a definition for a variable (same as in the dialogue system database) and then a call to the SetIntVariable. Hoping that I would see the variable in the dialogue system change when the call was made in the ink file. However, I didn't see a change in the variable. I did look in the dialogue manager to see if there was something I had to check there but didn't see anything. Here is mod I had for the story.ink file (see below).
What should I try next?
Thanks,
JB
// This version of the Ink integration example scene has these changes:
// 1. External Dialogue System functions, with fallbacks defined at the end of this file.
// 2. Actor=PlayerSpeaker tags to indicate the speaker where it's otherwise ambiguous.
// 3. Defines a variable wagerAmount and sets it to 20000 during the story.
// You can set a watch in the Dialogue Editor to see it change.
EXTERNAL ShowAlert(x) // ShowAlert("message")
EXTERNAL CurrentQuestState(x) // CurrentQuestState("quest")
EXTERNAL CurrentQuestEntryState(x,y) // CurrentQuestEntryState("quest", entry#)
EXTERNAL SetQuestState(x,y) // SetQuestState("quest", "inactive|active|success|failure")
EXTERNAL SetQuestEntryState(x,y,z) // SetQuestEntryState("quest", entry#, "inactive|active|success|failure")
EXTERNAL SetIntVariable(x,y)
VAR wagerAmount = 0
VAR xyz = 1
- I looked at Monsieur Fogg # Actor=PlayerSpeaker
* ... and I could contain myself no longer.
'What is the purpose of our journey, Monsieur?' # Actor=PlayerSpeaker
'A wager,' he replied. { SetIntVariable (xyz, 2) }{ SetQuestState("The Wager", "active") } { ShowAlert("Quest: The Wager") }
* * 'A wager!'[] I returned.
He nodded. { ShowAlert ("this is an alert") }
* * * 'But surely that is foolishness!'
* * * 'A most serious matter then!'
- - - He nodded again.
* * * 'But can we win?'
'That is what we will endeavour to find out,' he answered.
* * * 'A modest wager, I trust?'
'Twenty thousand pounds,' he replied, quite flatly.
~ wagerAmount = 20000
* * * I asked nothing further of him then[.], and after a final, polite cough, he offered nothing more to me. <>
* * 'Ah[.'],' I replied, uncertain what I thought.
- - After that, <>
* ... but I said nothing[] and <>
- we passed the day in silence.
- -> END
// Fallback functions
== function ShowAlert(x) ==
~ return 1
== function CurrentQuestState(x) ==
~ return "inactive"
== function CurrentQuestEntryState(x,y) ==
~ return "inactive"
== function SetQuestState(x,y) ==
~ return 1
== function SetQuestEntryState(x,y,z) ==
~ return 1
== function SetIntVariable(x,y) ==
~ return 1
Re: Ink Integration: Knots
Hi,
I like to put a comment after the declaration to remind myself of the syntax:
In this case, the first parameter must be a string, so the line should start like this:
I like to put a comment after the declaration to remind myself of the syntax:
Code: Select all
EXTERNAL SetIntVariable(x,y) // SetIntVariable("variableName", #)
Code: Select all
'A wager,' he replied. { SetIntVariable ("xyz", 2) }
Re: Ink Integration: Knots
Hi Tony:
Thanks for your help with my not understanding aspects of INK integration. I understand from what you have said about defining EXTERNAL functions - they seem to work fine for Quest and Set Alert. While I can verify that I can add SetIntVariable (x, y) to my ink dialogue (e.g. { (SetIntVariable ("abc", 2) } ) and that the ink text runs fine without error, I cannot seem to understand where the value for the variable "abc" goes (is it s lua variable?) and how it can be accessed both in dialogue system and Behavior Designer. I initially thought the variable's value would be shown in the variable section of the database used - but that didn't seem to show anything after I defined abc in the example database. Ultimately I'd like to pass values in the INK story (number of accesses, etc.) to Behavior Designer where the values can influence the behavior of characters in a scene.
Thanks for your help - I think I'm slowly getting there with understanding. I hope my novice problems and your solutions will help bridge the understanding gap for all of us who are novices at this...
John
----- previous post below ---
Oh, one more thing, Tony.
I put in the definition
EXTERNAL SetIntVariable(x,y)
in the story.ink to test out.
I then added a variable xyz in the variable of the dialogue data base and added the fallback function at the end of story.ink
== function SetIntVariable(x,y) ==
~ return 1
Next, I put in the ink file a definition for a variable (same as in the dialogue system database) and then a call to the SetIntVariable. Hoping that I would see the variable in the dialogue system change when the call was made in the ink file. However, I didn't see a change in the variable. I did look in the dialogue manager to see if there was something I had to check there but didn't see anything. Here is mod I had for the story.ink file (see below).
What should I try next?
Thanks,
JB
// This version of the Ink integration example scene has these changes:
// 1. External Dialogue System functions, with fallbacks defined at the end of this file.
// 2. Actor=PlayerSpeaker tags to indicate the speaker where it's otherwise ambiguous.
// 3. Defines a variable wagerAmount and sets it to 20000 during the story.
// You can set a watch in the Dialogue Editor to see it change.
EXTERNAL ShowAlert(x) // ShowAlert("message")
EXTERNAL CurrentQuestState(x) // CurrentQuestState("quest")
EXTERNAL CurrentQuestEntryState(x,y) // CurrentQuestEntryState("quest", entry#)
EXTERNAL SetQuestState(x,y) // SetQuestState("quest", "inactive|active|success|failure")
EXTERNAL SetQuestEntryState(x,y,z) // SetQuestEntryState("quest", entry#, "inactive|active|success|failure")
EXTERNAL SetIntVariable(x,y)
VAR wagerAmount = 0
VAR xyz = 1
- I looked at Monsieur Fogg # Actor=PlayerSpeaker
* ... and I could contain myself no longer.
'What is the purpose of our journey, Monsieur?' # Actor=PlayerSpeaker
'A wager,' he replied. { SetIntVariable (xyz, 2) }{ SetQuestState("The Wager", "active") } { ShowAlert("Quest: The Wager") }
* * 'A wager!'[] I returned.
He nodded. { ShowAlert ("this is an alert") }
* * * 'But surely that is foolishness!'
* * * 'A most serious matter then!'
- - - He nodded again.
* * * 'But can we win?'
'That is what we will endeavour to find out,' he answered.
* * * 'A modest wager, I trust?'
'Twenty thousand pounds,' he replied, quite flatly.
~ wagerAmount = 20000
* * * I asked nothing further of him then[.], and after a final, polite cough, he offered nothing more to me. <>
* * 'Ah[.'],' I replied, uncertain what I thought.
- - After that, <>
* ... but I said nothing[] and <>
- we passed the day in silence.
- -> END
// Fallback functions
== function ShowAlert(x) ==
~ return 1
== function CurrentQuestState(x) ==
~ return "inactive"
== function CurrentQuestEntryState(x,y) ==
~ return "inactive"
== function SetQuestState(x,y) ==
~ return 1
== function SetQuestEntryState(x,y,z) ==
~ return 1
== function SetIntVariable(x,y) ==
~ return 1
Thanks for your help with my not understanding aspects of INK integration. I understand from what you have said about defining EXTERNAL functions - they seem to work fine for Quest and Set Alert. While I can verify that I can add SetIntVariable (x, y) to my ink dialogue (e.g. { (SetIntVariable ("abc", 2) } ) and that the ink text runs fine without error, I cannot seem to understand where the value for the variable "abc" goes (is it s lua variable?) and how it can be accessed both in dialogue system and Behavior Designer. I initially thought the variable's value would be shown in the variable section of the database used - but that didn't seem to show anything after I defined abc in the example database. Ultimately I'd like to pass values in the INK story (number of accesses, etc.) to Behavior Designer where the values can influence the behavior of characters in a scene.
Thanks for your help - I think I'm slowly getting there with understanding. I hope my novice problems and your solutions will help bridge the understanding gap for all of us who are novices at this...
John
----- previous post below ---
Oh, one more thing, Tony.
I put in the definition
EXTERNAL SetIntVariable(x,y)
in the story.ink to test out.
I then added a variable xyz in the variable of the dialogue data base and added the fallback function at the end of story.ink
== function SetIntVariable(x,y) ==
~ return 1
Next, I put in the ink file a definition for a variable (same as in the dialogue system database) and then a call to the SetIntVariable. Hoping that I would see the variable in the dialogue system change when the call was made in the ink file. However, I didn't see a change in the variable. I did look in the dialogue manager to see if there was something I had to check there but didn't see anything. Here is mod I had for the story.ink file (see below).
What should I try next?
Thanks,
JB
// This version of the Ink integration example scene has these changes:
// 1. External Dialogue System functions, with fallbacks defined at the end of this file.
// 2. Actor=PlayerSpeaker tags to indicate the speaker where it's otherwise ambiguous.
// 3. Defines a variable wagerAmount and sets it to 20000 during the story.
// You can set a watch in the Dialogue Editor to see it change.
EXTERNAL ShowAlert(x) // ShowAlert("message")
EXTERNAL CurrentQuestState(x) // CurrentQuestState("quest")
EXTERNAL CurrentQuestEntryState(x,y) // CurrentQuestEntryState("quest", entry#)
EXTERNAL SetQuestState(x,y) // SetQuestState("quest", "inactive|active|success|failure")
EXTERNAL SetQuestEntryState(x,y,z) // SetQuestEntryState("quest", entry#, "inactive|active|success|failure")
EXTERNAL SetIntVariable(x,y)
VAR wagerAmount = 0
VAR xyz = 1
- I looked at Monsieur Fogg # Actor=PlayerSpeaker
* ... and I could contain myself no longer.
'What is the purpose of our journey, Monsieur?' # Actor=PlayerSpeaker
'A wager,' he replied. { SetIntVariable (xyz, 2) }{ SetQuestState("The Wager", "active") } { ShowAlert("Quest: The Wager") }
* * 'A wager!'[] I returned.
He nodded. { ShowAlert ("this is an alert") }
* * * 'But surely that is foolishness!'
* * * 'A most serious matter then!'
- - - He nodded again.
* * * 'But can we win?'
'That is what we will endeavour to find out,' he answered.
* * * 'A modest wager, I trust?'
'Twenty thousand pounds,' he replied, quite flatly.
~ wagerAmount = 20000
* * * I asked nothing further of him then[.], and after a final, polite cough, he offered nothing more to me. <>
* * 'Ah[.'],' I replied, uncertain what I thought.
- - After that, <>
* ... but I said nothing[] and <>
- we passed the day in silence.
- -> END
// Fallback functions
== function ShowAlert(x) ==
~ return 1
== function CurrentQuestState(x) ==
~ return "inactive"
== function CurrentQuestEntryState(x,y) ==
~ return "inactive"
== function SetQuestState(x,y) ==
~ return 1
== function SetQuestEntryState(x,y,z) ==
~ return 1
== function SetIntVariable(x,y) ==
~ return 1
Re: Ink Integration: Knots
Hi,
In { SetIntVariable ("abc", 2) }, abc is the name of a Dialogue System variable. You can define it ahead of time in your dialogue database using the Dialogue Editor's Variables section. If you don't define it ahead of time, the Ink integration will automatically add it at runtime. In this case, it won't appear in the Dialogue Editor's Variables section, but you can see it in the Watches section if you select Menu > Add Runtime Variable.
To check Dialogue System variable values in Behavior Designer, use an "Is Lua True" conditional node. (See the Behavior Designer integration's example scene. It checks if the player wants to shoot the alien.)
In { SetIntVariable ("abc", 2) }, abc is the name of a Dialogue System variable. You can define it ahead of time in your dialogue database using the Dialogue Editor's Variables section. If you don't define it ahead of time, the Ink integration will automatically add it at runtime. In this case, it won't appear in the Dialogue Editor's Variables section, but you can see it in the Watches section if you select Menu > Add Runtime Variable.
To check Dialogue System variable values in Behavior Designer, use an "Is Lua True" conditional node. (See the Behavior Designer integration's example scene. It checks if the player wants to shoot the alien.)
Re: Ink Integration: Knots
Hello Tony:
I continue to have difficulties with tie-ing the variables together between dialogue system and behavior designer. I am working with the simple ink example given "around the world story" that is the example. In the working example, the variable wagerAmount is set to 20000. I set a wagerAmount to 0 as an int variable in dialogue system variables panel. When I run the ink story script as in the example, 20000 appears in the variable watch list. That was very encouraging! But, I wanted to be able to use the 20000 in a behavior designer tree, so I thought that I could set “wagerAmount” to be a global int in behavior designer with the Behavior Tree Lua Bridge as a component in the behavior tree. I set the behavior tree attached to the player with an is Lua True with “wagerAmount" == True . I hoped that the isLuaTrue would return true…. but it doesn’t seem to. Is there another way? I found one item that said I had to register the function call, but I didn’t understand that. So, this simple example nothing more than try to extend your example to use wagerAmount in the story. Why I can't make the connection has not yet been understood by me. Can you possibly help me figure this out?
Thanks!
I continue to have difficulties with tie-ing the variables together between dialogue system and behavior designer. I am working with the simple ink example given "around the world story" that is the example. In the working example, the variable wagerAmount is set to 20000. I set a wagerAmount to 0 as an int variable in dialogue system variables panel. When I run the ink story script as in the example, 20000 appears in the variable watch list. That was very encouraging! But, I wanted to be able to use the 20000 in a behavior designer tree, so I thought that I could set “wagerAmount” to be a global int in behavior designer with the Behavior Tree Lua Bridge as a component in the behavior tree. I set the behavior tree attached to the player with an is Lua True with “wagerAmount" == True . I hoped that the isLuaTrue would return true…. but it doesn’t seem to. Is there another way? I found one item that said I had to register the function call, but I didn’t understand that. So, this simple example nothing more than try to extend your example to use wagerAmount in the story. Why I can't make the connection has not yet been understood by me. Can you possibly help me figure this out?
Thanks!
Re: Ink Integration: Knots
Hi,
If you were to use Behavior Designer's "Is Lua True" task, you need to check that "wagerAmount == 20000". Wager amount is a number, so you need to compare it with a number.
However, you may prefer to use these new tasks:
DS_BehaviorDesignerPatch_2019-12-03.unitypackage
This package adds Behavior Designer tasks that let you get and set Dialogue System variable values. I've also sent the package to Opsive so they can include it in their official Dialogue System integration package.
If you were to use Behavior Designer's "Is Lua True" task, you need to check that "wagerAmount == 20000". Wager amount is a number, so you need to compare it with a number.
However, you may prefer to use these new tasks:
DS_BehaviorDesignerPatch_2019-12-03.unitypackage
This package adds Behavior Designer tasks that let you get and set Dialogue System variable values. I've also sent the package to Opsive so they can include it in their official Dialogue System integration package.
Re: Ink Integration: Knots
Hi Tony:
Thanks for all your help. I'm hoping to get the variable transfer better DS and BD working at some point.
1. I did try the "is Lua True" task with the "wagerAmount == 20000" as the value to check in the "is Lua True" task. The Behavior tree I sued simply was a repeater of the sequence "is Lua True" and a wait task (to demonstrate when the wagerAmount is true as the INK script is played). In my example, that does work as I play the Ink script - when the wagerAmount is set to 20000 (that shows up to the variables tracked in real time fine). However, I don't find that I can get "is Lua True" to ever return true. .... but on to the new Tasks you sent!
2. I am intrigued by the added tasks that you sent. I added the package and I'm thinking the the variables are accessed by Get Property Value and Set Property Value? I tried that and used the Target Game Object as the Dialogue Manager and the Component as Dialogue System Ink Integration (assuming that the variables from INK set in DS are where we get the values for wagerAmount). But then for property value I had trouble figuring out where the variable is kept. I tried the various property values access that could be selected but did not find the variable selection item.... Well, then I figured that the variables might be accessed via the get/set field values. But, I didn't find the variable (wagerAmount) there either. Or perhaps there is another Task somewhere I missed??
Sorry to be so confused. I'm hoping you can point me to the proper use of the new package you sent. The idea seems ideal for what I need. I just need to figure out how to use these task (I'm hoping I used the correct tasks, and the correct access points for the ink supplied variable values). I'll get this figured out with you help eventually.
Thanks much -- and I'm looking forward to understanding how this DS/BD patch works.....
John
Thanks for all your help. I'm hoping to get the variable transfer better DS and BD working at some point.
1. I did try the "is Lua True" task with the "wagerAmount == 20000" as the value to check in the "is Lua True" task. The Behavior tree I sued simply was a repeater of the sequence "is Lua True" and a wait task (to demonstrate when the wagerAmount is true as the INK script is played). In my example, that does work as I play the Ink script - when the wagerAmount is set to 20000 (that shows up to the variables tracked in real time fine). However, I don't find that I can get "is Lua True" to ever return true. .... but on to the new Tasks you sent!
2. I am intrigued by the added tasks that you sent. I added the package and I'm thinking the the variables are accessed by Get Property Value and Set Property Value? I tried that and used the Target Game Object as the Dialogue Manager and the Component as Dialogue System Ink Integration (assuming that the variables from INK set in DS are where we get the values for wagerAmount). But then for property value I had trouble figuring out where the variable is kept. I tried the various property values access that could be selected but did not find the variable selection item.... Well, then I figured that the variables might be accessed via the get/set field values. But, I didn't find the variable (wagerAmount) there either. Or perhaps there is another Task somewhere I missed??
Sorry to be so confused. I'm hoping you can point me to the proper use of the new package you sent. The idea seems ideal for what I need. I just need to figure out how to use these task (I'm hoping I used the correct tasks, and the correct access points for the ink supplied variable values). I'll get this figured out with you help eventually.
Thanks much -- and I'm looking forward to understanding how this DS/BD patch works.....
John
Re: Ink Integration: Knots
1. The Lua Code would need to be: Variable["wagerAmount"] == 20000
However, forget about that. I think you'll find the new tasks to be much nicer to use.
2. In your behavior tree, define an integer variable. Then use the "Get Dialogue Int Variable" task to store the current value of the Dialogue System variable 'wagerAmount' into that behavior tree variable:
Then you can compare it like this:
However, forget about that. I think you'll find the new tasks to be much nicer to use.
2. In your behavior tree, define an integer variable. Then use the "Get Dialogue Int Variable" task to store the current value of the Dialogue System variable 'wagerAmount' into that behavior tree variable:
Then you can compare it like this:
Re: Ink Integration: Knots
Thanks Tony:
The patch works just great here. I tried what you said to do with the new get and set variables tasks for Behavior Designer. So far, all working perfectly. Thanks much for creating these tasks. I hope many other folks will realize the power of this INK integration!!
John
The patch works just great here. I tried what you said to do with the new get and set variables tasks for Behavior Designer. So far, all working perfectly. Thanks much for creating these tasks. I hope many other folks will realize the power of this INK integration!!
John