godot_dialogue_manager icon indicating copy to clipboard operation
godot_dialogue_manager copied to clipboard

Change Response & Option parsing to work more like other lines of dialogue

Open lackhand opened this issue 4 months ago • 1 comments

Is your feature request related to a problem? Please describe. Yes; I had an inscrutable error and the workaround is ugly. TL;DR: choose only once random elements and option elements are cumbersome and buggy.

I have dialog that is mediated by path through the game, so I expose methods & changes from my balloon like:

## interacts with the resource meta fields to track conversational state
func _get_hit_counts(resource: DialogueResource)) -> Dictionary[Variant, int]: pass
## Returns number of times the loc has been hit (and since 0 is falsey...) 
func seen(loc: Variant) -> bool: return _get_hit_counts(loc)
## Increments `loc`'s hit count by `i`. The balloon subscribes to dialog manager's saw_title signal, so `loc` is automatically called for each title.
func see(loc: Variant, i := +1) -> void: ...
## Is this the first time in this title?
func is_firsttime() -> bool: return seen(most_recent_title)
...

This lets me write script code in wizard.dialogue like:

~ juicy
% [if not seen("j0")] GreEtInGs [do see("j0")]
% [if not seen("j1")] gREeTiNgs [do see("j1")]

(etc, and you can imagine the same structure for responses)

this does not work, because of some kind of parser error (see thread)

I also want:

~ better_hidden_responses
- [if not seen("just_once")] I only show as an option one time because the balloon is cfgd to discard invalid responses.
- [#:[["red", "disabled"] if seen("hazard") else []]] Responses would support tags, and I conditionally acquire a tag based on code.

(obviously that syntax is garbage, but hopefully the idea is clear)

Describe the solution you'd like See above; parser changes to:

  1. Allow random blocks to have a conditional-once style feature defined more compactly
  2. Allow random & response to support tags (afaict they don't?)
  3. Allow code to specify tag values

Describe alternatives you've considered Not build these features in the dialogue manager language.

There's a workaround for item 1, use the block syntax. This does work:

~ juicy
% [if not seen("j0")]
  do see("j0")
  GreEtInGs
...

There is not a great workaround for item 2; I do not see a way to attach metadata to non-spoken lines.

Item 3 has an okay workaround. Use self-signaling, so that if I name a tag dynamic0 I know in my balloon to use some kind of dynamic lookup function to resolve the actual behavior of the tag. Spooky action at a distance though.

Additional context This is a lovely product. I'm happy to take a stab at implementation.

lackhand avatar Aug 15 '25 17:08 lackhand

I have a solution to this but it's a breaking change so I'll merge in the other stuff that's on the go into a final 3.x release before I bump Dialogue Manager to 4.x

nathanhoad avatar Oct 02 '25 23:10 nathanhoad