Not showing current tags/current choices or calling binded function(INK)
Posted: Thu Apr 27, 2023 6:42 am
Hi all. I am using Ink in combination with the Unity Dialogue System, and I cannot seem to get any info on what is happening when the story is playing. I got the story playing correctly, but when I try to find out what the current tags and choices are, it's always 0, leaving me pretty stranded on expanding my project. This is my code:
I know it's pretty simple. My dialogue does play out correctly when I enter the Box Collider, but I cannot get any info on what is happening inside the ink file. Using _story.currentChoices.Count doesn't work either...
It also doesn't call the bound function SetTypeWriterSpeed, does anyone know how this is happening? I feel like everything should work as there are no errors nor does my ink file go to the internal function SetIntVariable
Ink file:
Code: Select all
public class ChangeTextSpeed : MonoBehaviour
{
[SerializeField] private TextAsset _inkJSON;
public UnityUITypewriterEffect _typeWriterEffect;
public DialogueSystemInkIntegration DSII;
Story _story;
public void Start()
{
_story = DSII.GetStory(_inkJSON.name);
DSII.GetStory(_inkJSON.name).BindExternalFunction("SetIntVariable", (int value, int value1) =>
{
SetTypewriterSpeed(value);
}
);
}
public void Update()
{
// Debug.Log(DSII.GetStory(_inkJSON.name).currentChoices.Count);
}
public void SetTypewriterSpeed(float value)
{
_typeWriterEffect.charactersPerSecond = value;
}
}
It also doesn't call the bound function SetTypeWriterSpeed, does anyone know how this is happening? I feel like everything should work as there are no errors nor does my ink file go to the internal function SetIntVariable
Ink file:
Code: Select all
VAR SomeText = ""
EXTERNAL SetIntVariable(x,y)
->main
=== main ===
Do this test work? #speaker:luka
* Yes#speaker:luka
Yes it does!#speaker:Not luka so much
~ SomeText = "You chose yes"
->main
*[No]#speaker:luka
~SetIntVariable(1, 0)
Well you say no, but actually yes, also the plus means that this option always stays present, removing the "+" and changing it to a "*" will make it continue to last option, also this text takes longer to scrool, click yes will make it go faster
~ SomeText = "You chose no"
->main
*Done
When you choose this option you're just done!! But first theres a choice WITHIN a choice!
**Ok I dont care
**CHOICECEPTION
-Now yer done
// ->DONE
*->
Either way your choices don't matter, it does work. I'm calling a function now that prints out the option you chose.
->chosen
=== chosen ===
{SomeText}
Now I will call a function that passes what you chose to the function
->chosenparam(SomeText)
===chosenparam(sometext)===
{sometext} + 1
->DONE
-> END
==function SetIntVariable(x,y)==
stom programma
~return 1