Getting current tags in external function call (ink integration)

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nehvaleem
Posts: 96
Joined: Tue Sep 10, 2019 4:52 am

Getting current tags in external function call (ink integration)

Post by nehvaleem »

I am wondering is it possible to get the current tags of a line that has attached external function call using ink integration?

Code: Select all

* [Sentry: We might be ronin, but we still walk the path of honor.] {SetCharacterAttribute("sentry","ronin",1, true)} # LineTag_002_0201_6B477ABA_Sentry
I don't want to alter my SetCharacterAttribute calls, but instead in the SetCharacterAttribute call I would love to get current text and tags.

But when I do it the direct way I am getting empty strings only.

Code: Select all

Debug.Log($"Curernt tags: {string.Join(",", activeStory.currentTags)}");
this gives me empty results, despite the activeStory being ok. Am I missing something?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Getting current tags in external function call (ink integration)

Post by Tony Li »

Hi,

Is activeStory the one in DialogueSystemInkIntegration? If so, then as you said it should be valid, and the tags should be correct. Are the tags perhaps being applied to the line before or after that one?
nehvaleem
Posts: 96
Joined: Tue Sep 10, 2019 4:52 am

Re: Getting current tags in external function call (ink integration)

Post by nehvaleem »

Yes, the activeStory is as follows:

Code: Select all

var activeStory = stories[0];
            
if (!activeStory || lastInkConversation == null) return;
            
Debug.Log($"tags: {string.Join(",",activeStory.currentTags)}, text: {activeStory.currentText}");
And in this case the both tags and currenttext returns empty string. I am using the tags for example in OnPrepareConversationLine and it is working there without any issues. Every line in my file has tags, so I should be able to get "something" and not empty strings. I am using 2.2.45 if that matters.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Getting current tags in external function call (ink integration)

Post by Tony Li »

Hi,

I don't know. I'll need to look into this. The integration isn't doing anything particularly special with tags or activeStory, as you can see because it's good in OnPrepareConversationLine.

In your SetCharacterAttribute() method, does the rest of activeStory look correct?
nehvaleem
Posts: 96
Joined: Tue Sep 10, 2019 4:52 am

Re: Getting current tags in external function call (ink integration)

Post by nehvaleem »

In your SetCharacterAttribute() method, does the rest of activeStory look correct?
I don't think it does. But it is exactly the same way as I accessing it in different places (like in OnPrepareConversationLine) that's why I am kind of lost here :)
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Getting current tags in external function call (ink integration)

Post by Tony Li »

I'll try to reproduce the issue and see if I can figure out what's going on.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Getting current tags in external function call (ink integration)

Post by Tony Li »

Hi,

It looks like Ink processes things in order, so at the time SetCharacterAttribute() is called the story will not have the tag #LineTag_002_0201_6B477ABA_Sentry:

Code: Select all

* [Sentry: We might be ronin, but we still walk the path of honor.] {SetCharacterAttribute("sentry","ronin",1, true)} # LineTag_002_0201_6B477ABA_Sentry
Try putting the tag first, like:

Code: Select all

#LineTag_002_0201_6B477ABA_Sentry
* [Sentry: We might be ronin, but we still walk the path of honor.] {SetCharacterAttribute("sentry","ronin",1, true)} 
This worked in my simpler test.
Post Reply