inkgd
inkgd copied to clipboard
tags_for_content_at_path() not working 4.2+
Describe the bug _ink_player.tags_for_content_at_path(path) returns Nil. I looked it up and located the function in the ink_story and added 3 print checks there:
func tags_at_start_of_flow_container_with_path_string(path_string: String):
var path = InkPath.new_with_components_string(path_string)
print(path)
var flow_container = content_at_path(path).container
while (true):
var first_content = flow_container.content[0]
if InkUtils.is_ink_class(first_content, "InkContainer"):
flow_container = first_content
else: break
var in_tag := false
var tags = null # Array<String>
for c in flow_container.content:
var command = InkUtils.as_or_null(c, "ControlCommand")
if command != null:
if command.command_type == InkControlCommand.CommandType.BEGIN_TAG:
in_tag = true
elif command.command_type == InkControlCommand.CommandType.END_TAG:
in_tag = false
print("command")
elif in_tag:
print("in_tag")
var _str = InkUtils.as_or_null(c, "StringValue")
if _str != null:
if tags == null:
tags = [] # Array<String>
tags.append(_str.value)
print(str("\"", _str.value, "\""))
else:
self.error(str(
"Tag contained non-text content. Only plain text is allowed when using ",
"globalTags or TagsAtContentPath. If you want to evaluate dynamic ",
"content, you need to use story.Continue()."
))
else:
print("else")
break
return tags
I got the right path string and "else". Seems like it can't correctly detect the tags.
To Reproduce
Add # Test tag to the missing_reel knot of the intercept and add print(_ink_player.tags_for_content_at_path("missing_reel")) at the end of the _loaded() function.
Expected behavior Print out the tags for the knot of the given path
Ink files the_intercept.ink
Environment:
- OS: Win 11 x64
- Godot version: 4.3
- Inklecate version: NA
- inkgd version: inkgd godot4 branch
Additional context Related ink content:
=== missing_reel ===
# Test tag
* [The stolen component...]
* [Shrug]
I shrug.
->->
- The reel went missing from the Bombe this afternoon. The four of us were in the Hut, working on the latest German intercept. The results were garbage. It was Russell who found the gap in the plugboard.
- Any of us could have taken it; and no one else would have known its worth.
* {forceful <= 0 }[Panic] They will pin it on me. They need a scapegoat so that the work can continue. I'm a likely target. Weaker than the rest.
~ lower(forceful)
* [Calculate] My odds, then, are one in four. Not bad; although the stakes themselves are higher than I would like.
~ raise(evasive)
* {evasive >= 0} [Deny] But this is still a mere formality. The work will not stop. A replacement component will be made and we will all be put back to work. We are too valuable to shoot.
~ raise(forceful)
- ->->