ink icon indicating copy to clipboard operation
ink copied to clipboard

Can not get tags for knot that accept parameters

Open nehvaleem opened this issue 4 years ago • 4 comments

I believe it is a bug because I am unable to obtain tags for a specific knot when it accepts parameters. When it does not take any parameters - everything works fine.

I've managed to do a quick workaround in Story.cs around line 2391

Original:

List<string> tags = null;
            foreach (var c in flowContainer.content) {
                var tag = c as Runtime.Tag;
                if (tag) {
                    if (tags == null) tags = new List<string> ();
                    tags.Add (tag.text);
                } else break;
            }

            return tags;

Modified:

List<string> tags = null;
            foreach (var c in flowContainer.content.Where(item => item is Runtime.Tag)) {
                var tag = c as Runtime.Tag;
                if (tag) {
                    if (tags == null) tags = new List<string> ();
                    tags.Add (tag.text);
                } else break;
            }

            return tags;

It is caused how content is organized. When there are parameters in the knot the first object in flowContainer.content is of type VariableAssignment and thus the flow breaks and null list is being returned.

nehvaleem avatar Nov 25 '20 09:11 nehvaleem

any updates?

nehvaleem avatar Dec 19 '20 13:12 nehvaleem

Wow, that would be a total showstopper for my game. Your fix seemed to fix it? Then it should probably be added sooner rather than later. Good catch!

klootas avatar Dec 20 '20 10:12 klootas

We've not looked at this yet. Submitting a pull request might help us to keep track of it though, if you have the time to do that?

joningold avatar Dec 20 '20 15:12 joningold

We've not looked at this yet. Submitting a pull request might help us to keep track of it though, if you have the time to do that?

@joningold I've just created the pull request with necessary fix. https://github.com/inkle/ink/pull/640

nehvaleem avatar Jan 12 '21 17:01 nehvaleem