Making text appear only once in Dialogue manager

Godot V 4.3

Question:
I am having trouble with this dialogue manager extension for my godot game. The game itself has the player walking around and talking to NPC’s now if the player has already talked to this NPC it will choose “for now” randomly 1 of the other dialogues to give to the player. However these dialogues can repeat. I DO NOT WANT THIS. I want the manager to never repeat the same dialogue and if the player runs out of dialogue the NPC just says “that’s all the time I have” how do I do this using dialogue manager. Here is what I have so far

~ start
if not GameState.has_met_accountant
set GameState.has_met_accountant = true

Accountant: "...Oh. Hey. You're...uh...you. Right. Guess I should introduce myself."
Accountant: "I'm {{GameState.npc_name}}. I do accounting. Not by choice."
Accountant: "Anyway. What do you want?"

- Just saying hi.
	Accountant: "Cool. Hi. Can I, uh, go back to doing nothing now?"
- You don't seem too excited to be here.
	Accountant: "Oh, no, I'm [wave amp=25 freq=5]thrilled.[/wave] This is exactly how I wanted to spend my evening. Woooo. Party."
	Accountant: "Look, if the numbers aren't on fire, I usually don't care."
- How's the accounting life?
	Accountant: "Exciting. Riveting. Absolutely life-changing. Yesterday, I balanced a spreadsheet. The suspense was unreal."

Accountant: "Anyway. If you need someone to make small talk with, maybe find someone who *wants* to be here."
=> END

else
%
Accountant: “…Oh. You again. What now?”
- Just thought I’d check in on my favorite accountant.
Accountant: “Favorite? Yikes. If I’m your favorite, you need better taste in accountants.”
- You look like you’re having fun.
Accountant: “I look like I’m awake. That’s about it.”
- I already forgot your name.
Accountant: “Figures. It’s {{GameState.npc_name}}. But, hey, I’ll probably forget yours too, so we’re even.”
Accountant: “Alright. That’s enough social interaction for today. See ya.”
=> END

% 
	Accountant: "Oh wow, it’s you. Again. What a surprise."
	- Enjoying the party yet?
		Accountant: "Oh yeah. Totally. I'm having the time of my life. Woohoo. Party animal."
	- You ever smile?
		Accountant: "[speed=0.05]...[/speed] That was it. You missed it."
	- So, crunched any numbers today?
		Accountant: "Yeah, I calculated the exact amount of patience I have left. Wanna guess?"
	Accountant: "Alright, well, you’ve used up today’s conversation quota. Bye."
	=> END

You have access to global scripts. I don’t think there’s anything from stopping you doing something like this:

# GameState.gd
var random_dialogue_ids : Array[int] = [1, 2, 3]

func get_random_dialogue_id()->int:
	var id : int = -1
	if random_dialogue_ids.size() > 0:
		randi_range(0, random_dialogue_ids.size())
		random_dialogue_ids.erase(id)
	return id

Then in Dialogue Manager, check the function’s return value. The function will always return a new number, until the array is empty. If the array is empty, the return value is -1. This indicates there is now more new random dialogue to show.

This creates a massive dependency between your dialogue script and GameState script, so use with care and maybe make the solution a bit more robust.